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/a2dp/a2d_api.c b/stack/a2dp/a2d_api.c
index 2f31d1b..977aa68 100644
--- a/stack/a2dp/a2d_api.c
+++ b/stack/a2dp/a2d_api.c
@@ -32,7 +32,7 @@
 /*****************************************************************************
 **  Global data
 *****************************************************************************/
-#if A2D_DYNAMIC_MEMORY == FALSE
+#if (A2D_DYNAMIC_MEMORY == FALSE)
 tA2D_CB a2d_cb;
 #endif
 
@@ -52,11 +52,11 @@
 ** Returns          Nothing.
 **
 ******************************************************************************/
-static void a2d_sdp_cback(UINT16 status)
+static void a2d_sdp_cback(uint16_t status)
 {
     tSDP_DISC_REC       *p_rec = NULL;
     tSDP_DISC_ATTR      *p_attr;
-    BOOLEAN             found = FALSE;
+    bool                found = false;
     tA2D_Service        a2d_svc;
     tSDP_PROTOCOL_ELEM  elem;
 
@@ -106,10 +106,10 @@
             }
 
             /* we've got everything, we're done */
-            found = TRUE;
+            found = true;
             break;
 
-        } while (TRUE);
+        } while (true);
     }
 
     a2d_cb.find.service_uuid = 0;
@@ -133,7 +133,7 @@
 ** Returns          None
 **
 *******************************************************************************/
-void a2d_set_avdt_sdp_ver (UINT16 avdt_sdp_ver)
+void a2d_set_avdt_sdp_ver (uint16_t avdt_sdp_ver)
 {
     a2d_cb.avdt_sdp_ver = avdt_sdp_ver;
 }
@@ -168,13 +168,13 @@
 **                  A2D_FAIL if function execution failed.
 **
 ******************************************************************************/
-tA2D_STATUS A2D_AddRecord(UINT16 service_uuid, char *p_service_name, char *p_provider_name,
-        UINT16 features, UINT32 sdp_handle)
+tA2D_STATUS A2D_AddRecord(uint16_t service_uuid, char *p_service_name, char *p_provider_name,
+        uint16_t features, uint32_t sdp_handle)
 {
-    UINT16      browse_list[1];
-    BOOLEAN     result = TRUE;
-    UINT8       temp[8];
-    UINT8       *p;
+    uint16_t    browse_list[1];
+    bool        result = true;
+    uint8_t     temp[8];
+    uint8_t     *p;
     tSDP_PROTOCOL_ELEM  proto_list [A2D_NUM_PROTO_ELEMS];
 
     A2D_TRACE_API("A2D_AddRecord uuid: %x", service_uuid);
@@ -207,21 +207,21 @@
         p = temp;
         UINT16_TO_BE_STREAM(p, features);
         result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE,
-                  (UINT32)2, (UINT8*)temp);
+                  (uint32_t)2, (uint8_t*)temp);
     }
 
     /* add provider name */
     if (p_provider_name != NULL)
     {
         result &= SDP_AddAttribute(sdp_handle, ATTR_ID_PROVIDER_NAME, TEXT_STR_DESC_TYPE,
-                    (UINT32)(strlen(p_provider_name)+1), (UINT8 *) p_provider_name);
+                    (uint32_t)(strlen(p_provider_name)+1), (uint8_t *) p_provider_name);
     }
 
     /* add service name */
     if (p_service_name != NULL)
     {
         result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SERVICE_NAME, TEXT_STR_DESC_TYPE,
-                    (UINT32)(strlen(p_service_name)+1), (UINT8 *) p_service_name);
+                    (uint32_t)(strlen(p_service_name)+1), (uint8_t *) p_service_name);
     }
 
     /* add browse group list */
@@ -267,12 +267,12 @@
 **                  A2D_FAIL if function execution failed.
 **
 ******************************************************************************/
-tA2D_STATUS A2D_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
+tA2D_STATUS A2D_FindService(uint16_t service_uuid, BD_ADDR bd_addr,
                         tA2D_SDP_DB_PARAMS *p_db, tA2D_FIND_CBACK *p_cback)
 {
     tSDP_UUID   uuid_list;
-    BOOLEAN     result = TRUE;
-    UINT16      a2d_attr_list[] = {ATTR_ID_SERVICE_CLASS_ID_LIST, /* update A2D_NUM_ATTR, if changed */
+    bool        result = true;
+    uint16_t    a2d_attr_list[] = {ATTR_ID_SERVICE_CLASS_ID_LIST, /* update A2D_NUM_ATTR, if changed */
                                    ATTR_ID_BT_PROFILE_DESC_LIST,
                                    ATTR_ID_SUPPORTED_FEATURES,
                                    ATTR_ID_SERVICE_NAME,
@@ -304,7 +304,7 @@
     result = SDP_InitDiscoveryDb(a2d_cb.find.p_db, p_db->db_len, 1, &uuid_list, p_db->num_attr,
                                  p_db->p_attrs);
 
-    if (result == TRUE)
+    if (result == true)
     {
         /* store service_uuid */
         a2d_cb.find.service_uuid = service_uuid;
@@ -312,7 +312,7 @@
 
         /* perform service search */
         result = SDP_ServiceSearchAttributeRequest(bd_addr, a2d_cb.find.p_db, a2d_sdp_cback);
-        if(FALSE == result)
+        if(false == result)
         {
             a2d_cb.find.service_uuid = 0;
         }
@@ -342,7 +342,7 @@
 **                  the input parameter is 0xff.
 **
 ******************************************************************************/
-UINT8 A2D_SetTraceLevel (UINT8 new_level)
+uint8_t A2D_SetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         a2d_cb.trace_level = new_level;
@@ -358,10 +358,10 @@
 **                  A2D_SET_ZERO_BIT, if all bits clear
 **                  A2D_SET_MULTL_BIT, if multiple bits are set
 ******************************************************************************/
-UINT8 A2D_BitsSet(UINT8 num)
+uint8_t A2D_BitsSet(uint8_t num)
 {
-    UINT8   count;
-    BOOLEAN res;
+    uint8_t count;
+    bool    res;
     if(num == 0)
         res = A2D_SET_ZERO_BIT;
     else
diff --git a/stack/a2dp/a2d_int.h b/stack/a2dp/a2d_int.h
index 6742fb2..d7569d1 100644
--- a/stack/a2dp/a2d_int.h
+++ b/stack/a2dp/a2d_int.h
@@ -50,21 +50,21 @@
 {
     tA2D_FIND_CBACK     *p_cback;       /* pointer to application callback */
     tSDP_DISCOVERY_DB   *p_db;          /* pointer to discovery database */
-    UINT16              service_uuid;   /* service UUID of search */
+    uint16_t            service_uuid;   /* service UUID of search */
 } tA2D_FIND_CB;
 
 typedef struct
 {
     tA2D_FIND_CB    find;   /* find service control block */
-    UINT8           trace_level;
-    BOOLEAN         use_desc;
-    UINT16          avdt_sdp_ver;   /* AVDTP version */
+    uint8_t         trace_level;
+    bool            use_desc;
+    uint16_t        avdt_sdp_ver;   /* AVDTP version */
 } tA2D_CB;
 
 /******************************************************************************
 ** Main Control Block
 *******************************************************************************/
-#if A2D_DYNAMIC_MEMORY == FALSE
+#if (A2D_DYNAMIC_MEMORY == FALSE)
 extern tA2D_CB  a2d_cb;
 #else
 extern tA2D_CB *a2d_cb_ptr;
@@ -72,7 +72,7 @@
 #endif
 
 /* Used only for conformance testing */
-extern void a2d_set_avdt_sdp_ver (UINT16 avdt_sdp_ver);
+extern void a2d_set_avdt_sdp_ver (uint16_t avdt_sdp_ver);
 
 #ifdef __cplusplus
 }
diff --git a/stack/a2dp/a2d_sbc.c b/stack/a2dp/a2d_sbc.c
index de53199..37d712f 100644
--- a/stack/a2dp/a2d_sbc.c
+++ b/stack/a2dp/a2d_sbc.c
@@ -92,15 +92,15 @@
 
 typedef struct
 {
-    UINT8   use;
-    UINT8   idx;
+    uint8_t use;
+    uint8_t idx;
 } tA2D_SBC_FR_CB;
 
 typedef struct
 {
     tA2D_SBC_FR_CB  fr[2];
-    UINT8           index;
-    UINT8           base;
+    uint8_t         index;
+    uint8_t         base;
 } tA2D_SBC_DS_CB;
 
 static tA2D_SBC_DS_CB a2d_sbc_ds_cb;
@@ -113,15 +113,15 @@
 **
 ** Returns          nothing.
 ******************************************************************************/
-void A2D_SbcChkFrInit(UINT8 *p_pkt)
+void A2D_SbcChkFrInit(uint8_t *p_pkt)
 {
-    UINT8   fmt;
-    UINT8   num_chnl = 1;
-    UINT8   num_subband = 4;
+    uint8_t fmt;
+    uint8_t num_chnl = 1;
+    uint8_t num_subband = 4;
 
     if((p_pkt[0] & A2D_SBC_SYNC_MASK) == 0)
     {
-        a2d_cb.use_desc = TRUE;
+        a2d_cb.use_desc = true;
         fmt = p_pkt[1];
         p_pkt[0] |= A2D_SBC_SYNC_MASK;
         memset(&a2d_sbc_ds_cb, 0, sizeof(tA2D_SBC_DS_CB));
@@ -143,10 +143,10 @@
 **
 ** Returns          nothing.
 ******************************************************************************/
-void A2D_SbcDescramble(UINT8 *p_pkt, UINT16 len)
+void A2D_SbcDescramble(uint8_t *p_pkt, uint16_t len)
 {
     tA2D_SBC_FR_CB *p_cur, *p_last;
-    UINT32   idx, tmp, tmp2;
+    uint32_t idx, tmp, tmp2;
 
     if(a2d_cb.use_desc)
     {
@@ -185,10 +185,10 @@
             {
                 tmp2        = p_pkt[idx];
                 tmp         = (tmp2>>3)+(tmp2<<5);
-                p_pkt[idx]  = (UINT8)tmp;
+                p_pkt[idx]  = (uint8_t)tmp;
                 /*
                 printf("tmp: x%02x, len: %d, idx: %d(cmp:%d)\n",
-                    (UINT8)tmp2, len, a2d_sbc_ds_cb.fr[a2d_sbc_ds_cb.index].idx,
+                    (uint8_t)tmp2, len, a2d_sbc_ds_cb.fr[a2d_sbc_ds_cb.index].idx,
                     (a2d_sbc_ds_cb.base+(idx<<1)));
                     */
             }
@@ -220,7 +220,7 @@
 ** Returns          A2D_SUCCESS if function execution succeeded.
 **                  Error status code, otherwise.
 ******************************************************************************/
-tA2D_STATUS A2D_BldSbcInfo(UINT8 media_type, tA2D_SBC_CIE *p_ie, UINT8 *p_result)
+tA2D_STATUS A2D_BldSbcInfo(uint8_t media_type, tA2D_SBC_CIE *p_ie, uint8_t *p_result)
 {
     tA2D_STATUS status;
 
@@ -267,7 +267,7 @@
 **                  Input Parameters:
 **                      p_info:  the byte sequence to parse.
 **
-**                      for_caps:  TRUE, if the byte sequence is for get capabilities response.
+**                      for_caps:  true, if the byte sequence is for get capabilities response.
 **
 **                  Output Parameters:
 **                      p_ie:  The SBC Codec Information Element information.
@@ -275,11 +275,11 @@
 ** Returns          A2D_SUCCESS if function execution succeeded.
 **                  Error status code, otherwise.
 ******************************************************************************/
-tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, const UINT8 *p_info,
-                            BOOLEAN for_caps)
+tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, const uint8_t *p_info,
+                            bool for_caps)
 {
     tA2D_STATUS status = A2D_SUCCESS;
-    UINT8 losc;
+    uint8_t losc;
 
     if (p_ie == NULL || p_info == NULL)
         return A2D_INVALID_PARAMS;
@@ -308,7 +308,7 @@
          p_ie->max_bitpool < p_ie->min_bitpool)
         status = A2D_BAD_MAX_BITPOOL;
 
-    if (for_caps != FALSE)
+    if (for_caps != false)
         return status;
 
     if (A2D_BitsSet(p_ie->samp_freq) != A2D_SET_ONE_BIT)
@@ -347,7 +347,7 @@
 **
 ** Returns          void.
 ******************************************************************************/
-void A2D_BldSbcMplHdr(UINT8 *p_dst, BOOLEAN frag, BOOLEAN start, BOOLEAN last, UINT8 num)
+void A2D_BldSbcMplHdr(uint8_t *p_dst, bool frag, bool start, bool last, uint8_t num)
 {
     if(p_dst)
     {
@@ -384,13 +384,13 @@
 **
 ** Returns          void.
 ******************************************************************************/
-void A2D_ParsSbcMplHdr(UINT8 *p_src, BOOLEAN *p_frag, BOOLEAN *p_start, BOOLEAN *p_last, UINT8 *p_num)
+void A2D_ParsSbcMplHdr(uint8_t *p_src, bool *p_frag, bool *p_start, bool *p_last, uint8_t *p_num)
 {
     if(p_src && p_frag && p_start && p_last && p_num)
     {
-        *p_frag = (*p_src & A2D_SBC_HDR_F_MSK) ? TRUE: FALSE;
-        *p_start= (*p_src & A2D_SBC_HDR_S_MSK) ? TRUE: FALSE;
-        *p_last = (*p_src & A2D_SBC_HDR_L_MSK) ? TRUE: FALSE;
+        *p_frag = (*p_src & A2D_SBC_HDR_F_MSK) ? true: false;
+        *p_start= (*p_src & A2D_SBC_HDR_S_MSK) ? true: false;
+        *p_last = (*p_src & A2D_SBC_HDR_L_MSK) ? true: false;
         *p_num  = (*p_src & A2D_SBC_HDR_NUM_MSK);
     }
 }
diff --git a/stack/avct/avct_api.c b/stack/avct/avct_api.c
index 60647a5..bd45e9f 100644
--- a/stack/avct/avct_api.c
+++ b/stack/avct/avct_api.c
@@ -34,7 +34,7 @@
 #include "avct_int.h"
 
 /* Control block for AVCT */
-#if AVCT_DYNAMIC_MEMORY == FALSE
+#if (AVCT_DYNAMIC_MEMORY == FALSE)
 tAVCT_CB avct_cb;
 #endif
 
@@ -52,7 +52,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void AVCT_Register(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask)
+void AVCT_Register(uint16_t mtu, uint16_t mtu_br, uint8_t sec_mask)
 {
     UNUSED(mtu_br);
 
@@ -62,8 +62,8 @@
     L2CA_Register(AVCT_PSM, (tL2CAP_APPL_INFO *) &avct_l2c_appl);
 
     /* set security level */
-    BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_AVCTP, sec_mask, AVCT_PSM, 0, 0);
-    BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_AVCTP, sec_mask, AVCT_PSM, 0, 0);
+    BTM_SetSecurityLevel(true, "", BTM_SEC_SERVICE_AVCTP, sec_mask, AVCT_PSM, 0, 0);
+    BTM_SetSecurityLevel(false, "", BTM_SEC_SERVICE_AVCTP, sec_mask, AVCT_PSM, 0, 0);
 
     /* initialize AVCTP data structures */
     memset(&avct_cb, 0, sizeof(tAVCT_CB));
@@ -72,8 +72,8 @@
     /* Include the browsing channel which uses eFCR */
     L2CA_Register(AVCT_BR_PSM, (tL2CAP_APPL_INFO *) &avct_l2c_br_appl);
 
-    BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_AVCTP_BROWSE, sec_mask, AVCT_BR_PSM, 0, 0);
-    BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_AVCTP_BROWSE, sec_mask, AVCT_BR_PSM, 0, 0);
+    BTM_SetSecurityLevel(true, "", BTM_SEC_SERVICE_AVCTP_BROWSE, sec_mask, AVCT_BR_PSM, 0, 0);
+    BTM_SetSecurityLevel(false, "", BTM_SEC_SERVICE_AVCTP_BROWSE, sec_mask, AVCT_BR_PSM, 0, 0);
 
     if (mtu_br < AVCT_MIN_BROWSE_MTU)
         mtu_br = AVCT_MIN_BROWSE_MTU;
@@ -130,9 +130,9 @@
 ** Returns          AVCT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVCT_CreateConn(UINT8 *p_handle, tAVCT_CC *p_cc, BD_ADDR peer_addr)
+uint16_t AVCT_CreateConn(uint8_t *p_handle, tAVCT_CC *p_cc, BD_ADDR peer_addr)
 {
-    UINT16      result = AVCT_SUCCESS;
+    uint16_t    result = AVCT_SUCCESS;
     tAVCT_CCB   *p_ccb;
     tAVCT_LCB   *p_lcb;
 
@@ -193,9 +193,9 @@
 ** Returns          AVCT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVCT_RemoveConn(UINT8 handle)
+uint16_t AVCT_RemoveConn(uint8_t handle)
 {
-    UINT16              result = AVCT_SUCCESS;
+    uint16_t            result = AVCT_SUCCESS;
     tAVCT_CCB           *p_ccb;
 
     AVCT_TRACE_API("AVCT_RemoveConn");
@@ -234,10 +234,10 @@
 ** Returns          AVCT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVCT_CreateBrowse (UINT8 handle, UINT8 role)
+uint16_t AVCT_CreateBrowse (uint8_t handle, uint8_t role)
 {
 #if (AVCT_BROWSE_INCLUDED == TRUE)
-    UINT16      result = AVCT_SUCCESS;
+    uint16_t    result = AVCT_SUCCESS;
     tAVCT_CCB   *p_ccb;
     tAVCT_BCB   *p_bcb;
     int         index;
@@ -311,10 +311,10 @@
 ** Returns          AVCT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVCT_RemoveBrowse (UINT8 handle)
+uint16_t AVCT_RemoveBrowse (uint8_t handle)
 {
 #if (AVCT_BROWSE_INCLUDED == TRUE)
-    UINT16              result = AVCT_SUCCESS;
+    uint16_t            result = AVCT_SUCCESS;
     tAVCT_CCB           *p_ccb;
 
     AVCT_TRACE_API("AVCT_RemoveBrowse");
@@ -346,9 +346,9 @@
 ** Returns          the peer browsing channel MTU.
 **
 *******************************************************************************/
-UINT16 AVCT_GetBrowseMtu (UINT8 handle)
+uint16_t AVCT_GetBrowseMtu (uint8_t handle)
 {
-    UINT16  peer_mtu = AVCT_MIN_BROWSE_MTU;
+    uint16_t peer_mtu = AVCT_MIN_BROWSE_MTU;
 #if (AVCT_BROWSE_INCLUDED == TRUE)
     tAVCT_CCB           *p_ccb;
 
@@ -372,9 +372,9 @@
 ** Returns          the peer MTU size.
 **
 *******************************************************************************/
-UINT16 AVCT_GetPeerMtu (UINT8 handle)
+uint16_t AVCT_GetPeerMtu (uint8_t handle)
 {
-    UINT16      peer_mtu = L2CAP_DEFAULT_MTU;
+    uint16_t    peer_mtu = L2CAP_DEFAULT_MTU;
     tAVCT_CCB   *p_ccb;
 
     /* map handle to ccb */
@@ -410,9 +410,9 @@
 ** Returns          AVCT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVCT_MsgReq(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR *p_msg)
+uint16_t AVCT_MsgReq(uint8_t handle, uint8_t label, uint8_t cr, BT_HDR *p_msg)
 {
-    UINT16          result = AVCT_SUCCESS;
+    uint16_t        result = AVCT_SUCCESS;
     tAVCT_CCB       *p_ccb;
     tAVCT_UL_MSG    ul_msg;
 
diff --git a/stack/avct/avct_ccb.c b/stack/avct/avct_ccb.c
index e0f87de..6d204db 100644
--- a/stack/avct/avct_ccb.c
+++ b/stack/avct/avct_ccb.c
@@ -75,7 +75,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void avct_ccb_dealloc(tAVCT_CCB *p_ccb, UINT8 event, UINT16 result, BD_ADDR bd_addr)
+void avct_ccb_dealloc(tAVCT_CCB *p_ccb, uint8_t event, uint16_t result, BD_ADDR bd_addr)
 {
     tAVCT_CTRL_CBACK    *p_cback = p_ccb->cc.p_ctrl_cback;
 
@@ -109,10 +109,10 @@
 ** Returns          Index of ccb.
 **
 *******************************************************************************/
-UINT8 avct_ccb_to_idx(tAVCT_CCB *p_ccb)
+uint8_t avct_ccb_to_idx(tAVCT_CCB *p_ccb)
 {
     /* use array arithmetic to determine index */
-    return (UINT8) (p_ccb - avct_cb.ccb);
+    return (uint8_t) (p_ccb - avct_cb.ccb);
 }
 
 /*******************************************************************************
@@ -125,7 +125,7 @@
 ** Returns          pointer to the ccb, or NULL if none found.
 **
 *******************************************************************************/
-tAVCT_CCB *avct_ccb_by_idx(UINT8 idx)
+tAVCT_CCB *avct_ccb_by_idx(uint8_t idx)
 {
     tAVCT_CCB   *p_ccb;
 
diff --git a/stack/avct/avct_int.h b/stack/avct/avct_int.h
index d14e803..2d19c44 100644
--- a/stack/avct/avct_int.h
+++ b/stack/avct/avct_int.h
@@ -65,42 +65,42 @@
 *****************************************************************************/
 /* sub control block type - common data members for tAVCT_LCB and tAVCT_BCB */
 typedef struct {
-    UINT16              peer_mtu;	    /* peer l2c mtu */
-    UINT16              ch_result;      /* L2CAP connection result value */
-    UINT16              ch_lcid;        /* L2CAP channel LCID */
-    UINT8               allocated;      /* 0, not allocated. index+1, otherwise. */
-    UINT8               state;          /* The state machine state */
-    UINT8               ch_state;       /* L2CAP channel state */
-    UINT8               ch_flags;       /* L2CAP configuration flags */
+    uint16_t            peer_mtu;	    /* peer l2c mtu */
+    uint16_t            ch_result;      /* L2CAP connection result value */
+    uint16_t            ch_lcid;        /* L2CAP channel LCID */
+    uint8_t             allocated;      /* 0, not allocated. index+1, otherwise. */
+    uint8_t             state;          /* The state machine state */
+    uint8_t             ch_state;       /* L2CAP channel state */
+    uint8_t             ch_flags;       /* L2CAP configuration flags */
 } tAVCT_SCB;
 
 /* link control block type */
 typedef struct {
-    UINT16              peer_mtu;	    /* peer l2c mtu */
-    UINT16              ch_result;      /* L2CAP connection result value */
-    UINT16              ch_lcid;        /* L2CAP channel LCID */
-    UINT8               allocated;      /* 0, not allocated. index+1, otherwise. */
-    UINT8               state;          /* The state machine state */
-    UINT8               ch_state;       /* L2CAP channel state */
-    UINT8               ch_flags;       /* L2CAP configuration flags */
+    uint16_t            peer_mtu;	    /* peer l2c mtu */
+    uint16_t            ch_result;      /* L2CAP connection result value */
+    uint16_t            ch_lcid;        /* L2CAP channel LCID */
+    uint8_t             allocated;      /* 0, not allocated. index+1, otherwise. */
+    uint8_t             state;          /* The state machine state */
+    uint8_t             ch_state;       /* L2CAP channel state */
+    uint8_t             ch_flags;       /* L2CAP configuration flags */
     BT_HDR              *p_rx_msg;      /* Message being reassembled */
-    UINT16              conflict_lcid;  /* L2CAP channel LCID */
+    uint16_t            conflict_lcid;  /* L2CAP channel LCID */
     BD_ADDR             peer_addr;      /* BD address of peer */
     fixed_queue_t       *tx_q;          /* Transmit data buffer queue       */
-    BOOLEAN             cong;           /* TRUE, if congested */
+    bool                cong;           /* true, if congested */
 } tAVCT_LCB;
 
 /* browse control block type */
 typedef struct {
-    UINT16              peer_mtu;	    /* peer l2c mtu */
-    UINT16              ch_result;      /* L2CAP connection result value */
-    UINT16              ch_lcid;        /* L2CAP channel LCID */
-    UINT8               allocated;      /* 0, not allocated. index+1, otherwise. */
-    UINT8               state;          /* The state machine state */
-    UINT8               ch_state;       /* L2CAP channel state */
-    UINT8               ch_flags;       /* L2CAP configuration flags */
+    uint16_t            peer_mtu;	    /* peer l2c mtu */
+    uint16_t            ch_result;      /* L2CAP connection result value */
+    uint16_t            ch_lcid;        /* L2CAP channel LCID */
+    uint8_t             allocated;      /* 0, not allocated. index+1, otherwise. */
+    uint8_t             state;          /* The state machine state */
+    uint8_t             ch_state;       /* L2CAP channel state */
+    uint8_t             ch_flags;       /* L2CAP configuration flags */
     BT_HDR              *p_tx_msg;      /* Message to be sent - in case the browsing channel is not open when MsgReg is called */
-    UINT8               ch_close;       /* CCB index+1, if CCB initiated channel close */
+    uint8_t             ch_close;       /* CCB index+1, if CCB initiated channel close */
 } tAVCT_BCB;
 
 #define AVCT_ALOC_LCB       0x01
@@ -110,16 +110,16 @@
     tAVCT_CC            cc;                 /* parameters from connection creation */
     tAVCT_LCB           *p_lcb;             /* Associated LCB */
     tAVCT_BCB           *p_bcb;             /* associated BCB */
-    BOOLEAN             ch_close;           /* Whether CCB initiated channel close */
-    UINT8               allocated;          /* Whether LCB/BCB is allocated */
+    bool                ch_close;           /* Whether CCB initiated channel close */
+    uint8_t             allocated;          /* Whether LCB/BCB is allocated */
 } tAVCT_CCB;
 
 /* data type associated with UL_MSG_EVT */
 typedef struct {
     BT_HDR                  *p_buf;
     tAVCT_CCB               *p_ccb;
-    UINT8                   label;
-    UINT8                   cr;
+    uint8_t                 label;
+    uint8_t                 cr;
 } tAVCT_UL_MSG;
 
 /* union associated with lcb state machine events */
@@ -127,9 +127,9 @@
     tAVCT_UL_MSG            ul_msg;
     BT_HDR                  *p_buf;
     tAVCT_CCB               *p_ccb;
-    UINT16                  result;
-    BOOLEAN                 cong;
-    UINT8                   err_code;
+    uint16_t                result;
+    bool                    cong;
+    uint8_t                 err_code;
 } tAVCT_LCB_EVT;
 
 /* Control block for AVCT */
@@ -137,9 +137,9 @@
     tAVCT_LCB       lcb[AVCT_NUM_LINKS];    /* link control blocks */
     tAVCT_BCB       bcb[AVCT_NUM_LINKS];    /* browse control blocks */
     tAVCT_CCB       ccb[AVCT_NUM_CONN];     /* connection control blocks */
-    UINT16          mtu;                    /* our L2CAP MTU */
-    UINT16          mtu_br;                 /* our L2CAP MTU for the Browsing channel */
-    UINT8           trace_level;            /* trace level */
+    uint16_t        mtu;                    /* our L2CAP MTU */
+    uint16_t        mtu_br;                 /* our L2CAP MTU for the Browsing channel */
+    uint8_t         trace_level;            /* trace level */
 } tAVCT_CB;
 
 /*****************************************************************************
@@ -147,21 +147,21 @@
 *****************************************************************************/
 
 /* LCB function declarations */
-extern void avct_lcb_event(tAVCT_LCB *p_lcb, UINT8 event, tAVCT_LCB_EVT *p_data);
+extern void avct_lcb_event(tAVCT_LCB *p_lcb, uint8_t event, tAVCT_LCB_EVT *p_data);
 #if (AVCT_BROWSE_INCLUDED == TRUE)
-extern void avct_bcb_event(tAVCT_BCB *p_bcb, UINT8 event, tAVCT_LCB_EVT *p_data);
+extern void avct_bcb_event(tAVCT_BCB *p_bcb, uint8_t event, tAVCT_LCB_EVT *p_data);
 extern void avct_close_bcb(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
 extern tAVCT_LCB *avct_lcb_by_bcb(tAVCT_BCB *p_bcb);
 extern tAVCT_BCB *avct_bcb_by_lcb(tAVCT_LCB *p_lcb);
-extern BOOLEAN avct_bcb_last_ccb(tAVCT_BCB *p_bcb, tAVCT_CCB *p_ccb_last);
-extern tAVCT_BCB *avct_bcb_by_lcid(UINT16 lcid);
+extern bool    avct_bcb_last_ccb(tAVCT_BCB *p_bcb, tAVCT_CCB *p_ccb_last);
+extern tAVCT_BCB *avct_bcb_by_lcid(uint16_t lcid);
 #endif
 extern tAVCT_LCB *avct_lcb_by_bd(BD_ADDR bd_addr);
 extern tAVCT_LCB *avct_lcb_alloc(BD_ADDR bd_addr);
 extern void avct_lcb_dealloc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
-extern tAVCT_LCB *avct_lcb_by_lcid(UINT16 lcid);
-extern tAVCT_CCB *avct_lcb_has_pid(tAVCT_LCB *p_lcb, UINT16 pid);
-extern BOOLEAN avct_lcb_last_ccb(tAVCT_LCB *p_lcb, tAVCT_CCB *p_ccb_last);
+extern tAVCT_LCB *avct_lcb_by_lcid(uint16_t lcid);
+extern tAVCT_CCB *avct_lcb_has_pid(tAVCT_LCB *p_lcb, uint16_t pid);
+extern bool    avct_lcb_last_ccb(tAVCT_LCB *p_lcb, tAVCT_CCB *p_ccb_last);
 
 /* LCB action functions */
 extern void avct_lcb_chnl_open(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
@@ -202,15 +202,15 @@
 extern void avct_bcb_dealloc(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
 
 extern const tAVCT_BCB_ACTION avct_bcb_action[];
-extern const UINT8 avct_lcb_pkt_type_len[];
+extern const uint8_t avct_lcb_pkt_type_len[];
 extern const tL2CAP_FCR_OPTS avct_l2c_br_fcr_opts_def;
 #endif
 
 /* CCB function declarations */
 extern tAVCT_CCB *avct_ccb_alloc(tAVCT_CC *p_cc);
-extern void avct_ccb_dealloc(tAVCT_CCB *p_ccb, UINT8 event, UINT16 result, BD_ADDR bd_addr);
-extern UINT8 avct_ccb_to_idx(tAVCT_CCB *p_ccb);
-extern tAVCT_CCB *avct_ccb_by_idx(UINT8 idx);
+extern void avct_ccb_dealloc(tAVCT_CCB *p_ccb, uint8_t event, uint16_t result, BD_ADDR bd_addr);
+extern uint8_t avct_ccb_to_idx(tAVCT_CCB *p_ccb);
+extern tAVCT_CCB *avct_ccb_by_idx(uint8_t idx);
 
 
 /*****************************************************************************
@@ -218,7 +218,7 @@
 *****************************************************************************/
 
 /* Main control block */
-#if AVCT_DYNAMIC_MEMORY == FALSE
+#if (AVCT_DYNAMIC_MEMORY == FALSE)
 extern tAVCT_CB avct_cb;
 #else
 extern tAVCT_CB *avct_cb_ptr;
diff --git a/stack/avct/avct_l2c.c b/stack/avct/avct_l2c.c
index ab91d7a..422121c 100644
--- a/stack/avct/avct_l2c.c
+++ b/stack/avct/avct_l2c.c
@@ -36,14 +36,14 @@
 #define AVCT_L2C_CFG_CFM_DONE   (1<<1)
 
 /* callback function declarations */
-void avct_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id);
-void avct_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result);
-void avct_l2c_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg);
-void avct_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg);
-void avct_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed);
-void avct_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result);
-void avct_l2c_congestion_ind_cback(UINT16 lcid, BOOLEAN is_congested);
-void avct_l2c_data_ind_cback(UINT16 lcid, BT_HDR *p_buf);
+void avct_l2c_connect_ind_cback(BD_ADDR bd_addr, uint16_t lcid, uint16_t psm, uint8_t id);
+void avct_l2c_connect_cfm_cback(uint16_t lcid, uint16_t result);
+void avct_l2c_config_cfm_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg);
+void avct_l2c_config_ind_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg);
+void avct_l2c_disconnect_ind_cback(uint16_t lcid, bool ack_needed);
+void avct_l2c_disconnect_cfm_cback(uint16_t lcid, uint16_t result);
+void avct_l2c_congestion_ind_cback(uint16_t lcid, bool is_congested);
+void avct_l2c_data_ind_cback(uint16_t lcid, BT_HDR *p_buf);
 
 /* L2CAP callback function structure */
 const tL2CAP_APPL_INFO avct_l2c_appl = {
@@ -67,12 +67,12 @@
 ** Description      check is the CCB associated with the given LCB was created
 **                  as passive
 **
-** Returns          TRUE, if the given LCB is created as AVCT_PASSIVE
+** Returns          true, if the given LCB is created as AVCT_PASSIVE
 **
 *******************************************************************************/
-static BOOLEAN avct_l2c_is_passive (tAVCT_LCB *p_lcb)
+static bool avct_l2c_is_passive (tAVCT_LCB *p_lcb)
 {
-    BOOLEAN     is_passive = FALSE;
+    bool        is_passive = false;
     tAVCT_CCB   *p_ccb = &avct_cb.ccb[0];
     int         i;
 
@@ -83,7 +83,7 @@
             AVCT_TRACE_DEBUG("avct_l2c_is_ct control:x%x", p_ccb->cc.control);
             if (p_ccb->cc.control & AVCT_PASSIVE)
             {
-                is_passive = TRUE;
+                is_passive = true;
                 break;
             }
         }
@@ -101,10 +101,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avct_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
+void avct_l2c_connect_ind_cback(BD_ADDR bd_addr, uint16_t lcid, uint16_t psm, uint8_t id)
 {
     tAVCT_LCB       *p_lcb;
-    UINT16          result = L2CAP_CONN_OK;
+    uint16_t        result = L2CAP_CONN_OK;
     tL2CAP_CFG_INFO cfg;
     UNUSED(psm);
 
@@ -153,7 +153,7 @@
 
         /* Send L2CAP config req */
         memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO));
-        cfg.mtu_present = TRUE;
+        cfg.mtu_present = true;
         cfg.mtu = avct_cb.mtu;
         L2CA_ConfigReq(lcid, &cfg);
         AVCT_TRACE_DEBUG("avct_l2c snd Cfg Req");
@@ -175,7 +175,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avct_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
+void avct_l2c_connect_cfm_cback(uint16_t lcid, uint16_t result)
 {
     tAVCT_LCB       *p_lcb;
     tL2CAP_CFG_INFO cfg;
@@ -196,7 +196,7 @@
 
                 /* Send L2CAP config req */
                 memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO));
-                cfg.mtu_present = TRUE;
+                cfg.mtu_present = true;
                 cfg.mtu = avct_cb.mtu;
                 L2CA_ConfigReq(lcid, &cfg);
                 AVCT_TRACE_DEBUG("avct_l2c snd Cfg Req");
@@ -236,7 +236,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avct_l2c_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
+void avct_l2c_config_cfm_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg)
 {
     tAVCT_LCB       *p_lcb;
 
@@ -286,7 +286,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avct_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
+void avct_l2c_config_ind_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg)
 {
     tAVCT_LCB       *p_lcb;
 
@@ -336,10 +336,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avct_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed)
+void avct_l2c_disconnect_ind_cback(uint16_t lcid, bool ack_needed)
 {
     tAVCT_LCB       *p_lcb;
-    UINT16          result = AVCT_RESULT_FAIL;
+    uint16_t        result = AVCT_RESULT_FAIL;
 
     /* look up lcb for this channel */
     if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL)
@@ -366,10 +366,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avct_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result)
+void avct_l2c_disconnect_cfm_cback(uint16_t lcid, uint16_t result)
 {
     tAVCT_LCB       *p_lcb;
-    UINT16          res;
+    uint16_t        res;
 
     /* look up lcb for this channel */
     if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL)
@@ -395,7 +395,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avct_l2c_congestion_ind_cback(UINT16 lcid, BOOLEAN is_congested)
+void avct_l2c_congestion_ind_cback(uint16_t lcid, bool is_congested)
 {
     tAVCT_LCB       *p_lcb;
 
@@ -417,7 +417,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avct_l2c_data_ind_cback(UINT16 lcid, BT_HDR *p_buf)
+void avct_l2c_data_ind_cback(uint16_t lcid, BT_HDR *p_buf)
 {
     tAVCT_LCB       *p_lcb;
 
diff --git a/stack/avct/avct_lcb.c b/stack/avct/avct_lcb.c
index 2f01548..29e1f88 100644
--- a/stack/avct/avct_lcb.c
+++ b/stack/avct/avct_lcb.c
@@ -35,7 +35,7 @@
 ** state machine constants and types
 *****************************************************************************/
 
-#if BT_TRACE_VERBOSE == TRUE
+#if (BT_TRACE_VERBOSE == TRUE)
 
 /* verbose state strings for trace */
 const char * const avct_lcb_st_str[] = {
@@ -119,7 +119,7 @@
 #define AVCT_LCB_NUM_COLS           3       /* number of columns in state tables */
 
 /* state table for idle state */
-const UINT8 avct_lcb_st_idle[][AVCT_LCB_NUM_COLS] = {
+const uint8_t avct_lcb_st_idle[][AVCT_LCB_NUM_COLS] = {
 /* Event                Action 1                    Action 2                    Next state */
 /* UL_BIND_EVT */       {AVCT_LCB_CHNL_OPEN,        AVCT_LCB_IGNORE,            AVCT_LCB_OPENING_ST},
 /* UL_UNBIND_EVT */     {AVCT_LCB_UNBIND_DISC,      AVCT_LCB_IGNORE,            AVCT_LCB_IDLE_ST},
@@ -132,7 +132,7 @@
 };
 
 /* state table for opening state */
-const UINT8 avct_lcb_st_opening[][AVCT_LCB_NUM_COLS] = {
+const uint8_t avct_lcb_st_opening[][AVCT_LCB_NUM_COLS] = {
 /* Event                Action 1                    Action 2                    Next state */
 /* UL_BIND_EVT */       {AVCT_LCB_IGNORE,           AVCT_LCB_IGNORE,            AVCT_LCB_OPENING_ST},
 /* UL_UNBIND_EVT */     {AVCT_LCB_UNBIND_DISC,      AVCT_LCB_IGNORE,            AVCT_LCB_OPENING_ST},
@@ -145,7 +145,7 @@
 };
 
 /* state table for open state */
-const UINT8 avct_lcb_st_open[][AVCT_LCB_NUM_COLS] = {
+const uint8_t avct_lcb_st_open[][AVCT_LCB_NUM_COLS] = {
 /* Event                Action 1                    Action 2                    Next state */
 /* UL_BIND_EVT */       {AVCT_LCB_BIND_CONN,        AVCT_LCB_IGNORE,            AVCT_LCB_OPEN_ST},
 /* UL_UNBIND_EVT */     {AVCT_LCB_CHK_DISC,         AVCT_LCB_IGNORE,            AVCT_LCB_OPEN_ST},
@@ -158,7 +158,7 @@
 };
 
 /* state table for closing state */
-const UINT8 avct_lcb_st_closing[][AVCT_LCB_NUM_COLS] = {
+const uint8_t avct_lcb_st_closing[][AVCT_LCB_NUM_COLS] = {
 /* Event                Action 1                    Action 2                    Next state */
 /* UL_BIND_EVT */       {AVCT_LCB_BIND_FAIL,        AVCT_LCB_IGNORE,            AVCT_LCB_CLOSING_ST},
 /* UL_UNBIND_EVT */     {AVCT_LCB_IGNORE,           AVCT_LCB_IGNORE,            AVCT_LCB_CLOSING_ST},
@@ -171,7 +171,7 @@
 };
 
 /* type for state table */
-typedef const UINT8 (*tAVCT_LCB_ST_TBL)[AVCT_LCB_NUM_COLS];
+typedef const uint8_t (*tAVCT_LCB_ST_TBL)[AVCT_LCB_NUM_COLS];
 
 /* state table */
 const tAVCT_LCB_ST_TBL avct_lcb_st_tbl[] = {
@@ -191,13 +191,13 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avct_lcb_event(tAVCT_LCB *p_lcb, UINT8 event, tAVCT_LCB_EVT *p_data)
+void avct_lcb_event(tAVCT_LCB *p_lcb, uint8_t event, tAVCT_LCB_EVT *p_data)
 {
     tAVCT_LCB_ST_TBL    state_table;
-    UINT8               action;
+    uint8_t             action;
     int                 i;
 
-#if BT_TRACE_VERBOSE == TRUE
+#if (BT_TRACE_VERBOSE == TRUE)
     AVCT_TRACE_EVENT("LCB lcb=%d event=%s state=%s", p_lcb->allocated, avct_lcb_evt_str[event], avct_lcb_st_str[p_lcb->state]);
 #else
     AVCT_TRACE_EVENT("LCB lcb=%d event=%d state=%d", p_lcb->allocated, event, p_lcb->state);
@@ -234,13 +234,13 @@
 **
 *******************************************************************************/
 #if (AVCT_BROWSE_INCLUDED == TRUE)
-void avct_bcb_event(tAVCT_BCB *p_bcb, UINT8 event, tAVCT_LCB_EVT *p_data)
+void avct_bcb_event(tAVCT_BCB *p_bcb, uint8_t event, tAVCT_LCB_EVT *p_data)
 {
     tAVCT_LCB_ST_TBL    state_table;
-    UINT8               action;
+    uint8_t             action;
     int                 i;
 
-#if BT_TRACE_VERBOSE == TRUE
+#if (BT_TRACE_VERBOSE == TRUE)
     AVCT_TRACE_EVENT("BCB lcb=%d event=%s state=%s", p_bcb->allocated, avct_lcb_evt_str[event], avct_lcb_st_str[p_bcb->state]);
 #else
     AVCT_TRACE_EVENT("BCB lcb=%d event=%d state=%d", p_bcb->allocated, event, p_bcb->state);
@@ -321,7 +321,7 @@
     {
         if (!p_lcb->allocated)
         {
-            p_lcb->allocated = (UINT8)(i + 1);
+            p_lcb->allocated = (uint8_t)(i + 1);
             memcpy(p_lcb->peer_addr, bd_addr, BD_ADDR_LEN);
             AVCT_TRACE_DEBUG("avct_lcb_alloc %d", p_lcb->allocated);
             p_lcb->tx_q = fixed_queue_new(SIZE_MAX);
@@ -384,7 +384,7 @@
 ** Returns          pointer to the lcb, or NULL if none found.
 **
 *******************************************************************************/
-tAVCT_LCB *avct_lcb_by_lcid(UINT16 lcid)
+tAVCT_LCB *avct_lcb_by_lcid(uint16_t lcid)
 {
     tAVCT_LCB   *p_lcb = &avct_cb.lcb[0];
     int         i;
@@ -417,7 +417,7 @@
 ** Returns          Pointer to CCB if PID found, NULL otherwise.
 **
 *******************************************************************************/
-tAVCT_CCB *avct_lcb_has_pid(tAVCT_LCB *p_lcb, UINT16 pid)
+tAVCT_CCB *avct_lcb_has_pid(tAVCT_LCB *p_lcb, uint16_t pid)
 {
     tAVCT_CCB   *p_ccb = &avct_cb.ccb[0];
     int         i;
@@ -439,10 +439,10 @@
 ** Description      See if given ccb is only one on the lcb.
 **
 **
-** Returns          TRUE if ccb is last, FALSE otherwise.
+** Returns          true if ccb is last, false otherwise.
 **
 *******************************************************************************/
-BOOLEAN avct_lcb_last_ccb(tAVCT_LCB *p_lcb, tAVCT_CCB *p_ccb_last)
+bool    avct_lcb_last_ccb(tAVCT_LCB *p_lcb, tAVCT_CCB *p_ccb_last)
 {
     tAVCT_CCB   *p_ccb = &avct_cb.ccb[0];
     int         i;
@@ -454,10 +454,10 @@
             i, p_ccb->allocated, p_ccb->p_lcb, p_lcb, p_ccb, p_ccb_last);
         if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb) && (p_ccb != p_ccb_last))
         {
-            return FALSE;
+            return false;
         }
     }
-    return TRUE;
+    return true;
 }
 
 
diff --git a/stack/avct/avct_lcb_act.c b/stack/avct/avct_lcb_act.c
index c927622..c554888 100644
--- a/stack/avct/avct_lcb_act.c
+++ b/stack/avct/avct_lcb_act.c
@@ -32,7 +32,7 @@
 #include "btm_api.h"
 
 /* packet header length lookup table */
-const UINT8 avct_lcb_pkt_type_len[] = {
+const uint8_t avct_lcb_pkt_type_len[] = {
     AVCT_HDR_LEN_SINGLE,
     AVCT_HDR_LEN_START,
     AVCT_HDR_LEN_CONT,
@@ -52,12 +52,12 @@
 *******************************************************************************/
 static BT_HDR *avct_lcb_msg_asmbl(tAVCT_LCB *p_lcb, BT_HDR *p_buf)
 {
-    UINT8   *p;
-    UINT8   pkt_type;
+    uint8_t *p;
+    uint8_t pkt_type;
     BT_HDR  *p_ret;
 
     /* parse the message header */
-    p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p = (uint8_t *)(p_buf + 1) + p_buf->offset;
     AVCT_PRS_PKT_TYPE(p, pkt_type);
 
     /* quick sanity check on length */
@@ -100,7 +100,7 @@
         osi_free(p_buf);
 
         /* update p to point to new buffer */
-        p = (UINT8 *)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset;
+        p = (uint8_t *)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset;
 
         /* copy first header byte over nosp */
         *(p + 1) = *p;
@@ -130,7 +130,7 @@
              * NOTE: The buffer is allocated above at the beginning of the
              * reassembly, and is always of size BT_DEFAULT_BUFFER_SIZE.
              */
-            UINT16 buf_len = BT_DEFAULT_BUFFER_SIZE - sizeof(BT_HDR);
+            uint16_t buf_len = BT_DEFAULT_BUFFER_SIZE - sizeof(BT_HDR);
 
             /* adjust offset and len of fragment for header byte */
             p_buf->offset += AVCT_HDR_LEN_CONT;
@@ -145,8 +145,8 @@
                 p_ret = NULL;
             } else {
                 /* copy contents of p_buf to p_rx_msg */
-                memcpy((UINT8 *)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset,
-                       (UINT8 *)(p_buf + 1) + p_buf->offset, p_buf->len);
+                memcpy((uint8_t *)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset,
+                       (uint8_t *)(p_buf + 1) + p_buf->offset, p_buf->len);
 
                 if (pkt_type == AVCT_PKT_TYPE_END)
                 {
@@ -181,7 +181,7 @@
 *******************************************************************************/
 void avct_lcb_chnl_open(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
 {
-    UINT16 result = AVCT_RESULT_FAIL;
+    uint16_t result = AVCT_RESULT_FAIL;
     UNUSED(p_data);
 
     BTM_SetOutService(p_lcb->peer_addr, BTM_SEC_SERVICE_AVCTP, 0);
@@ -228,7 +228,7 @@
 {
     tAVCT_CCB   *p_ccb = &avct_cb.ccb[0];
     int         i;
-    BOOLEAN     bind = FALSE;
+    bool        bind = false;
 
     for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
     {
@@ -238,7 +238,7 @@
             /* if bound to this lcb send connect confirm event */
             if (p_ccb->p_lcb == p_lcb)
             {
-                bind = TRUE;
+                bind = true;
                 L2CA_SetTxPriority(p_lcb->ch_lcid, L2CAP_CHNL_PRIORITY_HIGH);
                 p_ccb->cc.p_ctrl_cback(avct_ccb_to_idx(p_ccb), AVCT_CONNECT_CFM_EVT,
                                        0, p_lcb->peer_addr);
@@ -248,7 +248,7 @@
                      (avct_lcb_has_pid(p_lcb, p_ccb->cc.pid) == NULL))
             {
                 /* bind ccb to lcb and send connect ind event */
-                bind = TRUE;
+                bind = true;
                 p_ccb->p_lcb = p_lcb;
                 L2CA_SetTxPriority(p_lcb->ch_lcid, L2CAP_CHNL_PRIORITY_HIGH);
                 p_ccb->cc.p_ctrl_cback(avct_ccb_to_idx(p_ccb), AVCT_CONNECT_IND_EVT,
@@ -258,7 +258,7 @@
     }
 
     /* if no ccbs bound to this lcb, disconnect */
-    if (bind == FALSE)
+    if (bind == false)
     {
         avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data);
     }
@@ -341,7 +341,7 @@
 {
     tAVCT_CCB           *p_ccb = &avct_cb.ccb[0];
     int                 i;
-    UINT8               event;
+    uint8_t             event;
 
     for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
     {
@@ -350,7 +350,7 @@
             /* if this ccb initiated close send disconnect cfm otherwise ind */
             if (p_ccb->ch_close)
             {
-                p_ccb->ch_close = FALSE;
+                p_ccb->ch_close = false;
                 event = AVCT_DISCONNECT_CFM_EVT;
             }
             else
@@ -410,7 +410,7 @@
     if (avct_lcb_last_ccb(p_lcb, p_data->p_ccb))
     {
         AVCT_TRACE_WARNING("closing");
-        p_data->p_ccb->ch_close = TRUE;
+        p_data->p_ccb->ch_close = true;
         avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data);
     }
     else
@@ -469,20 +469,20 @@
 {
     tAVCT_CCB           *p_ccb = &avct_cb.ccb[0];
     int                 i;
-    UINT8               event;
+    uint8_t             event;
     BT_HDR          *p_buf;
 
     /* set event */
     event = (p_data->cong) ? AVCT_CONG_IND_EVT : AVCT_UNCONG_IND_EVT;
     p_lcb->cong = p_data->cong;
-    if (p_lcb->cong == FALSE && !fixed_queue_is_empty(p_lcb->tx_q))
+    if (p_lcb->cong == false && !fixed_queue_is_empty(p_lcb->tx_q))
     {
         while (!p_lcb->cong &&
                (p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_lcb->tx_q)) != NULL)
         {
             if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED)
             {
-                p_lcb->cong = TRUE;
+                p_lcb->cong = true;
             }
         }
     }
@@ -527,13 +527,13 @@
 *******************************************************************************/
 void avct_lcb_send_msg(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
 {
-    UINT16          curr_msg_len;
-    UINT8           pkt_type;
-    UINT8           hdr_len;
-    UINT8           *p;
-    UINT8           nosp = 0;       /* number of subsequent packets */
-    UINT16          temp;
-    UINT16          buf_size = p_lcb->peer_mtu + L2CAP_MIN_OFFSET + BT_HDR_SIZE;
+    uint16_t        curr_msg_len;
+    uint8_t         pkt_type;
+    uint8_t         hdr_len;
+    uint8_t         *p;
+    uint8_t         nosp = 0;       /* number of subsequent packets */
+    uint16_t        temp;
+    uint16_t        buf_size = p_lcb->peer_mtu + L2CAP_MIN_OFFSET + BT_HDR_SIZE;
 
 
     /* store msg len */
@@ -570,8 +570,8 @@
             p_buf->offset = L2CAP_MIN_OFFSET + hdr_len;
             p_buf->len = p_lcb->peer_mtu - hdr_len;
 
-            memcpy((UINT8 *)(p_buf + 1) + p_buf->offset,
-                   (UINT8 *)(p_data->ul_msg.p_buf + 1) + p_data->ul_msg.p_buf->offset, p_buf->len);
+            memcpy((uint8_t *)(p_buf + 1) + p_buf->offset,
+                   (uint8_t *)(p_data->ul_msg.p_buf + 1) + p_data->ul_msg.p_buf->offset, p_buf->len);
 
             p_data->ul_msg.p_buf->offset += p_buf->len;
             p_data->ul_msg.p_buf->len -= p_buf->len;
@@ -586,7 +586,7 @@
         /* set up to build header */
         p_buf->len += hdr_len;
         p_buf->offset -= hdr_len;
-        p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+        p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
         /* build header */
         AVCT_BLD_HDR(p, p_data->ul_msg.label, pkt_type, p_data->ul_msg.cr);
@@ -599,7 +599,7 @@
             UINT16_TO_BE_STREAM(p, p_data->ul_msg.p_ccb->cc.pid);
         }
 
-        if (p_lcb->cong == TRUE)
+        if (p_lcb->cong == true)
         {
             fixed_queue_enqueue(p_lcb->tx_q, p_buf);
         }
@@ -609,7 +609,7 @@
         {
             if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED)
             {
-                p_lcb->cong = TRUE;
+                p_lcb->cong = true;
             }
         }
 
@@ -660,9 +660,9 @@
 *******************************************************************************/
 void avct_lcb_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
 {
-    UINT8       *p;
-    UINT8       label, type, cr_ipid;
-    UINT16      pid;
+    uint8_t     *p;
+    uint8_t     label, type, cr_ipid;
+    uint16_t    pid;
     tAVCT_CCB   *p_ccb;
 
     /* this p_buf is to be reported through p_msg_cback. The layer_specific
@@ -676,7 +676,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_data->p_buf + 1) + p_data->p_buf->offset;
+    p = (uint8_t *)(p_data->p_buf + 1) + p_data->p_buf->offset;
 
     /* parse header byte */
     AVCT_PRS_HDR(p, label, type, cr_ipid);
@@ -711,7 +711,7 @@
             BT_HDR *p_buf = (BT_HDR *)osi_malloc(AVCT_CMD_BUF_SIZE);
             p_buf->len = AVCT_HDR_LEN_SINGLE;
             p_buf->offset = AVCT_MSG_OFFSET - AVCT_HDR_LEN_SINGLE;
-            p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+            p = (uint8_t *)(p_buf + 1) + p_buf->offset;
             AVCT_BLD_HDR(p, label, AVCT_PKT_TYPE_SINGLE, AVCT_REJ);
             UINT16_TO_BE_STREAM(p, pid);
             L2CA_DataWrite(p_lcb->ch_lcid, p_buf);
diff --git a/stack/avdt/avdt_ad.c b/stack/avdt/avdt_ad.c
index f35162a..fbf1cf0 100644
--- a/stack/avdt/avdt_ad.c
+++ b/stack/avdt/avdt_ad.c
@@ -45,9 +45,9 @@
 ** Returns          TCID value.
 **
 *******************************************************************************/
-UINT8 avdt_ad_type_to_tcid(UINT8 type, tAVDT_SCB *p_scb)
+uint8_t avdt_ad_type_to_tcid(uint8_t type, tAVDT_SCB *p_scb)
 {
-    UINT8 scb_idx;
+    uint8_t scb_idx;
 
     if (type == AVDT_CHAN_SIG)
     {
@@ -73,9 +73,9 @@
 ** Returns          Channel type value.
 **
 *******************************************************************************/
-static UINT8 avdt_ad_tcid_to_type(UINT8 tcid)
+static uint8_t avdt_ad_tcid_to_type(uint8_t tcid)
 {
-    UINT8 type;
+    uint8_t type;
 
     if (tcid == 0)
     {
@@ -132,11 +132,11 @@
 **                  first matching entry (there could be more than one).
 **
 *******************************************************************************/
-tAVDT_TC_TBL *avdt_ad_tc_tbl_by_st(UINT8 type, tAVDT_CCB *p_ccb, UINT8 state)
+tAVDT_TC_TBL *avdt_ad_tc_tbl_by_st(uint8_t type, tAVDT_CCB *p_ccb, uint8_t state)
 {
     int             i;
     tAVDT_TC_TBL    *p_tbl = avdt_cb.ad.tc_tbl;
-    UINT8           ccb_idx;
+    uint8_t         ccb_idx;
 
     if (p_ccb == NULL)
     {
@@ -200,9 +200,9 @@
 ** Returns          Pointer to entry.
 **
 *******************************************************************************/
-tAVDT_TC_TBL *avdt_ad_tc_tbl_by_lcid(UINT16 lcid)
+tAVDT_TC_TBL *avdt_ad_tc_tbl_by_lcid(uint16_t lcid)
 {
-    UINT8 idx;
+    uint8_t idx;
 
     idx = avdt_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID];
 
@@ -228,12 +228,12 @@
 ** Returns          Pointer to transport channel table entry.
 **
 *******************************************************************************/
-tAVDT_TC_TBL *avdt_ad_tc_tbl_by_type(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb)
+tAVDT_TC_TBL *avdt_ad_tc_tbl_by_type(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb)
 {
-    UINT8           tcid;
+    uint8_t         tcid;
     int             i;
     tAVDT_TC_TBL    *p_tbl = avdt_cb.ad.tc_tbl;
-    UINT8           ccb_idx = avdt_ccb_to_idx(p_ccb);
+    uint8_t         ccb_idx = avdt_ccb_to_idx(p_ccb);
 
     /* get tcid from type, scb */
     tcid = avdt_ad_type_to_tcid(type, p_scb);
@@ -299,11 +299,11 @@
 ** Returns          Index value.
 **
 *******************************************************************************/
-UINT8 avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL *p_tbl)
+uint8_t avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL *p_tbl)
 {
     AVDT_TRACE_DEBUG("avdt_ad_tc_tbl_to_idx: %d", (p_tbl - avdt_cb.ad.tc_tbl));
     /* use array arithmetic to determine index */
-    return (UINT8) (p_tbl - avdt_cb.ad.tc_tbl);
+    return (uint8_t) (p_tbl - avdt_cb.ad.tc_tbl);
 }
 
 /*******************************************************************************
@@ -320,7 +320,7 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avdt_ad_tc_close_ind(tAVDT_TC_TBL *p_tbl, UINT16 reason)
+void avdt_ad_tc_close_ind(tAVDT_TC_TBL *p_tbl, uint16_t reason)
 {
     tAVDT_CCB   *p_ccb;
     tAVDT_SCB   *p_scb;
@@ -424,7 +424,7 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avdt_ad_tc_cong_ind(tAVDT_TC_TBL *p_tbl, BOOLEAN is_congested)
+void avdt_ad_tc_cong_ind(tAVDT_TC_TBL *p_tbl, bool    is_congested)
 {
     tAVDT_CCB   *p_ccb;
     tAVDT_SCB   *p_scb;
@@ -501,14 +501,14 @@
 **                  passes the data to L2CA_DataWrite().
 **
 **
-** Returns          AVDT_AD_SUCCESS, if data accepted, else FALSE
+** Returns          AVDT_AD_SUCCESS, if data accepted, else false
 **                  AVDT_AD_CONGESTED, if data accepted and the channel is congested
 **                  AVDT_AD_FAILED, if error
 **
 *******************************************************************************/
-UINT8 avdt_ad_write_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, BT_HDR *p_buf)
+uint8_t avdt_ad_write_req(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, BT_HDR *p_buf)
 {
-    UINT8   tcid;
+    uint8_t tcid;
 
     /* get tcid from type, scb */
     tcid = avdt_ad_type_to_tcid(type, p_scb);
@@ -534,10 +534,10 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role)
+void avdt_ad_open_req(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, uint8_t role)
 {
     tAVDT_TC_TBL    *p_tbl;
-    UINT16          lcid;
+    uint16_t        lcid;
 
     if((p_tbl = avdt_ad_tc_tbl_alloc(p_ccb)) == NULL)
     {
@@ -612,9 +612,9 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avdt_ad_close_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb)
+void avdt_ad_close_req(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb)
 {
-    UINT8           tcid;
+    uint8_t         tcid;
     tAVDT_TC_TBL    *p_tbl;
 
     p_tbl = avdt_ad_tc_tbl_by_type(type, p_ccb, p_scb);
diff --git a/stack/avdt/avdt_api.c b/stack/avdt/avdt_api.c
index 98ef5f7..e9e405f 100644
--- a/stack/avdt/avdt_api.c
+++ b/stack/avdt/avdt_api.c
@@ -35,7 +35,7 @@
 
 
 /* Control block for AVDT */
-#if AVDT_DYNAMIC_MEMORY == FALSE
+#if (AVDT_DYNAMIC_MEMORY == FALSE)
 tAVDT_CB avdt_cb;
 #endif
 
@@ -94,22 +94,22 @@
     L2CA_Register(AVDT_PSM, (tL2CAP_APPL_INFO *) &avdt_l2c_appl);
 
     /* set security level */
-    BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_AVDTP, p_reg->sec_mask,
+    BTM_SetSecurityLevel(true, "", BTM_SEC_SERVICE_AVDTP, p_reg->sec_mask,
         AVDT_PSM, BTM_SEC_PROTO_AVDT, AVDT_CHAN_SIG);
-    BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_AVDTP, p_reg->sec_mask,
+    BTM_SetSecurityLevel(false, "", BTM_SEC_SERVICE_AVDTP, p_reg->sec_mask,
         AVDT_PSM, BTM_SEC_PROTO_AVDT, AVDT_CHAN_SIG);
 
     /* do not use security on the media channel */
-    BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_AVDTP_NOSEC, BTM_SEC_NONE,
+    BTM_SetSecurityLevel(true, "", BTM_SEC_SERVICE_AVDTP_NOSEC, BTM_SEC_NONE,
         AVDT_PSM, BTM_SEC_PROTO_AVDT, AVDT_CHAN_MEDIA);
-    BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_AVDTP_NOSEC, BTM_SEC_NONE,
+    BTM_SetSecurityLevel(false, "", BTM_SEC_SERVICE_AVDTP_NOSEC, BTM_SEC_NONE,
         AVDT_PSM, BTM_SEC_PROTO_AVDT, AVDT_CHAN_MEDIA);
 
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     /* do not use security on the reporting channel */
-    BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_AVDTP_NOSEC, BTM_SEC_NONE,
+    BTM_SetSecurityLevel(true, "", BTM_SEC_SERVICE_AVDTP_NOSEC, BTM_SEC_NONE,
         AVDT_PSM, BTM_SEC_PROTO_AVDT, AVDT_CHAN_REPORT);
-    BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_AVDTP_NOSEC, BTM_SEC_NONE,
+    BTM_SetSecurityLevel(false, "", BTM_SEC_SERVICE_AVDTP_NOSEC, BTM_SEC_NONE,
         AVDT_PSM, BTM_SEC_PROTO_AVDT, AVDT_CHAN_REPORT);
 #endif
 
@@ -166,7 +166,7 @@
         {
             AVDT_TRACE_DEBUG("AVDT_SINK_Activate found scb");
             /* update in_use */
-            p_scb->in_use = FALSE;
+            p_scb->in_use = false;
             break;
         }
     }
@@ -177,7 +177,7 @@
 ** Function         AVDT_SINK_Deactivate
 **
 ** Description      Deactivate SEP of A2DP Sink. In Use parameter is adjusted.
-**                  In Use will be made TRUE in case of activation. A2DP SRC
+**                  In Use will be made true in case of activation. A2DP SRC
 **                  will receive in_use as true and will not open A2DP Sink
 **                  connection
 **
@@ -196,13 +196,13 @@
         {
             AVDT_TRACE_DEBUG("AVDT_SINK_Deactivate, found scb");
             /* update in_use */
-            p_scb->in_use = TRUE;
+            p_scb->in_use = true;
             break;
         }
     }
 }
 
-void AVDT_AbortReq(UINT8 handle)
+void AVDT_AbortReq(uint8_t handle)
 {
     AVDT_TRACE_ERROR("%s", __func__);
 
@@ -229,9 +229,9 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_CreateStream(UINT8 *p_handle, tAVDT_CS *p_cs)
+uint16_t AVDT_CreateStream(uint8_t *p_handle, tAVDT_CS *p_cs)
 {
-    UINT16      result = AVDT_SUCCESS;
+    uint16_t    result = AVDT_SUCCESS;
     tAVDT_SCB   *p_scb;
 
     /* Verify parameters; if invalid, return failure */
@@ -265,9 +265,9 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_RemoveStream(UINT8 handle)
+uint16_t AVDT_RemoveStream(uint8_t handle)
 {
-    UINT16      result = AVDT_SUCCESS;
+    uint16_t    result = AVDT_SUCCESS;
     tAVDT_SCB   *p_scb;
 
     /* look up scb */
@@ -309,11 +309,11 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_DiscoverReq(BD_ADDR bd_addr, tAVDT_SEP_INFO *p_sep_info,
-                        UINT8 max_seps, tAVDT_CTRL_CBACK *p_cback)
+uint16_t AVDT_DiscoverReq(BD_ADDR bd_addr, tAVDT_SEP_INFO *p_sep_info,
+                        uint8_t max_seps, tAVDT_CTRL_CBACK *p_cback)
 {
     tAVDT_CCB       *p_ccb;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
     tAVDT_CCB_EVT   evt;
 
     /* find channel control block for this bd addr; if none, allocate one */
@@ -355,10 +355,10 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-static UINT16 avdt_get_cap_req(BD_ADDR bd_addr, tAVDT_CCB_API_GETCAP *p_evt)
+static uint16_t avdt_get_cap_req(BD_ADDR bd_addr, tAVDT_CCB_API_GETCAP *p_evt)
 {
     tAVDT_CCB       *p_ccb = NULL;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
 
     /* verify SEID */
     if ((p_evt->single.seid < AVDT_SEID_MIN) || (p_evt->single.seid > AVDT_SEID_MAX))
@@ -416,7 +416,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_GetCapReq(BD_ADDR bd_addr, UINT8 seid, tAVDT_CFG *p_cfg, tAVDT_CTRL_CBACK *p_cback)
+uint16_t AVDT_GetCapReq(BD_ADDR bd_addr, uint8_t seid, tAVDT_CFG *p_cfg, tAVDT_CTRL_CBACK *p_cback)
 {
     tAVDT_CCB_API_GETCAP    getcap;
 
@@ -451,7 +451,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_GetAllCapReq(BD_ADDR bd_addr, UINT8 seid, tAVDT_CFG *p_cfg, tAVDT_CTRL_CBACK *p_cback)
+uint16_t AVDT_GetAllCapReq(BD_ADDR bd_addr, uint8_t seid, tAVDT_CFG *p_cfg, tAVDT_CTRL_CBACK *p_cback)
 {
     tAVDT_CCB_API_GETCAP    getcap;
 
@@ -473,10 +473,10 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_DelayReport(UINT8 handle, UINT8 seid, UINT16 delay)
+uint16_t AVDT_DelayReport(uint8_t handle, uint8_t seid, uint16_t delay)
 {
     tAVDT_SCB       *p_scb;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
     tAVDT_SCB_EVT   evt;
 
     /* map handle to scb */
@@ -508,11 +508,11 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_OpenReq(UINT8 handle, BD_ADDR bd_addr, UINT8 seid, tAVDT_CFG *p_cfg)
+uint16_t AVDT_OpenReq(uint8_t handle, BD_ADDR bd_addr, uint8_t seid, tAVDT_CFG *p_cfg)
 {
     tAVDT_CCB       *p_ccb = NULL;
     tAVDT_SCB       *p_scb = NULL;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
     tAVDT_SCB_EVT   evt;
 
     /* verify SEID */
@@ -559,12 +559,12 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_ConfigRsp(UINT8 handle, UINT8 label, UINT8 error_code, UINT8 category)
+uint16_t AVDT_ConfigRsp(uint8_t handle, uint8_t label, uint8_t error_code, uint8_t category)
 {
     tAVDT_SCB       *p_scb;
     tAVDT_SCB_EVT   evt;
-    UINT16          result = AVDT_SUCCESS;
-    UINT8           event_code;
+    uint16_t        result = AVDT_SUCCESS;
+    uint8_t         event_code;
 
     /* map handle to scb */
     if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
@@ -612,11 +612,11 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_StartReq(UINT8 *p_handles, UINT8 num_handles)
+uint16_t AVDT_StartReq(uint8_t *p_handles, uint8_t num_handles)
 {
     tAVDT_SCB       *p_scb = NULL;
     tAVDT_CCB_EVT   evt;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
     int             i;
 
     if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS))
@@ -668,11 +668,11 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_SuspendReq(UINT8 *p_handles, UINT8 num_handles)
+uint16_t AVDT_SuspendReq(uint8_t *p_handles, uint8_t num_handles)
 {
     tAVDT_SCB       *p_scb = NULL;
     tAVDT_CCB_EVT   evt;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
     int             i;
 
     if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS))
@@ -724,10 +724,10 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_CloseReq(UINT8 handle)
+uint16_t AVDT_CloseReq(uint8_t handle)
 {
     tAVDT_SCB       *p_scb;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
 
     /* map handle to scb */
     if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
@@ -759,10 +759,10 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_ReconfigReq(UINT8 handle, tAVDT_CFG *p_cfg)
+uint16_t AVDT_ReconfigReq(uint8_t handle, tAVDT_CFG *p_cfg)
 {
     tAVDT_SCB       *p_scb;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
     tAVDT_SCB_EVT   evt;
 
     /* map handle to scb */
@@ -794,11 +794,11 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_ReconfigRsp(UINT8 handle, UINT8 label, UINT8 error_code, UINT8 category)
+uint16_t AVDT_ReconfigRsp(uint8_t handle, uint8_t label, uint8_t error_code, uint8_t category)
 {
     tAVDT_SCB       *p_scb;
     tAVDT_SCB_EVT   evt;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
 
     /* map handle to scb */
     if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
@@ -831,10 +831,10 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_SecurityReq(UINT8 handle, UINT8 *p_data, UINT16 len)
+uint16_t AVDT_SecurityReq(uint8_t handle, uint8_t *p_data, uint16_t len)
 {
     tAVDT_SCB       *p_scb;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
     tAVDT_SCB_EVT   evt;
 
     /* map handle to scb */
@@ -866,11 +866,11 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_SecurityRsp(UINT8 handle, UINT8 label, UINT8 error_code,
-                        UINT8 *p_data, UINT16 len)
+uint16_t AVDT_SecurityRsp(uint8_t handle, uint8_t label, uint8_t error_code,
+                        uint8_t *p_data, uint16_t len)
 {
     tAVDT_SCB       *p_scb;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
     tAVDT_SCB_EVT   evt;
 
     /* map handle to scb */
@@ -926,11 +926,11 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_WriteReqOpt(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp, UINT8 m_pt, tAVDT_DATA_OPT_MASK opt)
+uint16_t AVDT_WriteReqOpt(uint8_t handle, BT_HDR *p_pkt, uint32_t time_stamp, uint8_t m_pt, tAVDT_DATA_OPT_MASK opt)
 {
     tAVDT_SCB       *p_scb;
     tAVDT_SCB_EVT   evt;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
 
     /* map handle to scb */
     if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
@@ -982,7 +982,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_WriteReq(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp, UINT8 m_pt)
+uint16_t AVDT_WriteReq(uint8_t handle, BT_HDR *p_pkt, uint32_t time_stamp, uint8_t m_pt)
 {
     return AVDT_WriteReqOpt(handle, p_pkt, time_stamp, m_pt, AVDT_DATA_OPT_NONE);
 }
@@ -1002,10 +1002,10 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_ConnectReq(BD_ADDR bd_addr, UINT8 sec_mask, tAVDT_CTRL_CBACK *p_cback)
+uint16_t AVDT_ConnectReq(BD_ADDR bd_addr, uint8_t sec_mask, tAVDT_CTRL_CBACK *p_cback)
 {
     tAVDT_CCB       *p_ccb = NULL;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
     tAVDT_CCB_EVT   evt;
 
     /* find channel control block for this bd addr; if none, allocate one */
@@ -1017,7 +1017,7 @@
             result = AVDT_NO_RESOURCES;
         }
     }
-    else if (p_ccb->ll_opened == FALSE)
+    else if (p_ccb->ll_opened == false)
     {
         AVDT_TRACE_WARNING("AVDT_ConnectReq: CCB LL is in the middle of opening");
 
@@ -1047,10 +1047,10 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-UINT16 AVDT_DisconnectReq(BD_ADDR bd_addr, tAVDT_CTRL_CBACK *p_cback)
+uint16_t AVDT_DisconnectReq(BD_ADDR bd_addr, tAVDT_CTRL_CBACK *p_cback)
 {
     tAVDT_CCB       *p_ccb = NULL;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
     tAVDT_CCB_EVT   evt;
 
     /* find channel control block for this bd addr; if none, error */
@@ -1077,12 +1077,12 @@
 ** Returns          CID if successful, otherwise 0.
 **
 *******************************************************************************/
-UINT16 AVDT_GetL2CapChannel(UINT8 handle)
+uint16_t AVDT_GetL2CapChannel(uint8_t handle)
 {
     tAVDT_SCB       *p_scb;
     tAVDT_CCB       *p_ccb;
-    UINT8           tcid;
-    UINT16          lcid = 0;
+    uint8_t         tcid;
+    uint16_t        lcid = 0;
 
     /* map handle to scb */
     if (((p_scb = avdt_scb_by_hdl(handle)) != NULL)
@@ -1106,12 +1106,12 @@
 ** Returns          CID if successful, otherwise 0.
 **
 *******************************************************************************/
-UINT16 AVDT_GetSignalChannel(UINT8 handle, BD_ADDR bd_addr)
+uint16_t AVDT_GetSignalChannel(uint8_t handle, BD_ADDR bd_addr)
 {
     tAVDT_SCB       *p_scb;
     tAVDT_CCB       *p_ccb;
-    UINT8           tcid = 0; /* tcid is always 0 for signal channel */
-    UINT16          lcid = 0;
+    uint8_t         tcid = 0; /* tcid is always 0 for signal channel */
+    uint16_t        lcid = 0;
 
     /* map handle to scb */
     if (((p_scb = avdt_scb_by_hdl(handle)) != NULL)
@@ -1127,7 +1127,7 @@
     return (lcid);
 }
 
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
 /*******************************************************************************
 **
 ** Function         AVDT_SetMediaBuf
@@ -1146,10 +1146,10 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_SetMediaBuf(UINT8 handle, UINT8 *p_buf, UINT32 buf_len)
+extern uint16_t AVDT_SetMediaBuf(uint8_t handle, uint8_t *p_buf, uint32_t buf_len)
 {
     tAVDT_SCB       *p_scb;
-    UINT16          result = AVDT_SUCCESS;
+    uint16_t        result = AVDT_SUCCESS;
 
     /* map handle to scb */
     if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
@@ -1171,7 +1171,7 @@
 }
 #endif
 
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
 /*******************************************************************************
 **
 ** Function         AVDT_SendReport
@@ -1183,18 +1183,18 @@
 ** Returns
 **
 *******************************************************************************/
-UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
+uint16_t AVDT_SendReport(uint8_t handle, AVDT_REPORT_TYPE type,
                        tAVDT_REPORT_DATA *p_data)
 {
     tAVDT_SCB       *p_scb;
-    UINT16          result = AVDT_BAD_PARAMS;
+    uint16_t        result = AVDT_BAD_PARAMS;
     tAVDT_TC_TBL    *p_tbl;
-    UINT8           *p, *plen, *pm1, *p_end;
-#if AVDT_MULTIPLEXING == TRUE
-    UINT8           *p_al=NULL, u;
+    uint8_t         *p, *plen, *pm1, *p_end;
+#if (AVDT_MULTIPLEXING == TRUE)
+    uint8_t         *p_al=NULL, u;
 #endif
-    UINT32  ssrc;
-    UINT16  len;
+    uint32_t ssrc;
+    uint16_t len;
 
     /* map handle to scb && verify parameters */
     if (((p_scb = avdt_scb_by_hdl(handle)) != NULL)
@@ -1211,8 +1211,8 @@
             BT_HDR *p_pkt = (BT_HDR *)osi_malloc(p_tbl->peer_mtu);
 
             p_pkt->offset = L2CAP_MIN_OFFSET;
-            p = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
-#if AVDT_MULTIPLEXING == TRUE
+            p = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
+#if (AVDT_MULTIPLEXING == TRUE)
             if(p_scb->curr_cfg.psc_mask & AVDT_PSC_MUX)
             {
                 /* Adaptation Layer header later */
@@ -1257,7 +1257,7 @@
                 len = strlen((char *)p_data->cname);
                 if(len > AVDT_MAX_CNAME_SIZE)
                     len = AVDT_MAX_CNAME_SIZE;
-                *p++ = (UINT8)len;
+                *p++ = (uint8_t)len;
                 strlcpy((char *)p, (char *)p_data->cname, len+1);
                 p += len;
                 break;
@@ -1266,7 +1266,7 @@
             len = p - pm1 - 1;
             UINT16_TO_BE_STREAM(plen, len);
 
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
             if(p_scb->curr_cfg.psc_mask & AVDT_PSC_MUX)
             {
                 /* Adaptation Layer header */
@@ -1314,7 +1314,7 @@
 **                  the input parameter is 0xff.
 **
 ******************************************************************************/
-UINT8 AVDT_SetTraceLevel (UINT8 new_level)
+uint8_t AVDT_SetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         avdt_cb.trace_level = new_level;
diff --git a/stack/avdt/avdt_ccb.c b/stack/avdt/avdt_ccb.c
index 194af6b..480838c 100644
--- a/stack/avdt/avdt_ccb.c
+++ b/stack/avdt/avdt_ccb.c
@@ -36,7 +36,7 @@
 /*****************************************************************************
 ** state machine constants and types
 *****************************************************************************/
-#if AVDT_DEBUG == TRUE
+#if (AVDT_DEBUG == TRUE)
 
 /* verbose state strings for trace */
 const char * const avdt_ccb_st_str[] = {
@@ -127,7 +127,7 @@
 #define AVDT_CCB_NUM_COLS           3       /* number of columns in state tables */
 
 /* state table for idle state */
-const UINT8 avdt_ccb_st_idle[][AVDT_CCB_NUM_COLS] = {
+const uint8_t avdt_ccb_st_idle[][AVDT_CCB_NUM_COLS] = {
 /* Event                      Action 1                    Action 2                    Next state */
 /* API_DISCOVER_REQ_EVT */   {AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_CHAN_OPEN,         AVDT_CCB_OPENING_ST},
 /* API_GETCAP_REQ_EVT */     {AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_CHAN_OPEN,         AVDT_CCB_OPENING_ST},
@@ -160,7 +160,7 @@
 };
 
 /* state table for opening state */
-const UINT8 avdt_ccb_st_opening[][AVDT_CCB_NUM_COLS] = {
+const uint8_t avdt_ccb_st_opening[][AVDT_CCB_NUM_COLS] = {
 /* Event                      Action 1                    Action 2                    Next state */
 /* API_DISCOVER_REQ_EVT */   {AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
 /* API_GETCAP_REQ_EVT */     {AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
@@ -193,7 +193,7 @@
 };
 
 /* state table for open state */
-const UINT8 avdt_ccb_st_open[][AVDT_CCB_NUM_COLS] = {
+const uint8_t avdt_ccb_st_open[][AVDT_CCB_NUM_COLS] = {
 /* Event                      Action 1                    Action 2                    Next state */
 /* API_DISCOVER_REQ_EVT */   {AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
 /* API_GETCAP_REQ_EVT */     {AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
@@ -226,7 +226,7 @@
 };
 
 /* state table for closing state */
-const UINT8 avdt_ccb_st_closing[][AVDT_CCB_NUM_COLS] = {
+const uint8_t avdt_ccb_st_closing[][AVDT_CCB_NUM_COLS] = {
 /* Event                      Action 1                    Action 2                    Next state */
 /* API_DISCOVER_REQ_EVT */   {AVDT_CCB_SET_RECONN,        AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_CLOSING_ST},
 /* API_GETCAP_REQ_EVT */     {AVDT_CCB_SET_RECONN,        AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_CLOSING_ST},
@@ -259,7 +259,7 @@
 };
 
 /* type for state table */
-typedef const UINT8 (*tAVDT_CCB_ST_TBL)[AVDT_CCB_NUM_COLS];
+typedef const uint8_t (*tAVDT_CCB_ST_TBL)[AVDT_CCB_NUM_COLS];
 
 /* state table */
 const tAVDT_CCB_ST_TBL avdt_ccb_st_tbl[] = {
@@ -295,13 +295,13 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avdt_ccb_event(tAVDT_CCB *p_ccb, UINT8 event, tAVDT_CCB_EVT *p_data)
+void avdt_ccb_event(tAVDT_CCB *p_ccb, uint8_t event, tAVDT_CCB_EVT *p_data)
 {
     tAVDT_CCB_ST_TBL    state_table;
-    UINT8               action;
+    uint8_t             action;
     int                 i;
 
-#if AVDT_DEBUG == TRUE
+#if (AVDT_DEBUG == TRUE)
     AVDT_TRACE_EVENT("CCB ccb=%d event=%s state=%s", avdt_ccb_to_idx(p_ccb), avdt_ccb_evt_str[event], avdt_ccb_st_str[p_ccb->state]);
 #endif
 
@@ -382,7 +382,7 @@
     {
         if (!p_ccb->allocated)
         {
-            p_ccb->allocated = TRUE;
+            p_ccb->allocated = true;
             memcpy(p_ccb->peer_addr, bd_addr, BD_ADDR_LEN);
             p_ccb->cmd_q = fixed_queue_new(SIZE_MAX);
             p_ccb->rsp_q = fixed_queue_new(SIZE_MAX);
@@ -436,10 +436,10 @@
 ** Returns          Index of ccb.
 **
 *******************************************************************************/
-UINT8 avdt_ccb_to_idx(tAVDT_CCB *p_ccb)
+uint8_t avdt_ccb_to_idx(tAVDT_CCB *p_ccb)
 {
     /* use array arithmetic to determine index */
-    return (UINT8) (p_ccb - avdt_cb.ccb);
+    return (uint8_t) (p_ccb - avdt_cb.ccb);
 }
 
 /*******************************************************************************
@@ -452,7 +452,7 @@
 ** Returns          pointer to the ccb, or NULL if none found.
 **
 *******************************************************************************/
-tAVDT_CCB *avdt_ccb_by_idx(UINT8 idx)
+tAVDT_CCB *avdt_ccb_by_idx(uint8_t idx)
 {
     tAVDT_CCB   *p_ccb;
 
diff --git a/stack/avdt/avdt_ccb_act.c b/stack/avdt/avdt_ccb_act.c
index 41b74e1..67a3a1b 100644
--- a/stack/avdt/avdt_ccb_act.c
+++ b/stack/avdt/avdt_ccb_act.c
@@ -52,7 +52,7 @@
     BT_HDR          *p_buf;
 
     /* clear certain ccb variables */
-    p_ccb->cong = FALSE;
+    p_ccb->cong = false;
     p_ccb->ret_count = 0;
 
     /* free message being fragmented */
@@ -198,7 +198,7 @@
 void avdt_ccb_hdl_discover_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
     /* we're done with procedure */
-    p_ccb->proc_busy = FALSE;
+    p_ccb->proc_busy = false;
 
     /* call app callback with results */
     (*p_ccb->proc_cback)(0, p_ccb->peer_addr, AVDT_DISCOVER_CFM_EVT,
@@ -245,7 +245,7 @@
 void avdt_ccb_hdl_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
     /* we're done with procedure */
-    p_ccb->proc_busy = FALSE;
+    p_ccb->proc_busy = false;
 
     /* call app callback with results */
     (*p_ccb->proc_cback)(0, p_ccb->peer_addr, AVDT_GETCAP_CFM_EVT,
@@ -267,10 +267,10 @@
 *******************************************************************************/
 void avdt_ccb_hdl_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
-    UINT8   err_code = 0;
+    uint8_t err_code = 0;
 
     /* verify all streams in the right state */
-    UINT8 seid = avdt_scb_verify(p_ccb, AVDT_VERIFY_START, p_data->msg.multi.seid_list,
+    uint8_t seid = avdt_scb_verify(p_ccb, AVDT_VERIFY_START, p_data->msg.multi.seid_list,
                                  p_data->msg.multi.num_seps, &err_code);
     if (seid == 0 && err_code == 0)
     {
@@ -299,9 +299,9 @@
 *******************************************************************************/
 void avdt_ccb_hdl_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
-    UINT8       event;
+    uint8_t     event;
     int         i;
-    UINT8       *p;
+    uint8_t     *p;
     tAVDT_SCB   *p_scb;
 
     /* determine rsp or rej event */
@@ -309,7 +309,7 @@
             AVDT_SCB_MSG_START_RSP_EVT : AVDT_SCB_MSG_START_REJ_EVT;
 
     /* get to where seid's are stashed in current cmd */
-    p = (UINT8 *)(p_ccb->p_curr_cmd + 1);
+    p = (uint8_t *)(p_ccb->p_curr_cmd + 1);
 
     /* little trick here; length of current command equals number of streams */
     for (i = 0; i < p_ccb->p_curr_cmd->len; i++)
@@ -337,8 +337,8 @@
 *******************************************************************************/
 void avdt_ccb_hdl_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
-    UINT8   seid;
-    UINT8   err_code = 0;
+    uint8_t seid;
+    uint8_t err_code = 0;
 
     /* verify all streams in the right state */
     if ((seid = avdt_scb_verify(p_ccb, AVDT_VERIFY_SUSPEND, p_data->msg.multi.seid_list,
@@ -373,9 +373,9 @@
 *******************************************************************************/
 void avdt_ccb_hdl_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
-    UINT8       event;
+    uint8_t     event;
     int         i;
-    UINT8       *p;
+    uint8_t     *p;
     tAVDT_SCB   *p_scb;
 
     /* determine rsp or rej event */
@@ -383,7 +383,7 @@
             AVDT_SCB_MSG_SUSPEND_RSP_EVT : AVDT_SCB_MSG_SUSPEND_REJ_EVT;
 
     /* get to where seid's are stashed in current cmd */
-    p = (UINT8 *)(p_ccb->p_curr_cmd + 1);
+    p = (uint8_t *)(p_ccb->p_curr_cmd + 1);
 
     /* little trick here; length of current command equals number of streams */
     for (i = 0; i < p_ccb->p_curr_cmd->len; i++)
@@ -416,7 +416,7 @@
     p_ccb->proc_param = p_data->discover.num_seps;
 
     /* we're busy */
-    p_ccb->proc_busy = TRUE;
+    p_ccb->proc_busy = true;
 
     /* build and queue discover req */
     avdt_msg_send_cmd(p_ccb, NULL, AVDT_SIG_DISCOVER, NULL);
@@ -455,14 +455,14 @@
 *******************************************************************************/
 void avdt_ccb_snd_getcap_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
-    UINT8 sig_id = AVDT_SIG_GETCAP;
+    uint8_t sig_id = AVDT_SIG_GETCAP;
 
     /* store info in ccb struct */
     p_ccb->p_proc_data = p_data->getcap.p_cfg;
     p_ccb->proc_cback = p_data->getcap.p_cback;
 
     /* we're busy */
-    p_ccb->proc_busy = TRUE;
+    p_ccb->proc_busy = true;
 
     /* build and queue discover req */
     if (p_data->msg.hdr.sig_id == AVDT_SIG_GET_ALLCAP)
@@ -485,7 +485,7 @@
 *******************************************************************************/
 void avdt_ccb_snd_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
-    UINT8 sig_id = AVDT_SIG_GETCAP;
+    uint8_t sig_id = AVDT_SIG_GETCAP;
 
     if (p_data->msg.hdr.sig_id == AVDT_SIG_GET_ALLCAP)
         sig_id = AVDT_SIG_GET_ALLCAP;
@@ -512,7 +512,7 @@
     int             i;
     tAVDT_SCB       *p_scb;
     tAVDT_MSG       avdt_msg;
-    UINT8           seid_list[AVDT_NUM_SEPS];
+    uint8_t         seid_list[AVDT_NUM_SEPS];
 
     /* make copy of our seid list */
     memcpy(seid_list, p_data->msg.multi.seid_list, p_data->msg.multi.num_seps);
@@ -590,7 +590,7 @@
     int             i;
     tAVDT_SCB       *p_scb;
     tAVDT_MSG       avdt_msg;
-    UINT8           seid_list[AVDT_NUM_SEPS];
+    uint8_t         seid_list[AVDT_NUM_SEPS];
 
     /* make copy of our seid list */
     memcpy(seid_list, p_data->msg.multi.seid_list, p_data->msg.multi.num_seps);
@@ -667,7 +667,7 @@
 {
     int             i;
     tAVDT_SCB       *p_scb = &avdt_cb.scb[0];
-    UINT8           err_code = AVDT_ERR_CONNECT;
+    uint8_t         err_code = AVDT_ERR_CONNECT;
     UNUSED(p_data);
 
     /* clear the ccb */
@@ -712,7 +712,7 @@
 void avdt_ccb_cmd_fail(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
     tAVDT_MSG       msg;
-    UINT8           evt;
+    uint8_t         evt;
     tAVDT_SCB       *p_scb;
 
     if (p_ccb->p_curr_cmd != NULL)
@@ -727,12 +727,12 @@
 
         if (evt & AVDT_CCB_MKR)
         {
-            avdt_ccb_event(p_ccb, (UINT8) (evt & ~AVDT_CCB_MKR), (tAVDT_CCB_EVT *) &msg);
+            avdt_ccb_event(p_ccb, (uint8_t) (evt & ~AVDT_CCB_MKR), (tAVDT_CCB_EVT *) &msg);
         }
         else
         {
             /* we get the scb out of the current cmd */
-            p_scb = avdt_scb_by_hdl(*((UINT8 *)(p_ccb->p_curr_cmd + 1)));
+            p_scb = avdt_scb_by_hdl(*((uint8_t *)(p_ccb->p_curr_cmd + 1)));
             if (p_scb != NULL)
             {
                 avdt_scb_event(p_scb, evt, (tAVDT_SCB_EVT *) &msg);
@@ -791,7 +791,7 @@
 *******************************************************************************/
 void avdt_ccb_ret_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
-    UINT8   err_code = AVDT_ERR_TIMEOUT;
+    uint8_t err_code = AVDT_ERR_TIMEOUT;
 
     p_ccb->ret_count++;
     if (p_ccb->ret_count == AVDT_RET_MAX)
@@ -885,7 +885,7 @@
         {
             while ((p_msg = (BT_HDR *)fixed_queue_try_dequeue(p_ccb->rsp_q)) != NULL)
             {
-                if (avdt_msg_send(p_ccb, p_msg) == TRUE)
+                if (avdt_msg_send(p_ccb, p_msg) == true)
                 {
                     /* break out if congested */
                     break;
@@ -904,7 +904,7 @@
 **
 ** Description      This function is called to enable a reconnect attempt when
 **                  a channel transitions from closing to idle state.  It sets
-**                  the reconn variable to TRUE.
+**                  the reconn variable to true.
 **
 **
 ** Returns          void.
@@ -914,7 +914,7 @@
 {
     UNUSED(p_data);
 
-    p_ccb->reconn = TRUE;
+    p_ccb->reconn = true;
 }
 
 /*******************************************************************************
@@ -931,7 +931,7 @@
 {
     UNUSED(p_data);
 
-    p_ccb->reconn = FALSE;
+    p_ccb->reconn = false;
 }
 
 /*******************************************************************************
@@ -948,12 +948,12 @@
 *******************************************************************************/
 void avdt_ccb_chk_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
-    UINT8   err_code = AVDT_ERR_CONNECT;
+    uint8_t err_code = AVDT_ERR_CONNECT;
     UNUSED(p_data);
 
     if (p_ccb->reconn)
     {
-        p_ccb->reconn = FALSE;
+        p_ccb->reconn = false;
 
         /* clear out ccb */
         avdt_ccb_clear_ccb(p_ccb);
@@ -1004,7 +1004,7 @@
     p_ccb->p_conn_cback = p_data->connect.p_cback;
 
     /* set security level */
-    BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_AVDTP, p_data->connect.sec_mask,
+    BTM_SetSecurityLevel(true, "", BTM_SEC_SERVICE_AVDTP, p_data->connect.sec_mask,
                          AVDT_PSM, BTM_SEC_PROTO_AVDT, AVDT_CHAN_SIG);
 }
 
@@ -1101,7 +1101,7 @@
 {
     tAVDT_CTRL          avdt_ctrl;
 
-    p_ccb->ll_opened = TRUE;
+    p_ccb->ll_opened = true;
 
     if (!p_ccb->p_conn_cback)
         p_ccb->p_conn_cback = avdt_cb.p_conn_cback;
diff --git a/stack/avdt/avdt_defs.h b/stack/avdt/avdt_defs.h
index ab2c63f..a71e42a 100644
--- a/stack/avdt/avdt_defs.h
+++ b/stack/avdt/avdt_defs.h
@@ -178,26 +178,26 @@
     (m_pt) = *(p)++ & 0x7F;
 
 #define AVDT_MSG_BLD_HDR(p, lbl, pkt, msg) \
-    *(p)++ = (UINT8) ((lbl) << 4) | ((pkt) << 2) | (msg);
+    *(p)++ = (uint8_t) ((lbl) << 4) | ((pkt) << 2) | (msg);
 
 #define AVDT_MSG_BLD_DISC(p, seid, in_use, type, tsep) \
-    *(p)++ = (UINT8) (((seid) << 2) | ((in_use) << 1)); \
-    *(p)++ = (UINT8) (((type) << 4) | ((tsep) << 3));
+    *(p)++ = (uint8_t) (((seid) << 2) | ((in_use) << 1)); \
+    *(p)++ = (uint8_t) (((type) << 4) | ((tsep) << 3));
 
 #define AVDT_MSG_BLD_SIG(p, sig) \
-    *(p)++ = (UINT8) (sig);
+    *(p)++ = (uint8_t) (sig);
 
 #define AVDT_MSG_BLD_SEID(p, seid) \
-    *(p)++ = (UINT8) ((seid) << 2);
+    *(p)++ = (uint8_t) ((seid) << 2);
 
 #define AVDT_MSG_BLD_ERR(p, err) \
-    *(p)++ = (UINT8) (err);
+    *(p)++ = (uint8_t) (err);
 
 #define AVDT_MSG_BLD_PARAM(p, param) \
-    *(p)++ = (UINT8) (param);
+    *(p)++ = (uint8_t) (param);
 
 #define AVDT_MSG_BLD_NOSP(p, nosp) \
-    *(p)++ = (UINT8) (nosp);
+    *(p)++ = (uint8_t) (nosp);
 
 #endif /* AVDT_DEFS_H */
 
diff --git a/stack/avdt/avdt_int.h b/stack/avdt/avdt_int.h
index 41383dc..f472482 100644
--- a/stack/avdt/avdt_int.h
+++ b/stack/avdt/avdt_int.h
@@ -38,7 +38,7 @@
 #endif
 
 #ifndef AVDT_DEBUG
-#define AVDT_DEBUG  FALSE
+#define AVDT_DEBUG  false
 #endif
 
 /*****************************************************************************
@@ -49,7 +49,7 @@
 enum {
     AVDT_CHAN_SIG,                  /* signaling channel */
     AVDT_CHAN_MEDIA,                /* media channel */
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     AVDT_CHAN_REPORT,               /* reporting channel */
 #endif
     AVDT_CHAN_NUM_TYPES
@@ -57,7 +57,7 @@
 
 /* protocol service capabilities of this AVDTP implementation */
 /* for now multiplexing will be used only for fragmentation */
-#if ((AVDT_MULTIPLEXING == TRUE) && (AVDT_REPORTING == TRUE))
+#if (AVDT_MULTIPLEXING == TRUE && AVDT_REPORTING == TRUE)
 #define AVDT_PSC                (AVDT_PSC_TRANS | AVDT_PSC_MUX | AVDT_PSC_REPORT | AVDT_PSC_DELAY_RPT)
 #define AVDT_LEG_PSC            (AVDT_PSC_TRANS | AVDT_PSC_MUX | AVDT_PSC_REPORT)
 #else /* AVDT_MULTIPLEXING && AVDT_REPORTING  */
@@ -240,11 +240,11 @@
     AVDT_SCB_HDL_SUSPEND_CMD,
     AVDT_SCB_HDL_SUSPEND_RSP,
     AVDT_SCB_HDL_TC_CLOSE,
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     AVDT_SCB_HDL_TC_CLOSE_STO,
 #endif
     AVDT_SCB_HDL_TC_OPEN,
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     AVDT_SCB_HDL_TC_OPEN_STO,
 #endif
     AVDT_SCB_SND_DELAY_RPT_REQ,
@@ -338,7 +338,7 @@
 };
 
 /* adaption layer number of stream routing table entries */
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
 /* 2 channels(1 media, 1 report) for each SEP and one for signalling */
 #define AVDT_NUM_RT_TBL     ((AVDT_NUM_SEPS<<1) + 1)
 #else
@@ -393,7 +393,7 @@
 typedef struct {
     tAVDT_CTRL_CBACK    *p_cback;
     tAVDT_SEP_INFO      *p_sep_info;
-    UINT8               num_seps;
+    uint8_t             num_seps;
 } tAVDT_CCB_API_DISCOVER;
 
 /* data type for AVDT_CCB_API_GETCAP_REQ_EVT */
@@ -406,7 +406,7 @@
 /* data type for AVDT_CCB_API_CONNECT_REQ_EVT */
 typedef struct {
     tAVDT_CTRL_CBACK    *p_cback;
-    UINT8               sec_mask;
+    uint8_t             sec_mask;
 } tAVDT_CCB_API_CONNECT;
 
 /* data type for AVDT_CCB_API_DISCONNECT_REQ_EVT */
@@ -421,8 +421,8 @@
     tAVDT_CCB_API_CONNECT       connect;
     tAVDT_CCB_API_DISCONNECT    disconnect;
     tAVDT_MSG                   msg;
-    BOOLEAN                     llcong;
-    UINT8                       err_code;
+    bool                        llcong;
+    uint8_t                     err_code;
 } tAVDT_CCB_EVT;
 
 /* channel control block type */
@@ -443,15 +443,15 @@
     BT_HDR              *p_curr_cmd;    /* Current command being sent awaiting response */
     BT_HDR              *p_curr_msg;    /* Current message being sent */
     BT_HDR              *p_rx_msg;      /* Current message being received */
-    BOOLEAN             allocated;      /* Whether ccb is allocated */
-    UINT8               state;          /* The CCB state machine state */
-    BOOLEAN             ll_opened;      /* TRUE if LL is opened */
-    BOOLEAN             proc_busy;      /* TRUE when a discover or get capabilities procedure in progress */
-    UINT8               proc_param;     /* Procedure parameter; either SEID for get capabilities or number of SEPS for discover */
-    BOOLEAN             cong;           /* Whether signaling channel is congested */
-    UINT8               label;          /* Message header "label" (sequence number) */
-    BOOLEAN             reconn;         /* If TRUE, reinitiate connection after transitioning from CLOSING to IDLE state */
-    UINT8               ret_count;      /* Command retransmission count */
+    bool                allocated;      /* Whether ccb is allocated */
+    uint8_t             state;          /* The CCB state machine state */
+    bool                ll_opened;      /* true if LL is opened */
+    bool                proc_busy;      /* true when a discover or get capabilities procedure in progress */
+    uint8_t             proc_param;     /* Procedure parameter; either SEID for get capabilities or number of SEPS for discover */
+    bool                cong;           /* Whether signaling channel is congested */
+    uint8_t             label;          /* Message header "label" (sequence number) */
+    bool                reconn;         /* If true, reinitiate connection after transitioning from CLOSING to IDLE state */
+    uint8_t             ret_count;      /* Command retransmission count */
 } tAVDT_CCB;
 
 /* type for action functions */
@@ -460,20 +460,20 @@
 /* type for AVDT_SCB_API_WRITE_REQ_EVT */
 typedef struct {
     BT_HDR      *p_buf;
-    UINT32      time_stamp;
-#if AVDT_MULTIPLEXING == TRUE
-    UINT8       *p_data;
-    UINT32      data_len;
+    uint32_t    time_stamp;
+#if (AVDT_MULTIPLEXING == TRUE)
+    uint8_t     *p_data;
+    uint32_t    data_len;
 #endif
-    UINT8       m_pt;
+    uint8_t     m_pt;
     tAVDT_DATA_OPT_MASK     opt;
 } tAVDT_SCB_APIWRITE;
 
 /* type for AVDT_SCB_TC_CLOSE_EVT */
 typedef struct {
-    UINT8           old_tc_state;       /* channel state before closed */
-    UINT8           tcid;               /* TCID  */
-    UINT8           type;               /* channel type */
+    uint8_t         old_tc_state;       /* channel state before closed */
+    uint8_t         tcid;               /* TCID  */
+    uint8_t         type;               /* channel type */
 } tAVDT_SCB_TC_CLOSE;
 
 /* type for scb event data */
@@ -483,7 +483,7 @@
     tAVDT_DELAY_RPT     apidelay;
     tAVDT_OPEN          open;
     tAVDT_SCB_TC_CLOSE  close;
-    BOOLEAN             llcong;
+    bool                llcong;
     BT_HDR              *p_pkt;
 } tAVDT_SCB_EVT;
 
@@ -495,23 +495,23 @@
     alarm_t         *transport_channel_timer; /* transport channel connect timer */
     BT_HDR          *p_pkt;         /* packet waiting to be sent */
     tAVDT_CCB       *p_ccb;         /* ccb associated with this scb */
-    UINT16          media_seq;      /* media packet sequence number */
-    BOOLEAN         allocated;      /* whether scb is allocated or unused */
-    BOOLEAN         in_use;         /* whether stream being used by peer */
-    UINT8           role;           /* initiator/acceptor role in current procedure */
-    BOOLEAN         remove;         /* whether CB is marked for removal */
-    UINT8           state;          /* state machine state */
-    UINT8           peer_seid;      /* SEID of peer stream */
-    UINT8           curr_evt;       /* current event; set only by state machine */
-    BOOLEAN         cong;           /* Whether media transport channel is congested */
-    UINT8           close_code;     /* Error code received in close response */
-#if AVDT_MULTIPLEXING == TRUE
+    uint16_t        media_seq;      /* media packet sequence number */
+    bool            allocated;      /* whether scb is allocated or unused */
+    bool            in_use;         /* whether stream being used by peer */
+    uint8_t         role;           /* initiator/acceptor role in current procedure */
+    bool            remove;         /* whether CB is marked for removal */
+    uint8_t         state;          /* state machine state */
+    uint8_t         peer_seid;      /* SEID of peer stream */
+    uint8_t         curr_evt;       /* current event; set only by state machine */
+    bool            cong;           /* Whether media transport channel is congested */
+    uint8_t         close_code;     /* Error code received in close response */
+#if (AVDT_MULTIPLEXING == TRUE)
     fixed_queue_t   *frag_q;        /* Queue for outgoing media fragments */
-    UINT32          frag_off;       /* length of already received media fragments */
-    UINT32          frag_org_len;   /* original length before fragmentation of receiving media packet */
-    UINT8           *p_next_frag;   /* next fragment to send */
-    UINT8           *p_media_buf;   /* buffer for media packet assigned by AVDT_SetMediaBuf */
-    UINT32          media_buf_len;  /* length of buffer for media packet assigned by AVDT_SetMediaBuf */
+    uint32_t        frag_off;       /* length of already received media fragments */
+    uint32_t        frag_org_len;   /* original length before fragmentation of receiving media packet */
+    uint8_t         *p_next_frag;   /* next fragment to send */
+    uint8_t         *p_media_buf;   /* buffer for media packet assigned by AVDT_SetMediaBuf */
+    uint32_t        media_buf_len;  /* length of buffer for media packet assigned by AVDT_SetMediaBuf */
 #endif
 } tAVDT_SCB;
 
@@ -520,21 +520,21 @@
 
 /* adaption layer type for transport channel table */
 typedef struct {
-    UINT16  peer_mtu;       /* L2CAP mtu of the peer device */
-    UINT16  my_mtu;         /* Our MTU for this channel */
-    UINT16  my_flush_to;    /* Our flush timeout for this channel */
-    UINT16  lcid;
-    UINT8   tcid;           /* transport channel id */
-    UINT8   ccb_idx;        /* channel control block associated with this tc */
-    UINT8   state;          /* transport channel state */
-    UINT8   cfg_flags;      /* L2CAP configuration flags */
-    UINT8   id;
+    uint16_t peer_mtu;       /* L2CAP mtu of the peer device */
+    uint16_t my_mtu;         /* Our MTU for this channel */
+    uint16_t my_flush_to;    /* Our flush timeout for this channel */
+    uint16_t lcid;
+    uint8_t tcid;           /* transport channel id */
+    uint8_t ccb_idx;        /* channel control block associated with this tc */
+    uint8_t state;          /* transport channel state */
+    uint8_t cfg_flags;      /* L2CAP configuration flags */
+    uint8_t id;
 } tAVDT_TC_TBL;
 
 /* adaption layer type for stream routing table */
 typedef struct {
-    UINT16  lcid;           /* L2CAP LCID of the associated transport channel */
-    UINT8   scb_hdl;        /* stream control block associated with this tc */
+    uint16_t lcid;           /* L2CAP LCID of the associated transport channel */
+    uint8_t scb_hdl;        /* stream control block associated with this tc */
 } tAVDT_RT_TBL;
 
 
@@ -542,7 +542,7 @@
 typedef struct {
     tAVDT_RT_TBL    rt_tbl[AVDT_NUM_LINKS][AVDT_NUM_RT_TBL];
     tAVDT_TC_TBL    tc_tbl[AVDT_NUM_TC_TBL];
-    UINT8           lcid_tbl[MAX_L2CAP_CHANNELS];   /* map LCID to tc_tbl index */
+    uint8_t         lcid_tbl[MAX_L2CAP_CHANNELS];   /* map LCID to tc_tbl index */
 } tAVDT_AD;
 
 /* Control block for AVDT */
@@ -555,7 +555,7 @@
     tAVDT_CCB_ACTION    *p_ccb_act;             /* pointer to CCB action functions */
     tAVDT_SCB_ACTION    *p_scb_act;             /* pointer to SCB action functions */
     tAVDT_CTRL_CBACK    *p_conn_cback;          /* connection callback function */
-    UINT8               trace_level;            /* trace level */
+    uint8_t             trace_level;            /* trace level */
 } tAVDT_CB;
 
 
@@ -565,12 +565,12 @@
 
 /* CCB function declarations */
 extern void avdt_ccb_init(void);
-extern void avdt_ccb_event(tAVDT_CCB *p_ccb, UINT8 event, tAVDT_CCB_EVT *p_data);
+extern void avdt_ccb_event(tAVDT_CCB *p_ccb, uint8_t event, tAVDT_CCB_EVT *p_data);
 extern tAVDT_CCB *avdt_ccb_by_bd(BD_ADDR bd_addr);
 extern tAVDT_CCB *avdt_ccb_alloc(BD_ADDR bd_addr);
 extern void avdt_ccb_dealloc(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
-extern UINT8 avdt_ccb_to_idx(tAVDT_CCB *p_ccb);
-extern tAVDT_CCB *avdt_ccb_by_idx(UINT8 idx);
+extern uint8_t avdt_ccb_to_idx(tAVDT_CCB *p_ccb);
+extern tAVDT_CCB *avdt_ccb_by_idx(uint8_t idx);
 
 /* CCB action functions */
 extern void avdt_ccb_chan_open(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
@@ -610,15 +610,15 @@
 extern void avdt_ccb_ll_opened(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
 
 /* SCB function prototypes */
-extern void avdt_scb_event(tAVDT_SCB *p_scb, UINT8 event, tAVDT_SCB_EVT *p_data);
+extern void avdt_scb_event(tAVDT_SCB *p_scb, uint8_t event, tAVDT_SCB_EVT *p_data);
 extern void avdt_scb_init(void);
 extern tAVDT_SCB *avdt_scb_alloc(tAVDT_CS *p_cs);
 extern void avdt_scb_dealloc(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
-extern UINT8 avdt_scb_to_hdl(tAVDT_SCB *p_scb);
-extern tAVDT_SCB *avdt_scb_by_hdl(UINT8 hdl);
-extern UINT8 avdt_scb_verify(tAVDT_CCB *p_ccb, UINT8 state, UINT8 *p_seid, UINT16 num_seid, UINT8 *p_err_code);
+extern uint8_t avdt_scb_to_hdl(tAVDT_SCB *p_scb);
+extern tAVDT_SCB *avdt_scb_by_hdl(uint8_t hdl);
+extern uint8_t avdt_scb_verify(tAVDT_CCB *p_ccb, uint8_t state, uint8_t *p_seid, uint16_t num_seid, uint8_t *p_err_code);
 extern void avdt_scb_peer_seid_list(tAVDT_MULTI *p_multi);
-extern UINT32 avdt_scb_gen_ssrc(tAVDT_SCB *p_scb);
+extern uint32_t avdt_scb_gen_ssrc(tAVDT_SCB *p_scb);
 
 /* SCB action functions */
 extern void avdt_scb_hdl_abort_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
@@ -680,31 +680,31 @@
 extern void avdt_scb_transport_channel_timer(tAVDT_SCB *p_scb,
                                              tAVDT_SCB_EVT *p_data);
 extern void avdt_scb_clr_vars(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
-extern void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len);
+extern void avdt_scb_queue_frags(tAVDT_SCB *p_scb, uint8_t **pp_data, uint32_t *p_data_len);
 
 /* msg function declarations */
-extern BOOLEAN avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg);
-extern void avdt_msg_send_cmd(tAVDT_CCB *p_ccb, void *p_scb, UINT8 sig_id, tAVDT_MSG *p_params);
-extern void avdt_msg_send_rsp(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params);
-extern void avdt_msg_send_rej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params);
-extern void avdt_msg_send_grej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params);
+extern bool    avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg);
+extern void avdt_msg_send_cmd(tAVDT_CCB *p_ccb, void *p_scb, uint8_t sig_id, tAVDT_MSG *p_params);
+extern void avdt_msg_send_rsp(tAVDT_CCB *p_ccb, uint8_t sig_id, tAVDT_MSG *p_params);
+extern void avdt_msg_send_rej(tAVDT_CCB *p_ccb, uint8_t sig_id, tAVDT_MSG *p_params);
+extern void avdt_msg_send_grej(tAVDT_CCB *p_ccb, uint8_t sig_id, tAVDT_MSG *p_params);
 extern void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf);
 
 /* adaption layer function declarations */
 extern void avdt_ad_init(void);
-extern UINT8 avdt_ad_type_to_tcid(UINT8 type, tAVDT_SCB *p_scb);
-extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_st(UINT8 type, tAVDT_CCB *p_ccb, UINT8 state);
-extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_lcid(UINT16 lcid);
+extern uint8_t avdt_ad_type_to_tcid(uint8_t type, tAVDT_SCB *p_scb);
+extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_st(uint8_t type, tAVDT_CCB *p_ccb, uint8_t state);
+extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_lcid(uint16_t lcid);
 extern tAVDT_TC_TBL *avdt_ad_tc_tbl_alloc(tAVDT_CCB *p_ccb);
-extern UINT8 avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL *p_tbl);
-extern void avdt_ad_tc_close_ind(tAVDT_TC_TBL *p_tbl, UINT16 reason);
+extern uint8_t avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL *p_tbl);
+extern void avdt_ad_tc_close_ind(tAVDT_TC_TBL *p_tbl, uint16_t reason);
 extern void avdt_ad_tc_open_ind(tAVDT_TC_TBL *p_tbl);
-extern void avdt_ad_tc_cong_ind(tAVDT_TC_TBL *p_tbl, BOOLEAN is_congested);
+extern void avdt_ad_tc_cong_ind(tAVDT_TC_TBL *p_tbl, bool    is_congested);
 extern void avdt_ad_tc_data_ind(tAVDT_TC_TBL *p_tbl, BT_HDR *p_buf);
-extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_type(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb);
-extern UINT8 avdt_ad_write_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, BT_HDR *p_buf);
-extern void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role);
-extern void avdt_ad_close_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb);
+extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_type(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb);
+extern uint8_t avdt_ad_write_req(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, BT_HDR *p_buf);
+extern void avdt_ad_open_req(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, uint8_t role);
+extern void avdt_ad_close_req(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb);
 
 extern void avdt_ccb_idle_ccb_timer_timeout(void *data);
 extern void avdt_ccb_ret_ccb_timer_timeout(void *data);
@@ -721,9 +721,9 @@
 #define AVDT_BLD_LAYERSPEC(ls, msg, label) \
             ls = (((label) << 4) | (msg))
 
-#define AVDT_LAYERSPEC_LABEL(ls)    ((UINT8)((ls) >> 4))
+#define AVDT_LAYERSPEC_LABEL(ls)    ((uint8_t)((ls) >> 4))
 
-#define AVDT_LAYERSPEC_MSG(ls)      ((UINT8)((ls) & 0x000F))
+#define AVDT_LAYERSPEC_MSG(ls)      ((uint8_t)((ls) & 0x000F))
 
 /*****************************************************************************
 ** global data
@@ -732,7 +732,7 @@
 /******************************************************************************
 ** Main Control Block
 *******************************************************************************/
-#if AVDT_DYNAMIC_MEMORY == FALSE
+#if (AVDT_DYNAMIC_MEMORY == FALSE)
 extern tAVDT_CB  avdt_cb;
 #else
 extern tAVDT_CB *avdt_cb_ptr;
@@ -744,7 +744,7 @@
 extern const tL2CAP_APPL_INFO avdt_l2c_appl;
 
 /* reject message event lookup table */
-extern const UINT8 avdt_msg_rej_2_evt[];
+extern const uint8_t avdt_msg_rej_2_evt[];
 #ifdef __cplusplus
 }
 #endif
diff --git a/stack/avdt/avdt_l2c.c b/stack/avdt/avdt_l2c.c
index 72dbaa0..e5a4c4a 100644
--- a/stack/avdt/avdt_l2c.c
+++ b/stack/avdt/avdt_l2c.c
@@ -36,14 +36,14 @@
 
 
 /* callback function declarations */
-void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id);
-void avdt_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result);
-void avdt_l2c_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg);
-void avdt_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg);
-void avdt_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed);
-void avdt_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result);
-void avdt_l2c_congestion_ind_cback(UINT16 lcid, BOOLEAN is_congested);
-void avdt_l2c_data_ind_cback(UINT16 lcid, BT_HDR *p_buf);
+void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, uint16_t lcid, uint16_t psm, uint8_t id);
+void avdt_l2c_connect_cfm_cback(uint16_t lcid, uint16_t result);
+void avdt_l2c_config_cfm_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg);
+void avdt_l2c_config_ind_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg);
+void avdt_l2c_disconnect_ind_cback(uint16_t lcid, bool ack_needed);
+void avdt_l2c_disconnect_cfm_cback(uint16_t lcid, uint16_t result);
+void avdt_l2c_congestion_ind_cback(uint16_t lcid, bool is_congested);
+void avdt_l2c_data_ind_cback(uint16_t lcid, BT_HDR *p_buf);
 
 /* L2CAP callback function structure */
 const tL2CAP_APPL_INFO avdt_l2c_appl = {
@@ -71,7 +71,7 @@
 **
 *******************************************************************************/
 static void avdt_sec_check_complete_term (BD_ADDR bd_addr, tBT_TRANSPORT transport,
-                                                 void *p_ref_data, UINT8 res)
+                                                 void *p_ref_data, uint8_t res)
 {
     tAVDT_CCB       *p_ccb = NULL;
     tL2CAP_CFG_INFO cfg;
@@ -105,9 +105,9 @@
 
         /* Send L2CAP config req */
         memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO));
-        cfg.mtu_present = TRUE;
+        cfg.mtu_present = true;
         cfg.mtu = p_tbl->my_mtu;
-        cfg.flush_to_present = TRUE;
+        cfg.flush_to_present = true;
         cfg.flush_to = p_tbl->my_flush_to;
         L2CA_ConfigReq(p_tbl->lcid, &cfg);
     }
@@ -129,7 +129,7 @@
 **
 *******************************************************************************/
 static void avdt_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT trasnport,
-                                                void *p_ref_data, UINT8 res)
+                                                void *p_ref_data, uint8_t res)
 {
     tAVDT_CCB       *p_ccb = NULL;
     tL2CAP_CFG_INFO cfg;
@@ -150,9 +150,9 @@
 
         /* Send L2CAP config req */
         memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO));
-        cfg.mtu_present = TRUE;
+        cfg.mtu_present = true;
         cfg.mtu = p_tbl->my_mtu;
-        cfg.flush_to_present = TRUE;
+        cfg.flush_to_present = true;
         cfg.flush_to = p_tbl->my_flush_to;
         L2CA_ConfigReq(p_tbl->lcid, &cfg);
     }
@@ -172,11 +172,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
+void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, uint16_t lcid, uint16_t psm, uint8_t id)
 {
     tAVDT_CCB       *p_ccb;
     tAVDT_TC_TBL    *p_tbl = NULL;
-    UINT16          result;
+    uint16_t        result;
     tL2CAP_CFG_INFO cfg;
     tBTM_STATUS rc;
     UNUSED(psm);
@@ -204,7 +204,7 @@
 
             /* Check the security */
             rc = btm_sec_mx_access_request (bd_addr, AVDT_PSM,
-                FALSE, BTM_SEC_PROTO_AVDT,
+                false, BTM_SEC_PROTO_AVDT,
                 AVDT_CHAN_SIG,
                 &avdt_sec_check_complete_term, NULL);
             if(rc == BTM_CMD_STARTED)
@@ -228,7 +228,7 @@
         /* yes; proceed with connection */
         result = L2CAP_CONN_OK;
     }
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     /* this must be a reporting channel; are we accepting a reporting channel
     ** for this ccb?
     */
@@ -259,9 +259,9 @@
 
         /* Send L2CAP config req */
         memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO));
-        cfg.mtu_present = TRUE;
+        cfg.mtu_present = true;
         cfg.mtu = p_tbl->my_mtu;
-        cfg.flush_to_present = TRUE;
+        cfg.flush_to_present = true;
         cfg.flush_to = p_tbl->my_flush_to;
         L2CA_ConfigReq(lcid, &cfg);
     }
@@ -277,7 +277,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avdt_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
+void avdt_l2c_connect_cfm_cback(uint16_t lcid, uint16_t result)
 {
     tAVDT_TC_TBL    *p_tbl;
     tL2CAP_CFG_INFO cfg;
@@ -301,9 +301,9 @@
 
                     /* Send L2CAP config req */
                     memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO));
-                    cfg.mtu_present = TRUE;
+                    cfg.mtu_present = true;
                     cfg.mtu = p_tbl->my_mtu;
-                    cfg.flush_to_present = TRUE;
+                    cfg.flush_to_present = true;
                     cfg.flush_to = p_tbl->my_flush_to;
                     L2CA_ConfigReq(lcid, &cfg);
                 }
@@ -323,7 +323,7 @@
 
                         /* Check the security */
                         btm_sec_mx_access_request (p_ccb->peer_addr, AVDT_PSM,
-                            TRUE, BTM_SEC_PROTO_AVDT,
+                            true, BTM_SEC_PROTO_AVDT,
                             AVDT_CHAN_SIG,
                             &avdt_sec_check_complete_orig, NULL);
                     }
@@ -349,7 +349,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avdt_l2c_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
+void avdt_l2c_config_cfm_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg)
 {
     tAVDT_TC_TBL    *p_tbl;
 
@@ -393,7 +393,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avdt_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
+void avdt_l2c_config_ind_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg)
 {
     tAVDT_TC_TBL    *p_tbl;
 
@@ -441,7 +441,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avdt_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed)
+void avdt_l2c_disconnect_ind_cback(uint16_t lcid, bool ack_needed)
 {
     tAVDT_TC_TBL    *p_tbl;
 
@@ -470,7 +470,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avdt_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result)
+void avdt_l2c_disconnect_cfm_cback(uint16_t lcid, uint16_t result)
 {
     tAVDT_TC_TBL    *p_tbl;
 
@@ -493,7 +493,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avdt_l2c_congestion_ind_cback(UINT16 lcid, BOOLEAN is_congested)
+void avdt_l2c_congestion_ind_cback(uint16_t lcid, bool is_congested)
 {
     tAVDT_TC_TBL    *p_tbl;
 
@@ -514,7 +514,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void avdt_l2c_data_ind_cback(UINT16 lcid, BT_HDR *p_buf)
+void avdt_l2c_data_ind_cback(uint16_t lcid, BT_HDR *p_buf)
 {
     tAVDT_TC_TBL    *p_tbl;
 
diff --git a/stack/avdt/avdt_msg.c b/stack/avdt/avdt_msg.c
index 636ef4b..ddbeb55 100644
--- a/stack/avdt/avdt_msg.c
+++ b/stack/avdt/avdt_msg.c
@@ -54,46 +54,46 @@
 *****************************************************************************/
 
 /* type for message building functions */
-typedef void (*tAVDT_MSG_BLD)(UINT8 **p, tAVDT_MSG *p_msg);
+typedef void (*tAVDT_MSG_BLD)(uint8_t **p, tAVDT_MSG *p_msg);
 
 /* type for message parsing functions */
-typedef UINT8 (*tAVDT_MSG_PRS)(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
+typedef uint8_t (*tAVDT_MSG_PRS)(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
 
 
 /*****************************************************************************
 ** local function declarations
 *****************************************************************************/
 
-static void avdt_msg_bld_none(UINT8 **p, tAVDT_MSG *p_msg);
-static void avdt_msg_bld_single(UINT8 **p, tAVDT_MSG *p_msg);
-static void avdt_msg_bld_setconfig_cmd(UINT8 **p, tAVDT_MSG *p_msg);
-static void avdt_msg_bld_reconfig_cmd(UINT8 **p, tAVDT_MSG *p_msg);
-static void avdt_msg_bld_multi(UINT8 **p, tAVDT_MSG *p_msg);
-static void avdt_msg_bld_security_cmd(UINT8 **p, tAVDT_MSG *p_msg);
-static void avdt_msg_bld_discover_rsp(UINT8 **p, tAVDT_MSG *p_msg);
-static void avdt_msg_bld_svccap(UINT8 **p, tAVDT_MSG *p_msg);
-static void avdt_msg_bld_security_rsp(UINT8 **p, tAVDT_MSG *p_msg);
-static void avdt_msg_bld_all_svccap(UINT8 **p, tAVDT_MSG *p_msg);
-static void avdt_msg_bld_delay_rpt(UINT8 **p, tAVDT_MSG *p_msg);
+static void avdt_msg_bld_none(uint8_t **p, tAVDT_MSG *p_msg);
+static void avdt_msg_bld_single(uint8_t **p, tAVDT_MSG *p_msg);
+static void avdt_msg_bld_setconfig_cmd(uint8_t **p, tAVDT_MSG *p_msg);
+static void avdt_msg_bld_reconfig_cmd(uint8_t **p, tAVDT_MSG *p_msg);
+static void avdt_msg_bld_multi(uint8_t **p, tAVDT_MSG *p_msg);
+static void avdt_msg_bld_security_cmd(uint8_t **p, tAVDT_MSG *p_msg);
+static void avdt_msg_bld_discover_rsp(uint8_t **p, tAVDT_MSG *p_msg);
+static void avdt_msg_bld_svccap(uint8_t **p, tAVDT_MSG *p_msg);
+static void avdt_msg_bld_security_rsp(uint8_t **p, tAVDT_MSG *p_msg);
+static void avdt_msg_bld_all_svccap(uint8_t **p, tAVDT_MSG *p_msg);
+static void avdt_msg_bld_delay_rpt(uint8_t **p, tAVDT_MSG *p_msg);
 
-static UINT8 avdt_msg_prs_none(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
-static UINT8 avdt_msg_prs_single(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
-static UINT8 avdt_msg_prs_setconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
-static UINT8 avdt_msg_prs_reconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
-static UINT8 avdt_msg_prs_multi(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
-static UINT8 avdt_msg_prs_security_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
-static UINT8 avdt_msg_prs_discover_rsp(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
-static UINT8 avdt_msg_prs_svccap(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
-static UINT8 avdt_msg_prs_all_svccap(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
-static UINT8 avdt_msg_prs_security_rsp(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
-static UINT8 avdt_msg_prs_delay_rpt (tAVDT_MSG *p_msg, UINT8 *p, UINT16 len);
+static uint8_t avdt_msg_prs_none(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
+static uint8_t avdt_msg_prs_single(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
+static uint8_t avdt_msg_prs_setconfig_cmd(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
+static uint8_t avdt_msg_prs_reconfig_cmd(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
+static uint8_t avdt_msg_prs_multi(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
+static uint8_t avdt_msg_prs_security_cmd(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
+static uint8_t avdt_msg_prs_discover_rsp(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
+static uint8_t avdt_msg_prs_svccap(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
+static uint8_t avdt_msg_prs_all_svccap(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
+static uint8_t avdt_msg_prs_security_rsp(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
+static uint8_t avdt_msg_prs_delay_rpt (tAVDT_MSG *p_msg, uint8_t *p, uint16_t len);
 
 /*****************************************************************************
 ** constants
 *****************************************************************************/
 
 /* table of information element minimum lengths used for parsing */
-const UINT8 avdt_msg_ie_len_min[] = {
+const uint8_t avdt_msg_ie_len_min[] = {
     0,                              /* unused */
     AVDT_LEN_TRANS_MIN,             /* media transport */
     AVDT_LEN_REPORT_MIN,            /* reporting */
@@ -106,7 +106,7 @@
 };
 
 /* table of information element minimum lengths used for parsing */
-const UINT8 avdt_msg_ie_len_max[] = {
+const uint8_t avdt_msg_ie_len_max[] = {
     0,                              /* unused */
     AVDT_LEN_TRANS_MAX,             /* media transport */
     AVDT_LEN_REPORT_MAX,            /* reporting */
@@ -119,7 +119,7 @@
 };
 
 /* table of error codes used when decoding information elements */
-const UINT8 avdt_msg_ie_err[] = {
+const uint8_t avdt_msg_ie_err[] = {
     0,                              /* unused */
     AVDT_ERR_MEDIA_TRANS,           /* media transport */
     AVDT_ERR_LENGTH,                /* reporting */
@@ -132,7 +132,7 @@
 };
 
 /* table of packet type minimum lengths */
-static const UINT8 avdt_msg_pkt_type_len[] = {
+static const uint8_t avdt_msg_pkt_type_len[] = {
     AVDT_LEN_TYPE_SINGLE,
     AVDT_LEN_TYPE_START,
     AVDT_LEN_TYPE_CONT,
@@ -208,7 +208,7 @@
 };
 
 /* command message-to-event lookup table */
-const UINT8 avdt_msg_cmd_2_evt[] = {
+const uint8_t avdt_msg_cmd_2_evt[] = {
     AVDT_CCB_MSG_DISCOVER_CMD_EVT + AVDT_CCB_MKR,   /* discover */
     AVDT_CCB_MSG_GETCAP_CMD_EVT + AVDT_CCB_MKR,     /* get capabilities */
     AVDT_SCB_MSG_SETCONFIG_CMD_EVT,                 /* set configuration */
@@ -225,7 +225,7 @@
 };
 
 /* response message-to-event lookup table */
-const UINT8 avdt_msg_rsp_2_evt[] = {
+const uint8_t avdt_msg_rsp_2_evt[] = {
     AVDT_CCB_MSG_DISCOVER_RSP_EVT + AVDT_CCB_MKR,   /* discover */
     AVDT_CCB_MSG_GETCAP_RSP_EVT + AVDT_CCB_MKR,     /* get capabilities */
     AVDT_SCB_MSG_SETCONFIG_RSP_EVT,                 /* set configuration */
@@ -242,7 +242,7 @@
 };
 
 /* reject message-to-event lookup table */
-const UINT8 avdt_msg_rej_2_evt[] = {
+const uint8_t avdt_msg_rej_2_evt[] = {
     AVDT_CCB_MSG_DISCOVER_RSP_EVT + AVDT_CCB_MKR,   /* discover */
     AVDT_CCB_MSG_GETCAP_RSP_EVT + AVDT_CCB_MKR,     /* get capabilities */
     AVDT_SCB_MSG_SETCONFIG_REJ_EVT,                 /* set configuration */
@@ -269,9 +269,9 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_cfg(UINT8 **p, tAVDT_CFG *p_cfg)
+static void avdt_msg_bld_cfg(uint8_t **p, tAVDT_CFG *p_cfg)
 {
-    UINT8 len;
+    uint8_t len;
 
     /* for now, just build media transport, codec, and content protection, and multiplexing */
 
@@ -282,7 +282,7 @@
         *(*p)++ = 0; /* length */
     }
 
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     /* reporting transport */
     if (p_cfg->psc_mask & AVDT_PSC_REPORT)
     {
@@ -315,7 +315,7 @@
         *p += len;
     }
 
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
     /* multiplexing */
     if (p_cfg->psc_mask & AVDT_PSC_MUX)
     {
@@ -374,7 +374,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_none(UINT8 **p, tAVDT_MSG *p_msg)
+static void avdt_msg_bld_none(uint8_t **p, tAVDT_MSG *p_msg)
 {
     UNUSED(p);
     UNUSED(p_msg);
@@ -392,7 +392,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_single(UINT8 **p, tAVDT_MSG *p_msg)
+static void avdt_msg_bld_single(uint8_t **p, tAVDT_MSG *p_msg)
 {
     AVDT_MSG_BLD_SEID(*p, p_msg->single.seid);
 }
@@ -408,7 +408,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_setconfig_cmd(UINT8 **p, tAVDT_MSG *p_msg)
+static void avdt_msg_bld_setconfig_cmd(uint8_t **p, tAVDT_MSG *p_msg)
 {
     AVDT_MSG_BLD_SEID(*p, p_msg->config_cmd.hdr.seid);
     AVDT_MSG_BLD_SEID(*p, p_msg->config_cmd.int_seid);
@@ -426,7 +426,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_reconfig_cmd(UINT8 **p, tAVDT_MSG *p_msg)
+static void avdt_msg_bld_reconfig_cmd(uint8_t **p, tAVDT_MSG *p_msg)
 {
     AVDT_MSG_BLD_SEID(*p, p_msg->reconfig_cmd.hdr.seid);
 
@@ -446,7 +446,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_multi(UINT8 **p, tAVDT_MSG *p_msg)
+static void avdt_msg_bld_multi(uint8_t **p, tAVDT_MSG *p_msg)
 {
     int i;
 
@@ -466,7 +466,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_security_cmd(UINT8 **p, tAVDT_MSG *p_msg)
+static void avdt_msg_bld_security_cmd(uint8_t **p, tAVDT_MSG *p_msg)
 {
     AVDT_MSG_BLD_SEID(*p, p_msg->security_cmd.hdr.seid);
     memcpy(*p, p_msg->security_cmd.p_data, p_msg->security_cmd.len);
@@ -483,7 +483,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_delay_rpt(UINT8 **p, tAVDT_MSG *p_msg)
+static void avdt_msg_bld_delay_rpt(uint8_t **p, tAVDT_MSG *p_msg)
 {
     AVDT_MSG_BLD_SEID(*p, p_msg->delay_rpt_cmd.hdr.seid);
     UINT16_TO_BE_STREAM(*p, p_msg->delay_rpt_cmd.delay);
@@ -500,7 +500,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_discover_rsp(UINT8 **p, tAVDT_MSG *p_msg)
+static void avdt_msg_bld_discover_rsp(uint8_t **p, tAVDT_MSG *p_msg)
 {
     int     i;
 
@@ -525,7 +525,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_svccap(UINT8 **p, tAVDT_MSG *p_msg)
+static void avdt_msg_bld_svccap(uint8_t **p, tAVDT_MSG *p_msg)
 {
     tAVDT_CFG cfg;
 
@@ -546,7 +546,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_all_svccap(UINT8 **p, tAVDT_MSG *p_msg)
+static void avdt_msg_bld_all_svccap(uint8_t **p, tAVDT_MSG *p_msg)
 {
     avdt_msg_bld_cfg(p, p_msg->svccap.p_cfg);
 }
@@ -562,7 +562,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void avdt_msg_bld_security_rsp(UINT8 **p, tAVDT_MSG *p_msg)
+static void avdt_msg_bld_security_rsp(uint8_t **p, tAVDT_MSG *p_msg)
 {
     memcpy(*p, p_msg->security_rsp.p_data, p_msg->security_rsp.len);
     *p += p_msg->security_rsp.len;
@@ -580,14 +580,14 @@
 **                  in p_elem.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_cfg(tAVDT_CFG *p_cfg, UINT8 *p, UINT16 len, UINT8* p_elem, UINT8 sig_id)
+static uint8_t avdt_msg_prs_cfg(tAVDT_CFG *p_cfg, uint8_t *p, uint16_t len, uint8_t* p_elem, uint8_t sig_id)
 {
-    UINT8   *p_end;
-    UINT8   elem = 0;
-    UINT8   elem_len;
-    UINT8   tmp;
-    UINT8   err = 0;
-    UINT8   protect_offset = 0;
+    uint8_t *p_end;
+    uint8_t elem = 0;
+    uint8_t elem_len;
+    uint8_t tmp;
+    uint8_t err = 0;
+    uint8_t protect_offset = 0;
 
     if (!p_cfg)
     {
@@ -598,7 +598,7 @@
     p_cfg->psc_mask = 0;
     p_cfg->num_codec = 0;
     p_cfg->num_protect = 0;
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
     p_cfg->mux_mask = 0;
 #endif
 
@@ -688,7 +688,7 @@
                 p_cfg->hdrcmp_mask = *p++;
                 break;
 
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
             case AVDT_CAT_MUX:
                 /* verify length */
                 AVDT_TRACE_WARNING("psc_mask=0x%x elem_len=%d", p_cfg->psc_mask, elem_len);
@@ -705,7 +705,7 @@
                 }
 
                 /* parse fragmentation */
-                p_cfg->mux_mask = *p++ & (UINT8)AVDT_MUX_FRAG;
+                p_cfg->mux_mask = *p++ & (uint8_t)AVDT_MUX_FRAG;
 
                 /* parse TSIDs and TCIDs */
                 if(--elem_len)
@@ -778,7 +778,7 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_none(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
+static uint8_t avdt_msg_prs_none(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len)
 {
     UNUSED(p_msg);
     UNUSED(p);
@@ -797,9 +797,9 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_single(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
+static uint8_t avdt_msg_prs_single(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len)
 {
-    UINT8       err = 0;
+    uint8_t     err = 0;
 
     /* verify len */
     if (len != AVDT_LEN_SINGLE)
@@ -829,9 +829,9 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_setconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
+static uint8_t avdt_msg_prs_setconfig_cmd(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len)
 {
-    UINT8       err = 0;
+    uint8_t     err = 0;
 
     p_msg->hdr.err_param = 0;
 
@@ -888,9 +888,9 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_reconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
+static uint8_t avdt_msg_prs_reconfig_cmd(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len)
 {
-    UINT8       err = 0;
+    uint8_t     err = 0;
 
     p_msg->hdr.err_param = 0;
 
@@ -939,10 +939,10 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_multi(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
+static uint8_t avdt_msg_prs_multi(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len)
 {
     int     i;
-    UINT8   err = 0;
+    uint8_t err = 0;
 
     p_msg->hdr.err_param = 0;
 
@@ -964,7 +964,7 @@
                 break;
             }
         }
-        p_msg->multi.num_seps = (UINT8)i;
+        p_msg->multi.num_seps = (uint8_t)i;
     }
 
     return err;
@@ -981,9 +981,9 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_security_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
+static uint8_t avdt_msg_prs_security_cmd(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len)
 {
-    UINT8       err = 0;
+    uint8_t     err = 0;
 
     /* verify len */
     if (len < AVDT_LEN_SECURITY_MIN)
@@ -1018,10 +1018,10 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_discover_rsp(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
+static uint8_t avdt_msg_prs_discover_rsp(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len)
 {
     int     i;
-    UINT8   err = 0;
+    uint8_t err = 0;
 
     /* determine number of seps; seps in msg is len/2, but set to minimum
     ** of seps app has supplied memory for and seps in msg
@@ -1063,10 +1063,10 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_svccap(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
+static uint8_t avdt_msg_prs_svccap(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len)
 {
     /* parse parameters */
-    UINT8   err = avdt_msg_prs_cfg(p_msg->svccap.p_cfg, p, len, &p_msg->hdr.err_param, AVDT_SIG_GETCAP);
+    uint8_t err = avdt_msg_prs_cfg(p_msg->svccap.p_cfg, p, len, &p_msg->hdr.err_param, AVDT_SIG_GETCAP);
     if (p_msg->svccap.p_cfg)
     {
         p_msg->svccap.p_cfg->psc_mask &= AVDT_LEG_PSC;
@@ -1086,9 +1086,9 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_all_svccap(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
+static uint8_t avdt_msg_prs_all_svccap(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len)
 {
-    UINT8   err = avdt_msg_prs_cfg(p_msg->svccap.p_cfg, p, len, &p_msg->hdr.err_param, AVDT_SIG_GET_ALLCAP);
+    uint8_t err = avdt_msg_prs_cfg(p_msg->svccap.p_cfg, p, len, &p_msg->hdr.err_param, AVDT_SIG_GET_ALLCAP);
     if (p_msg->svccap.p_cfg)
     {
         p_msg->svccap.p_cfg->psc_mask &= AVDT_MSG_PSC_MASK;
@@ -1107,7 +1107,7 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_security_rsp(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
+static uint8_t avdt_msg_prs_security_rsp(tAVDT_MSG *p_msg, uint8_t *p, uint16_t len)
 {
     p_msg->security_rsp.p_data = p;
     p_msg->security_rsp.len = len;
@@ -1125,7 +1125,7 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_rej(tAVDT_MSG *p_msg, UINT8 *p, UINT8 sig)
+static uint8_t avdt_msg_prs_rej(tAVDT_MSG *p_msg, uint8_t *p, uint8_t sig)
 {
     if ((sig == AVDT_SIG_SETCONFIG) || (sig == AVDT_SIG_RECONFIG))
     {
@@ -1156,9 +1156,9 @@
 ** Returns          Error code or zero if no error.
 **
 *******************************************************************************/
-static UINT8 avdt_msg_prs_delay_rpt (tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
+static uint8_t avdt_msg_prs_delay_rpt (tAVDT_MSG *p_msg, uint8_t *p, uint16_t len)
 {
-    UINT8       err = 0;
+    uint8_t     err = 0;
 
     /* verify len */
     if (len != AVDT_LEN_DELAY_RPT)
@@ -1192,21 +1192,21 @@
 ** Description      Send, and if necessary fragment the next message.
 **
 **
-** Returns          Congested state; TRUE if CCB congested, FALSE if not.
+** Returns          Congested state; true if CCB congested, false if not.
 **
 *******************************************************************************/
-BOOLEAN avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg)
+bool    avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg)
 {
-    UINT16          curr_msg_len;
-    UINT8           pkt_type;
-    UINT8           hdr_len;
+    uint16_t        curr_msg_len;
+    uint8_t         pkt_type;
+    uint8_t         hdr_len;
     tAVDT_TC_TBL    *p_tbl;
     BT_HDR          *p_buf;
-    UINT8           *p;
-    UINT8           label;
-    UINT8           msg;
-    UINT8           sig;
-    UINT8           nosp = 0;       /* number of subsequent packets */
+    uint8_t         *p;
+    uint8_t         label;
+    uint8_t         msg;
+    uint8_t         sig;
+    uint8_t         nosp = 0;       /* number of subsequent packets */
 
     /* look up transport channel table entry to get peer mtu */
     p_tbl = avdt_ad_tc_tbl_by_type(AVDT_CHAN_SIG, p_ccb, NULL);
@@ -1250,8 +1250,8 @@
             /* copy portion of data from current message to new buffer */
             p_buf->offset = L2CAP_MIN_OFFSET + hdr_len;
             p_buf->len = p_tbl->peer_mtu - hdr_len;
-            memcpy((UINT8 *)(p_buf + 1) + p_buf->offset,
-                   (UINT8 *)(p_ccb->p_curr_msg + 1) + p_ccb->p_curr_msg->offset, p_buf->len);
+            memcpy((uint8_t *)(p_buf + 1) + p_buf->offset,
+                   (uint8_t *)(p_ccb->p_curr_msg + 1) + p_ccb->p_curr_msg->offset, p_buf->len);
         }
         /* if message is being fragmented and remaining bytes don't fit in mtu */
         else if ((p_ccb->p_curr_msg->offset > AVDT_MSG_OFFSET) &&
@@ -1266,8 +1266,8 @@
             /* copy portion of data from current message to new buffer */
             p_buf->offset = L2CAP_MIN_OFFSET + hdr_len;
             p_buf->len = p_tbl->peer_mtu - hdr_len;
-            memcpy((UINT8 *)(p_buf + 1) + p_buf->offset,
-                   (UINT8 *)(p_ccb->p_curr_msg + 1) + p_ccb->p_curr_msg->offset, p_buf->len);
+            memcpy((uint8_t *)(p_buf + 1) + p_buf->offset,
+                   (uint8_t *)(p_ccb->p_curr_msg + 1) + p_ccb->p_curr_msg->offset, p_buf->len);
         }
         /* if message is being fragmented and remaining bytes do fit in mtu */
         else
@@ -1280,7 +1280,7 @@
         /* label, sig id, msg type are in hdr of p_curr_msg */
         label = AVDT_LAYERSPEC_LABEL(p_ccb->p_curr_msg->layer_specific);
         msg = AVDT_LAYERSPEC_MSG(p_ccb->p_curr_msg->layer_specific);
-        sig = (UINT8) p_ccb->p_curr_msg->event;
+        sig = (uint8_t) p_ccb->p_curr_msg->event;
         AVDT_TRACE_DEBUG("avdt_msg_send label:%d, msg:%d, sig:%d", label, msg, sig);
 
         /* keep track of how much of msg we've sent */
@@ -1325,7 +1325,7 @@
         /* set up to build header */
         p_buf->len += hdr_len;
         p_buf->offset -= hdr_len;
-        p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+        p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
         /* build header */
         AVDT_MSG_BLD_HDR(p, label, pkt_type, msg);
@@ -1357,12 +1357,12 @@
 *******************************************************************************/
 BT_HDR *avdt_msg_asmbl(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
 {
-    UINT8   *p;
-    UINT8   pkt_type;
+    uint8_t *p;
+    uint8_t pkt_type;
     BT_HDR  *p_ret;
 
     /* parse the message header */
-    p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p = (uint8_t *)(p_buf + 1) + p_buf->offset;
     AVDT_MSG_PRS_PKT_TYPE(p, pkt_type);
 
     /* quick sanity check on length */
@@ -1405,7 +1405,7 @@
         osi_free(p_buf);
 
         /* update p to point to new buffer */
-        p = (UINT8 *)(p_ccb->p_rx_msg + 1) + p_ccb->p_rx_msg->offset;
+        p = (uint8_t *)(p_ccb->p_rx_msg + 1) + p_ccb->p_rx_msg->offset;
 
         /* copy first header byte over nosp */
         *(p + 1) = *p;
@@ -1435,7 +1435,7 @@
              * NOTE: The buffer is allocated above at the beginning of the
              * reassembly, and is always of size BT_DEFAULT_BUFFER_SIZE.
              */
-            UINT16 buf_len = BT_DEFAULT_BUFFER_SIZE - sizeof(BT_HDR);
+            uint16_t buf_len = BT_DEFAULT_BUFFER_SIZE - sizeof(BT_HDR);
 
             /* adjust offset and len of fragment for header byte */
             p_buf->offset += AVDT_LEN_TYPE_CONT;
@@ -1450,8 +1450,8 @@
                 p_ret = NULL;
             } else {
                 /* copy contents of p_buf to p_rx_msg */
-                memcpy((UINT8 *)(p_ccb->p_rx_msg + 1) + p_ccb->p_rx_msg->offset,
-                       (UINT8 *)(p_buf + 1) + p_buf->offset, p_buf->len);
+                memcpy((uint8_t *)(p_ccb->p_rx_msg + 1) + p_ccb->p_rx_msg->offset,
+                       (uint8_t *)(p_buf + 1) + p_buf->offset, p_buf->len);
 
                 if (pkt_type == AVDT_PKT_TYPE_END)
                 {
@@ -1488,31 +1488,31 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avdt_msg_send_cmd(tAVDT_CCB *p_ccb, void *p_scb, UINT8 sig_id, tAVDT_MSG *p_params)
+void avdt_msg_send_cmd(tAVDT_CCB *p_ccb, void *p_scb, uint8_t sig_id, tAVDT_MSG *p_params)
 {
-    UINT8 *p;
-    UINT8 *p_start;
+    uint8_t *p;
+    uint8_t *p_start;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(AVDT_CMD_BUF_SIZE);
 
     /* set up buf pointer and offset */
     p_buf->offset = AVDT_MSG_OFFSET;
-    p_start = p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_start = p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     /* execute parameter building function to build message */
     (*avdt_msg_bld_cmd[sig_id - 1])(&p, p_params);
 
     /* set len */
-    p_buf->len = (UINT16) (p - p_start);
+    p_buf->len = (uint16_t) (p - p_start);
 
     /* now store scb hdls, if any, in buf */
     if (p_scb != NULL)
     {
-        p = (UINT8 *)(p_buf + 1);
+        p = (uint8_t *)(p_buf + 1);
 
         /* for start and suspend, p_scb points to array of handles */
         if ((sig_id == AVDT_SIG_START) || (sig_id == AVDT_SIG_SUSPEND))
         {
-            memcpy(p, (UINT8 *) p_scb, p_buf->len);
+            memcpy(p, (uint8_t *) p_scb, p_buf->len);
         }
         /* for all others, p_scb points to scb as usual */
         else
@@ -1549,21 +1549,21 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avdt_msg_send_rsp(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params)
+void avdt_msg_send_rsp(tAVDT_CCB *p_ccb, uint8_t sig_id, tAVDT_MSG *p_params)
 {
-    UINT8 *p;
-    UINT8 *p_start;
+    uint8_t *p;
+    uint8_t *p_start;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(AVDT_CMD_BUF_SIZE);
 
     /* set up buf pointer and offset */
     p_buf->offset = AVDT_MSG_OFFSET;
-    p_start = p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_start = p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     /* execute parameter building function to build message */
     (*avdt_msg_bld_rsp[sig_id - 1])(&p, p_params);
 
     /* set length */
-    p_buf->len = (UINT16) (p - p_start);
+    p_buf->len = (uint16_t) (p - p_start);
 
     /* stash sig, label, and message type in buf */
     p_buf->event = sig_id;
@@ -1590,15 +1590,15 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avdt_msg_send_rej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params)
+void avdt_msg_send_rej(tAVDT_CCB *p_ccb, uint8_t sig_id, tAVDT_MSG *p_params)
 {
-    UINT8 *p;
-    UINT8 *p_start;
+    uint8_t *p;
+    uint8_t *p_start;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(AVDT_CMD_BUF_SIZE);
 
     /* set up buf pointer and offset */
     p_buf->offset = AVDT_MSG_OFFSET;
-    p_start = p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_start = p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     /* if sig id included, build into message */
     if (sig_id != AVDT_SIG_NONE)
@@ -1621,7 +1621,7 @@
     AVDT_TRACE_DEBUG("avdt_msg_send_rej");
 
     /* calculate length */
-    p_buf->len = (UINT16) (p - p_start);
+    p_buf->len = (uint16_t) (p - p_start);
 
     /* stash sig, label, and message type in buf */
     p_buf->event = sig_id;
@@ -1647,18 +1647,18 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avdt_msg_send_grej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params)
+void avdt_msg_send_grej(tAVDT_CCB *p_ccb, uint8_t sig_id, tAVDT_MSG *p_params)
 {
-    UINT8 *p;
-    UINT8 *p_start;
+    uint8_t *p;
+    uint8_t *p_start;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(AVDT_CMD_BUF_SIZE);
 
     /* set up buf pointer and offset */
     p_buf->offset = AVDT_MSG_OFFSET;
-    p_start = p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_start = p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     /* calculate length */
-    p_buf->len = (UINT16) (p - p_start);
+    p_buf->len = (uint16_t) (p - p_start);
 
     /* stash sig, label, and message type in buf */
     p_buf->event = 0;
@@ -1686,19 +1686,19 @@
 void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
 {
     tAVDT_SCB   *p_scb;
-    UINT8       *p;
-    BOOLEAN     ok = TRUE;
-    BOOLEAN     handle_rsp = FALSE;
-    BOOLEAN     gen_rej = FALSE;
-    UINT8       label;
-    UINT8       pkt_type;
-    UINT8       msg_type;
-    UINT8       sig = 0;
+    uint8_t     *p;
+    bool        ok = true;
+    bool        handle_rsp = false;
+    bool        gen_rej = false;
+    uint8_t     label;
+    uint8_t     pkt_type;
+    uint8_t     msg_type;
+    uint8_t     sig = 0;
     tAVDT_MSG   msg;
     tAVDT_CFG   cfg;
-    UINT8       err;
-    UINT8       evt = 0;
-    UINT8       scb_hdl;
+    uint8_t     err;
+    uint8_t     evt = 0;
+    uint8_t     scb_hdl;
 
     /* reassemble message; if no message available (we received a fragment) return */
     if ((p_buf = avdt_msg_asmbl(p_ccb, p_buf)) == NULL)
@@ -1706,7 +1706,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     /* parse the message header */
     AVDT_MSG_PRS_HDR(p, label, pkt_type, msg_type);
@@ -1722,15 +1722,15 @@
     if (msg_type == AVDT_MSG_TYPE_GRJ)
     {
         AVDT_TRACE_WARNING("Dropping msg msg_type=%d", msg_type);
-        ok = FALSE;
+        ok = false;
     }
     /* check for general reject */
     else if ((msg_type == AVDT_MSG_TYPE_REJ) && (p_buf->len == AVDT_LEN_GEN_REJ))
     {
-        gen_rej = TRUE;
+        gen_rej = true;
         if (p_ccb->p_curr_cmd != NULL)
         {
-            msg.hdr.sig_id = sig = (UINT8) p_ccb->p_curr_cmd->event;
+            msg.hdr.sig_id = sig = (uint8_t) p_ccb->p_curr_cmd->event;
             evt = avdt_msg_rej_2_evt[sig - 1];
             msg.hdr.err_code = AVDT_ERR_NSC;
             msg.hdr.err_param = 0;
@@ -1744,7 +1744,7 @@
         if ((sig == 0) || (sig > AVDT_SIG_MAX))
         {
             AVDT_TRACE_WARNING("Dropping msg sig=%d msg_type:%d", sig, msg_type);
-            ok = FALSE;
+            ok = false;
 
             /* send a general reject */
             if (msg_type == AVDT_MSG_TYPE_CMD)
@@ -1813,7 +1813,7 @@
             /* if its a rsp or rej, drop it; if its a cmd, send a rej;
             ** note special case for abort; never send abort reject
             */
-            ok = FALSE;
+            ok = false;
             if ((msg_type == AVDT_MSG_TYPE_CMD) && (sig != AVDT_SIG_ABORT))
             {
                 avdt_msg_send_rej(p_ccb, sig, &msg);
@@ -1842,11 +1842,11 @@
                 p_ccb->ret_count = 0;
 
                 /* later in this function handle ccb event */
-                handle_rsp = TRUE;
+                handle_rsp = true;
             }
             else
             {
-                ok = FALSE;
+                ok = false;
                 AVDT_TRACE_WARNING("Cmd not found for rsp sig=%d label=%d", sig, label);
             }
         }
@@ -1857,7 +1857,7 @@
         /* if it's a ccb event send to ccb */
         if (evt & AVDT_CCB_MKR)
         {
-            avdt_ccb_event(p_ccb, (UINT8)(evt & ~AVDT_CCB_MKR), (tAVDT_CCB_EVT *) &msg);
+            avdt_ccb_event(p_ccb, (uint8_t)(evt & ~AVDT_CCB_MKR), (tAVDT_CCB_EVT *) &msg);
         }
         /* if it's a scb event */
         else
@@ -1871,7 +1871,7 @@
             }
             else
             {
-                scb_hdl = *((UINT8 *)(p_ccb->p_curr_cmd + 1));
+                scb_hdl = *((uint8_t *)(p_ccb->p_curr_cmd + 1));
             }
 
             /* Map seid to the scb and send it the event.  For cmd, seid has
diff --git a/stack/avdt/avdt_scb.c b/stack/avdt/avdt_scb.c
index e4e7340..48700e7 100644
--- a/stack/avdt/avdt_scb.c
+++ b/stack/avdt/avdt_scb.c
@@ -36,7 +36,7 @@
 /*****************************************************************************
 ** state machine constants and types
 *****************************************************************************/
-#if AVDT_DEBUG == TRUE
+#if (AVDT_DEBUG == TRUE)
 
 /* verbose state strings for trace */
 const char * const avdt_scb_st_str[] = {
@@ -128,11 +128,11 @@
     avdt_scb_hdl_suspend_cmd,
     avdt_scb_hdl_suspend_rsp,
     avdt_scb_hdl_tc_close,
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     avdt_scb_hdl_tc_close_sto,
 #endif
     avdt_scb_hdl_tc_open,
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     avdt_scb_hdl_tc_open_sto,
 #endif
     avdt_scb_snd_delay_rpt_req,
@@ -176,7 +176,7 @@
 #define AVDT_SCB_NUM_COLS           3       /* number of columns in state tables */
 
 /* state table for idle state */
-const UINT8 avdt_scb_st_idle[][AVDT_SCB_NUM_COLS] = {
+const uint8_t avdt_scb_st_idle[][AVDT_SCB_NUM_COLS] = {
 /* Event                     Action 1                       Action 2                    Next state */
 /* API_REMOVE_EVT */        {AVDT_SCB_DEALLOC,              AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
 /* API_WRITE_REQ_EVT */     {AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
@@ -229,7 +229,7 @@
 };
 
 /* state table for configured state */
-const UINT8 avdt_scb_st_conf[][AVDT_SCB_NUM_COLS] = {
+const uint8_t avdt_scb_st_conf[][AVDT_SCB_NUM_COLS] = {
 /* Event                     Action 1                       Action 2                    Next state */
 /* API_REMOVE_EVT */        {AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_SET_REMOVE,        AVDT_SCB_CONF_ST},
 /* API_WRITE_REQ_EVT */     {AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
@@ -282,7 +282,7 @@
 };
 
 /* state table for opening state */
-const UINT8 avdt_scb_st_opening[][AVDT_SCB_NUM_COLS] = {
+const uint8_t avdt_scb_st_opening[][AVDT_SCB_NUM_COLS] = {
 /* Event                     Action 1                       Action 2                    Next state */
 /* API_REMOVE_EVT */        {AVDT_SCB_SND_CLOSE_REQ,        AVDT_SCB_SET_REMOVE,        AVDT_SCB_CLOSING_ST},
 /* API_WRITE_REQ_EVT */     {AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
@@ -335,7 +335,7 @@
 };
 
 /* state table for open state */
-const UINT8 avdt_scb_st_open[][AVDT_SCB_NUM_COLS] = {
+const uint8_t avdt_scb_st_open[][AVDT_SCB_NUM_COLS] = {
 /* Event                     Action 1                       Action 2                    Next state */
 /* API_REMOVE_EVT */        {AVDT_SCB_SND_CLOSE_REQ,        AVDT_SCB_SET_REMOVE,        AVDT_SCB_CLOSING_ST},
 /* API_WRITE_REQ_EVT */     {AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
@@ -380,7 +380,7 @@
 /* MSG_START_REJ_EVT */     {AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
 /* MSG_SUSPEND_REJ_EVT */   {AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
 /* TC_TOUT_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
 /* TC_OPEN_EVT */           {AVDT_SCB_HDL_TC_OPEN_STO,      AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
 /* TC_CLOSE_EVT */          {AVDT_SCB_HDL_TC_CLOSE_STO,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
 #else
@@ -393,7 +393,7 @@
 };
 
 /* state table for streaming state */
-const UINT8 avdt_scb_st_stream[][AVDT_SCB_NUM_COLS] = {
+const uint8_t avdt_scb_st_stream[][AVDT_SCB_NUM_COLS] = {
 /* Event                     Action 1                       Action 2                    Next state */
 /* API_REMOVE_EVT */        {AVDT_SCB_SND_STREAM_CLOSE,     AVDT_SCB_SET_REMOVE,        AVDT_SCB_CLOSING_ST},
 /* API_WRITE_REQ_EVT */     {AVDT_SCB_HDL_WRITE_REQ,        AVDT_SCB_CHK_SND_PKT,       AVDT_SCB_STREAM_ST},
@@ -446,7 +446,7 @@
 };
 
 /* state table for closing state */
-const UINT8 avdt_scb_st_closing[][AVDT_SCB_NUM_COLS] = {
+const uint8_t avdt_scb_st_closing[][AVDT_SCB_NUM_COLS] = {
 /* Event                     Action 1                       Action 2                    Next state */
 /* API_REMOVE_EVT */        {AVDT_SCB_SET_REMOVE,           AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
 /* API_WRITE_REQ_EVT */     {AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
@@ -499,7 +499,7 @@
 };
 
 /* type for state table */
-typedef const UINT8 (*tAVDT_SCB_ST_TBL)[AVDT_SCB_NUM_COLS];
+typedef const uint8_t (*tAVDT_SCB_ST_TBL)[AVDT_SCB_NUM_COLS];
 
 /* state table */
 const tAVDT_SCB_ST_TBL avdt_scb_st_tbl[] = {
@@ -522,13 +522,13 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avdt_scb_event(tAVDT_SCB *p_scb, UINT8 event, tAVDT_SCB_EVT *p_data)
+void avdt_scb_event(tAVDT_SCB *p_scb, uint8_t event, tAVDT_SCB_EVT *p_data)
 {
     tAVDT_SCB_ST_TBL    state_table;
-    UINT8               action;
+    uint8_t             action;
     int                 i;
 
-#if AVDT_DEBUG == TRUE
+#if (AVDT_DEBUG == TRUE)
     AVDT_TRACE_EVENT("SCB hdl=%d event=%d/%s state=%s", avdt_scb_to_hdl(p_scb), event, avdt_scb_evt_str[event], avdt_scb_st_str[p_scb->state]);
 #endif
     /* set current event */
@@ -595,18 +595,18 @@
         if (!p_scb->allocated)
         {
             memset(p_scb,0,sizeof(tAVDT_SCB));
-            p_scb->allocated = TRUE;
+            p_scb->allocated = true;
             p_scb->p_ccb = NULL;
 
             memcpy(&p_scb->cs, p_cs, sizeof(tAVDT_CS));
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
             /* initialize fragments gueue */
             p_scb->frag_q = fixed_queue_new(SIZE_MAX);
 
             if(p_cs->cfg.psc_mask & AVDT_PSC_MUX)
             {
                 p_scb->cs.cfg.mux_tcid_media = avdt_ad_type_to_tcid(AVDT_CHAN_MEDIA, p_scb);
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
                 if(p_cs->cfg.psc_mask & AVDT_PSC_REPORT)
                 {
                     p_scb->cs.cfg.mux_tcid_report = avdt_ad_type_to_tcid(AVDT_CHAN_REPORT, p_scb);
@@ -648,7 +648,7 @@
     AVDT_TRACE_DEBUG("avdt_scb_dealloc hdl=%d", avdt_scb_to_hdl(p_scb));
     alarm_free(p_scb->transport_channel_timer);
 
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
     /* free fragments we're holding, if any; it shouldn't happen */
     fixed_queue_free(p_scb->frag_q, osi_free);
 #endif
@@ -666,9 +666,9 @@
 ** Returns          Index of scb.
 **
 *******************************************************************************/
-UINT8 avdt_scb_to_hdl(tAVDT_SCB *p_scb)
+uint8_t avdt_scb_to_hdl(tAVDT_SCB *p_scb)
 {
-    return (UINT8) (p_scb - avdt_cb.scb + 1);
+    return (uint8_t) (p_scb - avdt_cb.scb + 1);
 }
 
 /*******************************************************************************
@@ -682,7 +682,7 @@
 **                  is not allocated.
 **
 *******************************************************************************/
-tAVDT_SCB *avdt_scb_by_hdl(UINT8 hdl)
+tAVDT_SCB *avdt_scb_by_hdl(uint8_t hdl)
 {
     tAVDT_SCB   *p_scb;
 
@@ -716,12 +716,12 @@
 ** Returns          SEID that failed, or 0 if success.
 **
 *******************************************************************************/
-UINT8 avdt_scb_verify(tAVDT_CCB *p_ccb, UINT8 state, UINT8 *p_seid, UINT16 num_seid, UINT8 *p_err_code)
+uint8_t avdt_scb_verify(tAVDT_CCB *p_ccb, uint8_t state, uint8_t *p_seid, uint16_t num_seid, uint8_t *p_err_code)
 {
     int         i;
     tAVDT_SCB   *p_scb;
-    UINT8       nsc_mask;
-    UINT8       ret = 0;
+    uint8_t     nsc_mask;
+    uint8_t     ret = 0;
 
     AVDT_TRACE_DEBUG("avdt_scb_verify state %d", state);
     /* set nonsupported command mask */
diff --git a/stack/avdt/avdt_scb_act.c b/stack/avdt/avdt_scb_act.c
index ed0b675..ffb5435 100644
--- a/stack/avdt/avdt_scb_act.c
+++ b/stack/avdt/avdt_scb_act.c
@@ -41,7 +41,7 @@
 ** events are at the beginning of the event list starting at zero, thus
 ** allowing for this table.
 */
-const UINT8 avdt_scb_cback_evt[] = {
+const uint8_t avdt_scb_cback_evt[] = {
     0,                          /* API_REMOVE_EVT (no event) */
     AVDT_WRITE_CFM_EVT,         /* API_WRITE_REQ_EVT */
     0,                          /* API_GETCONFIG_REQ_EVT (no event) */
@@ -57,7 +57,7 @@
 /* This table is used to look up the callback event based on the signaling
 ** role when the stream is closed.
 */
-const UINT8 avdt_scb_role_evt[] = {
+const uint8_t avdt_scb_role_evt[] = {
     AVDT_CLOSE_IND_EVT,         /* AVDT_CLOSE_ACP */
     AVDT_CLOSE_CFM_EVT,         /* AVDT_CLOSE_INT */
     AVDT_CLOSE_IND_EVT,         /* AVDT_OPEN_ACP */
@@ -73,10 +73,10 @@
 ** Returns          SSRC value.
 **
 *******************************************************************************/
-UINT32 avdt_scb_gen_ssrc(tAVDT_SCB *p_scb)
+uint32_t avdt_scb_gen_ssrc(tAVDT_SCB *p_scb)
 {
     /* combine the value of the media type and codec type of the SCB */
-    return ((UINT32)(p_scb->cs.cfg.codec_info[1] | p_scb->cs.cfg.codec_info[2]));
+    return ((uint32_t)(p_scb->cs.cfg.codec_info[1] | p_scb->cs.cfg.codec_info[2]));
 }
 
 /*******************************************************************************
@@ -247,17 +247,17 @@
 *******************************************************************************/
 void avdt_scb_hdl_pkt_no_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
 {
-    UINT8   *p, *p_start;
-    UINT8   o_v, o_p, o_x, o_cc;
-    UINT8   m_pt;
-    UINT8   marker;
-    UINT16  seq;
-    UINT32  time_stamp;
-    UINT16  offset;
-    UINT16  ex_len;
-    UINT8   pad_len = 0;
+    uint8_t *p, *p_start;
+    uint8_t o_v, o_p, o_x, o_cc;
+    uint8_t m_pt;
+    uint8_t marker;
+    uint16_t seq;
+    uint32_t time_stamp;
+    uint16_t offset;
+    uint16_t ex_len;
+    uint8_t pad_len = 0;
 
-    p = p_start = (UINT8 *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
+    p = p_start = (uint8_t *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
 
     /* parse media packet header */
     AVDT_MSG_PRS_OCTET1(p, o_v, o_p, o_x, o_cc);
@@ -280,7 +280,7 @@
     }
 
     /* save our new offset */
-    offset = (UINT16) (p - p_start);
+    offset = (uint16_t) (p - p_start);
 
     /* adjust length for any padding at end of packet */
     if (o_p)
@@ -306,17 +306,17 @@
             /* report sequence number */
             p_data->p_pkt->layer_specific = seq;
             (*p_scb->cs.p_data_cback)(avdt_scb_to_hdl(p_scb), p_data->p_pkt,
-                time_stamp, (UINT8)(m_pt | (marker<<7)));
+                time_stamp, (uint8_t)(m_pt | (marker<<7)));
         }
         else
         {
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
             if ((p_scb->cs.p_media_cback != NULL)
              && (p_scb->p_media_buf != NULL)
              && (p_scb->media_buf_len > p_data->p_pkt->len))
             {
                 /* media buffer enough length is assigned by application. Lets use it*/
-                memcpy(p_scb->p_media_buf,(UINT8*)(p_data->p_pkt + 1) + p_data->p_pkt->offset,
+                memcpy(p_scb->p_media_buf,(uint8_t*)(p_data->p_pkt + 1) + p_data->p_pkt->offset,
                     p_data->p_pkt->len);
                 (*p_scb->cs.p_media_cback)(avdt_scb_to_hdl(p_scb),p_scb->p_media_buf,
                     p_scb->media_buf_len,time_stamp,seq,m_pt,marker);
@@ -327,7 +327,7 @@
     }
 }
 
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
 /*******************************************************************************
 **
 ** Function         avdt_scb_hdl_report
@@ -337,12 +337,12 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-UINT8 * avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
+uint8_t * avdt_scb_hdl_report(tAVDT_SCB *p_scb, uint8_t *p, uint16_t len)
 {
-    UINT16  result = AVDT_SUCCESS;
-    UINT8   *p_start = p;
-    UINT32  ssrc;
-    UINT8   o_v, o_p, o_cc;
+    uint16_t result = AVDT_SUCCESS;
+    uint8_t *p_start = p;
+    uint32_t ssrc;
+    uint8_t o_v, o_p, o_cc;
     AVDT_REPORT_TYPE    pt;
     tAVDT_REPORT_DATA   report, *p_rpt;
 
@@ -406,7 +406,7 @@
 }
 #endif
 
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
 /*******************************************************************************
 **
 ** Function         avdt_scb_hdl_pkt_frag
@@ -419,25 +419,25 @@
 void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
 {
     /* Fields of Adaptation Layer Header */
-    UINT8   al_tsid,al_frag,al_lcode;
-    UINT16  al_len;
+    uint8_t al_tsid,al_frag,al_lcode;
+    uint16_t al_len;
     /* media header fields */
-    UINT8   o_v, o_p, o_x, o_cc;
-    UINT8   m_pt;
-    UINT8   marker;
-    UINT16  seq;
-    UINT32  time_stamp;
-    UINT32  ssrc;
-    UINT16  ex_len;
-    UINT8   pad_len;
+    uint8_t o_v, o_p, o_x, o_cc;
+    uint8_t m_pt;
+    uint8_t marker;
+    uint16_t seq;
+    uint32_t time_stamp;
+    uint32_t ssrc;
+    uint16_t ex_len;
+    uint8_t pad_len;
     /* other variables */
-    UINT8   *p; /* current pointer */
-    UINT8   *p_end; /* end of all packet */
-    UINT8   *p_payload; /* pointer to media fragment payload in the buffer */
-    UINT32  payload_len; /* payload length */
-    UINT16  frag_len; /* fragment length */
+    uint8_t *p; /* current pointer */
+    uint8_t *p_end; /* end of all packet */
+    uint8_t *p_payload; /* pointer to media fragment payload in the buffer */
+    uint32_t payload_len; /* payload length */
+    uint16_t frag_len; /* fragment length */
 
-    p = (UINT8 *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
+    p = (uint8_t *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
     p_end = p + p_data->p_pkt->len;
     /* parse all fragments */
     while(p < p_end)
@@ -462,7 +462,7 @@
         switch(al_lcode)
         {
         case AVDT_ALH_LCODE_NONE:  /* No length field present. Take length from l2cap */
-            al_len = (UINT16)(p_end - p);
+            al_len = (uint16_t)(p_end - p);
             break;
         case AVDT_ALH_LCODE_16BIT:  /* 16 bit length field */
             BE_STREAM_TO_UINT16(al_len, p);
@@ -471,11 +471,11 @@
             al_len = *p++;
             break;
         default:    /* 9 bit length field, MSB = 1, 8 LSBs in 1 octet following */
-            al_len =(UINT16)*p++ + 0x100;
+            al_len =(uint16_t)*p++ + 0x100;
         }
 
         /* max fragment length */
-        frag_len = (UINT16)(p_end - p);
+        frag_len = (uint16_t)(p_end - p);
         /* if it isn't last fragment */
         if(frag_len >= al_len)
             frag_len = al_len;
@@ -483,7 +483,7 @@
         /* check TSID corresponds to config */
         if (al_tsid != p_scb->curr_cfg.mux_tsid_media)
         {
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
             if((p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT) &&
                 (al_tsid == p_scb->curr_cfg.mux_tsid_report))
             {
@@ -618,7 +618,7 @@
             else
                 pad_len =  0;
             /* payload length */
-            payload_len = (UINT32)(p_scb->p_media_buf + p_scb->frag_off - pad_len - p_payload);
+            payload_len = (uint32_t)(p_scb->p_media_buf + p_scb->frag_off - pad_len - p_payload);
 
             AVDT_TRACE_DEBUG("Received last fragment header=%d len=%d",
                 p_payload - p_scb->p_media_buf,payload_len);
@@ -651,11 +651,11 @@
 *******************************************************************************/
 void avdt_scb_hdl_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
 {
-#if AVDT_REPORTING == TRUE
-    UINT8 *p;
+#if (AVDT_REPORTING == TRUE)
+    uint8_t *p;
 #endif
 
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
     /* select right function in dependance of is fragmentation supported or not */
     if( 0 != (p_scb->curr_cfg.psc_mask & AVDT_PSC_MUX))
     {
@@ -663,10 +663,10 @@
     }
     else
 #endif
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     if(p_data->p_pkt->layer_specific == AVDT_CHAN_REPORT)
     {
-        p = (UINT8 *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
+        p = (uint8_t *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
         avdt_scb_hdl_report(p_scb, p, p_data->p_pkt->len);
         osi_free_and_reset((void **)&p_data->p_pkt);
     }
@@ -831,7 +831,7 @@
         if(p_scb->cs.cfg.codec_info[AVDT_CODEC_TYPE_INDEX] == p_cfg->codec_info[AVDT_CODEC_TYPE_INDEX])
         {
             /* set sep as in use */
-            p_scb->in_use = TRUE;
+            p_scb->in_use = true;
 
             /* copy info to scb */
             p_scb->p_ccb = avdt_ccb_by_idx(p_data->msg.config_cmd.hdr.ccb_idx);
@@ -1001,10 +1001,10 @@
 *******************************************************************************/
 void avdt_scb_hdl_tc_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
 {
-    UINT8               hdl = avdt_scb_to_hdl(p_scb);
+    uint8_t             hdl = avdt_scb_to_hdl(p_scb);
     tAVDT_CTRL_CBACK    *p_ctrl_cback = p_scb->cs.p_ctrl_cback;
     tAVDT_CTRL          avdt_ctrl;
-    UINT8               event;
+    uint8_t             event;
     tAVDT_CCB           *p_ccb = p_scb->p_ccb;
     BD_ADDR remote_addr;
 
@@ -1017,7 +1017,7 @@
     /* clear sep variables */
     avdt_scb_clr_vars(p_scb, p_data);
     p_scb->media_seq = 0;
-    p_scb->cong = FALSE;
+    p_scb->cong = false;
 
     /* free pkt we're holding, if any */
     osi_free_and_reset((void **)&p_scb->p_pkt);
@@ -1097,7 +1097,7 @@
                               (tAVDT_CTRL *) &p_data->msg.hdr);
 }
 
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
 /*******************************************************************************
 **
 ** Function         avdt_scb_hdl_tc_close_sto
@@ -1149,9 +1149,9 @@
 *******************************************************************************/
 void avdt_scb_hdl_tc_open(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
 {
-    UINT8   event;
-#if AVDT_REPORTING == TRUE
-    UINT8   role;
+    uint8_t event;
+#if (AVDT_REPORTING == TRUE)
+    uint8_t role;
 #endif
 
     alarm_cancel(p_scb->transport_channel_timer);
@@ -1161,7 +1161,7 @@
 
     AVDT_TRACE_DEBUG("psc_mask: cfg: 0x%x, req:0x%x, cur: 0x%x",
         p_scb->cs.cfg.psc_mask, p_scb->req_cfg.psc_mask, p_scb->curr_cfg.psc_mask);
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     if(p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT)
     {
         /* open the reporting channel, if both devices support it */
@@ -1177,7 +1177,7 @@
                               (tAVDT_CTRL *) &p_data->open);
 }
 
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
 /*******************************************************************************
 **
 ** Function         avdt_scb_hdl_tc_open_sto
@@ -1220,8 +1220,8 @@
 *******************************************************************************/
 void avdt_scb_hdl_write_req_no_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
 {
-    UINT8   *p;
-    UINT32  ssrc;
+    uint8_t *p;
+    uint32_t ssrc;
 
     /* free packet we're holding, if any; to be replaced with new */
     if (p_scb->p_pkt != NULL) {
@@ -1239,7 +1239,7 @@
         p_data->apiwrite.p_buf->len += AVDT_MEDIA_HDR_SIZE;
         p_data->apiwrite.p_buf->offset -= AVDT_MEDIA_HDR_SIZE;
         p_scb->media_seq++;
-        p = (UINT8 *)(p_data->apiwrite.p_buf + 1) + p_data->apiwrite.p_buf->offset;
+        p = (uint8_t *)(p_data->apiwrite.p_buf + 1) + p_data->apiwrite.p_buf->offset;
 
         UINT8_TO_BE_STREAM(p, AVDT_MEDIA_OCTET1);
         UINT8_TO_BE_STREAM(p, p_data->apiwrite.m_pt);
@@ -1252,7 +1252,7 @@
     p_scb->p_pkt = p_data->apiwrite.p_buf;
 }
 
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
 /*******************************************************************************
 **
 ** Function         avdt_scb_hdl_write_req_frag
@@ -1265,8 +1265,8 @@
 *******************************************************************************/
 void avdt_scb_hdl_write_req_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
 {
-    UINT8   *p;
-    UINT32  ssrc;
+    uint8_t *p;
+    uint32_t ssrc;
 
     /* free fragments we're holding, if any; it shouldn't happen */
     if (!fixed_queue_is_empty(p_scb->frag_q))
@@ -1295,7 +1295,7 @@
             /* posit on Adaptation Layer header */
             p_frag->len += AVDT_AL_HDR_SIZE + AVDT_MEDIA_HDR_SIZE;
             p_frag->offset -= AVDT_AL_HDR_SIZE + AVDT_MEDIA_HDR_SIZE;
-            p = (UINT8 *)(p_frag + 1) + p_frag->offset;
+            p = (uint8_t *)(p_frag + 1) + p_frag->offset;
 
             /* Adaptation Layer header */
             /* TSID, no-fragment bit and coding of length (in 2 length octets
@@ -1320,7 +1320,7 @@
             /* posit on Adaptation Layer header */
             p_frag->len += AVDT_AL_HDR_SIZE;
             p_frag->offset -= AVDT_AL_HDR_SIZE;
-            p = (UINT8 *)(p_frag + 1) + p_frag->offset;
+            p = (uint8_t *)(p_frag + 1) + p_frag->offset;
             /* Adaptation Layer header */
             /* TSID, fragment bit and coding of length (in 2 length octets
              * following)
@@ -1348,11 +1348,11 @@
 *******************************************************************************/
 void avdt_scb_hdl_write_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
 {
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
     if (fixed_queue_is_empty(p_scb->frag_q))
 #endif
         avdt_scb_hdl_write_req_no_frag(p_scb, p_data);
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
     else
         avdt_scb_hdl_write_req_frag(p_scb, p_data);
 #endif
@@ -1431,7 +1431,7 @@
 *******************************************************************************/
 void avdt_scb_snd_stream_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
 {
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
     AVDT_TRACE_WARNING("%s c:%d, off:%d", __func__,
         fixed_queue_length(p_scb->frag_q), p_scb->frag_off);
 
@@ -1666,12 +1666,12 @@
     tAVDT_CFG *p_req, *p_cfg;
 
     /* copy API parameters to scb, set scb as in use */
-    p_scb->in_use = TRUE;
+    p_scb->in_use = true;
     p_scb->p_ccb = avdt_ccb_by_idx(p_data->msg.config_cmd.hdr.ccb_idx);
     p_scb->peer_seid = p_data->msg.config_cmd.hdr.seid;
     p_req = p_data->msg.config_cmd.p_cfg;
     p_cfg = &p_scb->cs.cfg;
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
     p_req->mux_tsid_media = p_cfg->mux_tsid_media;
     p_req->mux_tcid_media = p_cfg->mux_tcid_media;
     if(p_req->psc_mask & AVDT_PSC_REPORT)
@@ -1723,7 +1723,7 @@
 {
     UNUSED(p_data);
 
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     if(p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT)
         avdt_ad_close_req(AVDT_CHAN_REPORT, p_scb->p_ccb, p_scb);
 #endif
@@ -1844,7 +1844,7 @@
 {
     UNUSED(p_data);
 
-    p_scb->remove = TRUE;
+    p_scb->remove = true;
 }
 
 /*******************************************************************************
@@ -1867,7 +1867,7 @@
     /* p_buf can be NULL in case using of fragments queue frag_q */
     osi_free_and_reset((void **)&p_data->apiwrite.p_buf);
 
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
     /* clean fragments queue */
     BT_HDR          *p_frag;
     while ((p_frag = (BT_HDR*)fixed_queue_try_dequeue(p_scb->frag_q)) != NULL)
@@ -1894,8 +1894,8 @@
 {
     tAVDT_CTRL      avdt_ctrl;
     tAVDT_CCB       *p_ccb;
-    UINT8           tcid;
-    UINT16          lcid;
+    uint8_t         tcid;
+    uint16_t        lcid;
     UNUSED(p_data);
 
     /* set error code and parameter */
@@ -1921,7 +1921,7 @@
         (*p_scb->cs.p_ctrl_cback)(avdt_scb_to_hdl(p_scb), NULL, AVDT_WRITE_CFM_EVT,
                                   &avdt_ctrl);
     }
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
     else if (!fixed_queue_is_empty(p_scb->frag_q))
     {
         AVDT_TRACE_DEBUG("Dropped fragments queue");
@@ -1955,9 +1955,9 @@
 {
     tAVDT_CTRL      avdt_ctrl;
     BT_HDR          *p_pkt;
-#if AVDT_MULTIPLEXING == TRUE
-    BOOLEAN         sent = FALSE;
-    UINT8   res = AVDT_AD_SUCCESS;
+#if (AVDT_MULTIPLEXING == TRUE)
+    bool            sent = false;
+    uint8_t res = AVDT_AD_SUCCESS;
     tAVDT_SCB_EVT data;
 #endif
     UNUSED(p_data);
@@ -1974,7 +1974,7 @@
 
             (*p_scb->cs.p_ctrl_cback)(avdt_scb_to_hdl(p_scb), NULL, AVDT_WRITE_CFM_EVT, &avdt_ctrl);
         }
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
         else
         {
 #if 0
@@ -1984,13 +1984,13 @@
 #endif
             while ((p_pkt = (BT_HDR*)fixed_queue_try_dequeue(p_scb->frag_q)) != NULL)
             {
-                sent = TRUE;
+                sent = true;
                 AVDT_TRACE_DEBUG("Send fragment len=%d",p_pkt->len);
                 /* fragments queue contains fragment to send */
                 res = avdt_ad_write_req(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb, p_pkt);
                 if(AVDT_AD_CONGESTED == res)
                 {
-                    p_scb->cong = TRUE;
+                    p_scb->cong = true;
                     AVDT_TRACE_DEBUG("avdt/l2c congested!!");
                     break;/* exit loop if channel became congested */
             }
@@ -2054,12 +2054,12 @@
 void avdt_scb_clr_vars(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
 {
     UNUSED(p_data);
-    p_scb->in_use = FALSE;
+    p_scb->in_use = false;
     p_scb->p_ccb = NULL;
     p_scb->peer_seid = 0;
 }
 
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
 /*******************************************************************************
 **
 ** Function         avdt_scb_queue_frags
@@ -2070,19 +2070,19 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data,
-                          UINT32 *p_data_len)
+void avdt_scb_queue_frags(tAVDT_SCB *p_scb, uint8_t **pp_data,
+                          uint32_t *p_data_len)
 {
-    UINT16  lcid;
-    UINT16  num_frag;
-    UINT16  mtu_used;
-    UINT8   *p;
-    BOOLEAN al_hdr = FALSE;
-    UINT8   tcid;
+    uint16_t lcid;
+    uint16_t num_frag;
+    uint16_t mtu_used;
+    uint8_t *p;
+    bool    al_hdr = false;
+    uint8_t tcid;
     tAVDT_TC_TBL    *p_tbl;
-    UINT16          buf_size;
-    UINT16          offset = AVDT_MEDIA_OFFSET + AVDT_AL_HDR_SIZE;
-    UINT16          cont_offset = offset - AVDT_MEDIA_HDR_SIZE;
+    uint16_t        buf_size;
+    uint16_t        offset = AVDT_MEDIA_OFFSET + AVDT_AL_HDR_SIZE;
+    uint16_t        cont_offset = offset - AVDT_MEDIA_HDR_SIZE;
 
     tcid = avdt_ad_type_to_tcid(AVDT_CHAN_MEDIA, p_scb);
     lcid = avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_scb->p_ccb)][tcid].lcid;
@@ -2093,7 +2093,7 @@
          * the number of buffers at L2CAP is very small (if not 0).
          * we do not need to L2CA_FlushChannel() */
         offset = cont_offset;
-        al_hdr = TRUE;
+        al_hdr = true;
         num_frag = AVDT_MAX_FRAG_COUNT;
     }
     else
@@ -2134,7 +2134,7 @@
         p_frag->len = mtu_used - p_frag->offset;
         if(p_frag->len > *p_data_len)
             p_frag->len = *p_data_len;
-        memcpy((UINT8*)(p_frag+1) + p_frag->offset, *pp_data, p_frag->len);
+        memcpy((uint8_t*)(p_frag+1) + p_frag->offset, *pp_data, p_frag->len);
         *pp_data += p_frag->len;
         *p_data_len -= p_frag->len;
         AVDT_TRACE_DEBUG("Prepared fragment len=%d", p_frag->len);
@@ -2144,7 +2144,7 @@
             /* Adaptation Layer header */
             p_frag->len += AVDT_AL_HDR_SIZE;
             p_frag->offset -= AVDT_AL_HDR_SIZE;
-            p = (UINT8 *)(p_frag + 1) + p_frag->offset;
+            p = (uint8_t *)(p_frag + 1) + p_frag->offset;
             /* TSID, fragment bit and coding of length(in 2 length octets following) */
             *p++ = (p_scb->curr_cfg.mux_tsid_media<<3) | (AVDT_ALH_FRAG_MASK|AVDT_ALH_LCODE_16BIT);
 
diff --git a/stack/avrc/avrc_api.c b/stack/avrc/avrc_api.c
index 77ca7d4..49a6ccd 100644
--- a/stack/avrc/avrc_api.c
+++ b/stack/avrc/avrc_api.c
@@ -39,7 +39,7 @@
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 #endif
 
-static const UINT8 avrc_ctrl_event_map[] =
+static const uint8_t avrc_ctrl_event_map[] =
 {
     AVRC_OPEN_IND_EVT,  /* AVCT_CONNECT_CFM_EVT */
     AVRC_OPEN_IND_EVT,  /* AVCT_CONNECT_IND_EVT */
@@ -72,10 +72,10 @@
 ** Returns          Nothing.
 **
 ******************************************************************************/
-static void avrc_ctrl_cback(UINT8 handle, UINT8 event, UINT16 result,
+static void avrc_ctrl_cback(uint8_t handle, uint8_t event, uint16_t result,
                                 BD_ADDR peer_addr)
 {
-    UINT8   avrc_event;
+    uint8_t avrc_event;
 
     if (event <= AVRC_MAX_RCV_CTRL_EVT && avrc_cb.ccb[handle].p_ctrl_cback)
     {
@@ -99,9 +99,9 @@
 ** Returns          A pointer to the data payload.
 **
 ******************************************************************************/
-static UINT8 * avrc_get_data_ptr(BT_HDR *p_pkt)
+static uint8_t * avrc_get_data_ptr(BT_HDR *p_pkt)
 {
-    return (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    return (uint8_t *)(p_pkt + 1) + p_pkt->offset;
 }
 
 /******************************************************************************
@@ -123,8 +123,8 @@
     /* Copy the packet header, set the new offset, and copy the payload */
     memcpy(p_pkt_copy, p_pkt, BT_HDR_SIZE);
     p_pkt_copy->offset = offset;
-    UINT8 *p_data = avrc_get_data_ptr(p_pkt);
-    UINT8 *p_data_copy = avrc_get_data_ptr(p_pkt_copy);
+    uint8_t *p_data = avrc_get_data_ptr(p_pkt);
+    uint8_t *p_data_copy = avrc_get_data_ptr(p_pkt_copy);
     memcpy(p_data_copy, p_data, p_pkt->len);
 
     return p_pkt_copy;
@@ -140,12 +140,12 @@
 ** Returns          Nothing.
 **
 ******************************************************************************/
-static void avrc_prep_end_frag(UINT8 handle)
+static void avrc_prep_end_frag(uint8_t handle)
 {
     tAVRC_FRAG_CB   *p_fcb;
     BT_HDR  *p_pkt_new;
-    UINT8   *p_data, *p_orig_data;
-    UINT8   rsp_type;
+    uint8_t *p_data, *p_orig_data;
+    uint8_t rsp_type;
 
     AVRC_TRACE_DEBUG ("avrc_prep_end_frag" );
     p_fcb = &avrc_cb.fcb[handle];
@@ -153,13 +153,13 @@
     /* The response type of the end fragment should be the same as the the PDU of "End Fragment
     ** Response" Errata: https://www.bluetooth.org/errata/errata_view.cfm?errata_id=4383
     */
-    p_orig_data = ((UINT8 *)(p_fcb->p_fmsg + 1) + p_fcb->p_fmsg->offset);
+    p_orig_data = ((uint8_t *)(p_fcb->p_fmsg + 1) + p_fcb->p_fmsg->offset);
     rsp_type = ((*p_orig_data) & AVRC_CTYPE_MASK);
 
     p_pkt_new           = p_fcb->p_fmsg;
     p_pkt_new->len      -= (AVRC_MAX_CTRL_DATA_LEN - AVRC_VENDOR_HDR_SIZE - AVRC_MIN_META_HDR_SIZE);
     p_pkt_new->offset   += (AVRC_MAX_CTRL_DATA_LEN - AVRC_VENDOR_HDR_SIZE - AVRC_MIN_META_HDR_SIZE);
-    p_data = (UINT8 *)(p_pkt_new+1) + p_pkt_new->offset;
+    p_data = (uint8_t *)(p_pkt_new+1) + p_pkt_new->offset;
     *p_data++       = rsp_type;
     *p_data++       = (AVRC_SUB_PANEL << AVRC_SUBTYPE_SHIFT);
     *p_data++       = AVRC_OP_VENDOR;
@@ -180,12 +180,12 @@
 ** Returns          Nothing.
 **
 ******************************************************************************/
-static void avrc_send_continue_frag(UINT8 handle, UINT8 label)
+static void avrc_send_continue_frag(uint8_t handle, uint8_t label)
 {
     tAVRC_FRAG_CB   *p_fcb;
     BT_HDR  *p_pkt_old, *p_pkt;
-    UINT8   *p_old, *p_data;
-    UINT8   cr = AVCT_RSP;
+    uint8_t *p_old, *p_data;
+    uint8_t cr = AVCT_RSP;
 
     p_fcb = &avrc_cb.fcb[handle];
     p_pkt = p_fcb->p_fmsg;
@@ -200,8 +200,8 @@
         p_pkt->offset = AVCT_MSG_OFFSET;
         p_pkt->layer_specific = p_pkt_old->layer_specific;
         p_pkt->event = p_pkt_old->event;
-        p_old = (UINT8 *)(p_pkt_old + 1) + p_pkt_old->offset;
-        p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+        p_old = (uint8_t *)(p_pkt_old + 1) + p_pkt_old->offset;
+        p_data = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
         memcpy (p_data, p_old, AVRC_MAX_CTRL_DATA_LEN);
         /* use AVRC continue packet type */
         p_data += AVRC_VENDOR_HDR_SIZE;
@@ -214,7 +214,7 @@
         avrc_prep_end_frag (handle);
     } else {
         /* end fragment. clean the control block */
-        p_fcb->frag_enabled = FALSE;
+        p_fcb->frag_enabled = false;
         p_fcb->p_fmsg       = NULL;
     }
     AVCT_MsgReq( handle, label, cr, p_pkt);
@@ -229,18 +229,18 @@
 ** Returns          if not NULL, the response to send right away.
 **
 ******************************************************************************/
-static BT_HDR * avrc_proc_vendor_command(UINT8 handle, UINT8 label,
+static BT_HDR * avrc_proc_vendor_command(uint8_t handle, uint8_t label,
                                BT_HDR *p_pkt, tAVRC_MSG_VENDOR *p_msg)
 {
     BT_HDR      *p_rsp = NULL;
-    UINT8       *p_data;
-    UINT8       *p_begin;
-    UINT8       pkt_type;
-    BOOLEAN     abort_frag = FALSE;
+    uint8_t     *p_data;
+    uint8_t     *p_begin;
+    uint8_t     pkt_type;
+    bool        abort_frag = false;
     tAVRC_STS   status = AVRC_STS_NO_ERROR;
     tAVRC_FRAG_CB   *p_fcb;
 
-    p_begin  = (UINT8 *)(p_pkt+1) + p_pkt->offset;
+    p_begin  = (uint8_t *)(p_pkt+1) + p_pkt->offset;
     p_data   = p_begin + AVRC_VENDOR_HDR_SIZE;
     pkt_type = *(p_data + 1) & AVRC_PKT_TYPE_MASK;
 
@@ -261,8 +261,8 @@
             {
             case AVRC_PDU_ABORT_CONTINUATION_RSP:
                 /* aborted by CT - send accept response */
-                abort_frag = TRUE;
-                p_begin = (UINT8 *)(p_pkt+1) + p_pkt->offset;
+                abort_frag = true;
+                p_begin = (uint8_t *)(p_pkt+1) + p_pkt->offset;
                 *p_begin = (AVRC_RSP_ACCEPT & AVRC_CTYPE_MASK);
                 if (*(p_data + 4) != p_fcb->frag_pdu)
                 {
@@ -292,32 +292,32 @@
                     current re-assembly pdu: 0x%x",
                         *(p_data + 4), p_fcb->frag_pdu);
                     status = AVRC_STS_BAD_PARAM;
-                    abort_frag = TRUE;
+                    abort_frag = true;
                 }
                 break;
 
             default:
                 /* implicit abort */
-                abort_frag = TRUE;
+                abort_frag = true;
             }
         }
         else
         {
-            abort_frag = TRUE;
+            abort_frag = true;
             /* implicit abort */
         }
 
         if (abort_frag)
         {
             osi_free_and_reset((void **)&p_fcb->p_fmsg);
-            p_fcb->frag_enabled = FALSE;
+            p_fcb->frag_enabled = false;
         }
     }
 
     if (status != AVRC_STS_NO_ERROR)
     {
         /* use the current GKI buffer to build/send the reject message */
-        p_data = (UINT8 *)(p_pkt+1) + p_pkt->offset;
+        p_data = (uint8_t *)(p_pkt+1) + p_pkt->offset;
         *p_data++ = AVRC_RSP_REJ;
         p_data += AVRC_VENDOR_HDR_SIZE; /* pdu */
         *p_data++ = 0;                  /* pkt_type */
@@ -340,22 +340,22 @@
 ** Returns          0, to report the message with msg_cback .
 **
 ******************************************************************************/
-static UINT8 avrc_proc_far_msg(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR **pp_pkt,
+static uint8_t avrc_proc_far_msg(uint8_t handle, uint8_t label, uint8_t cr, BT_HDR **pp_pkt,
     tAVRC_MSG_VENDOR *p_msg)
 {
     BT_HDR      *p_pkt = *pp_pkt;
-    UINT8       *p_data;
-    UINT8       drop_code = 0;
-    BOOLEAN     buf_overflow = FALSE;
+    uint8_t     *p_data;
+    uint8_t     drop_code = 0;
+    bool        buf_overflow = false;
     BT_HDR      *p_rsp = NULL;
     BT_HDR      *p_cmd = NULL;
-    BOOLEAN     req_continue = FALSE;
+    bool        req_continue = false;
     BT_HDR      *p_pkt_new = NULL;
-    UINT8       pkt_type;
+    uint8_t     pkt_type;
     tAVRC_RASM_CB   *p_rcb;
     tAVRC_NEXT_CMD   avrc_cmd;
 
-    p_data  = (UINT8 *)(p_pkt+1) + p_pkt->offset;
+    p_data  = (uint8_t *)(p_pkt+1) + p_pkt->offset;
 
     /* Skip over vendor header (ctype, subunit*, opcode, CO_ID) */
     p_data += AVRC_VENDOR_HDR_SIZE;
@@ -384,8 +384,8 @@
                 memcpy(p_rcb->p_rmsg, p_pkt, sizeof(BT_HDR)); /* Copy bt hdr */
 
                 /* Copy metadata message */
-                memcpy((UINT8 *)(p_rcb->p_rmsg + 1),
-                       (UINT8 *)(p_pkt+1) + p_pkt->offset, p_pkt->len);
+                memcpy((uint8_t *)(p_rcb->p_rmsg + 1),
+                       (uint8_t *)(p_pkt+1) + p_pkt->offset, p_pkt->len);
 
                 /* offset of start of metadata response in reassembly buffer */
                 p_rcb->p_rmsg->offset = p_rcb->rasm_offset = 0;
@@ -402,7 +402,7 @@
                  * reassembly logic as AVCT.
                  */
                 p_rcb->p_rmsg->offset += p_rcb->p_rmsg->len;
-                req_continue = TRUE;
+                req_continue = true;
             } else if (p_rcb->p_rmsg == NULL) {
                 /* Received a CONTINUE/END, but no corresponding START
                               (or previous fragmented response was dropped) */
@@ -419,7 +419,7 @@
                  * NOTE: The buffer is allocated above at the beginning of the
                  * reassembly, and is always of size BT_DEFAULT_BUFFER_SIZE.
                  */
-                UINT16 buf_len = BT_DEFAULT_BUFFER_SIZE - sizeof(BT_HDR);
+                uint16_t buf_len = BT_DEFAULT_BUFFER_SIZE - sizeof(BT_HDR);
                 /* adjust offset and len of fragment for header byte */
                 p_pkt->offset += (AVRC_VENDOR_HDR_SIZE + AVRC_MIN_META_HDR_SIZE);
                 p_pkt->len -= (AVRC_VENDOR_HDR_SIZE + AVRC_MIN_META_HDR_SIZE);
@@ -433,8 +433,8 @@
                 }
 
                 /* copy contents of p_pkt to p_rx_msg */
-                memcpy((UINT8 *)(p_rcb->p_rmsg + 1) + p_rcb->p_rmsg->offset,
-                       (UINT8 *)(p_pkt + 1) + p_pkt->offset, p_pkt->len);
+                memcpy((uint8_t *)(p_rcb->p_rmsg + 1) + p_rcb->p_rmsg->offset,
+                       (uint8_t *)(p_pkt + 1) + p_pkt->offset, p_pkt->len);
 
                 if (pkt_type == AVRC_PKT_END)
                 {
@@ -443,7 +443,7 @@
                     p_pkt_new = p_rcb->p_rmsg;
                     p_rcb->rasm_offset = 0;
                     p_rcb->p_rmsg = NULL;
-                    p_msg->p_vendor_data   = (UINT8 *)(p_pkt_new+1) + p_pkt_new->offset;
+                    p_msg->p_vendor_data   = (uint8_t *)(p_pkt_new+1) + p_pkt_new->offset;
                     p_msg->hdr.ctype       = p_msg->p_vendor_data[0] & AVRC_CTYPE_MASK;
                     /* 6 = ctype, subunit*, opcode & CO_ID */
                     p_msg->p_vendor_data  += AVRC_VENDOR_HDR_SIZE;
@@ -459,7 +459,7 @@
                     p_rcb->p_rmsg->offset += p_pkt->len;
                     p_rcb->p_rmsg->len += p_pkt->len;
                     p_pkt_new = NULL;
-                    req_continue = TRUE;
+                    req_continue = true;
                 }
                 osi_free(p_pkt);
                 *pp_pkt = p_pkt_new;
@@ -482,7 +482,7 @@
                 drop_code = 4;
 
         }
-        else if (cr == AVCT_RSP && req_continue == TRUE)
+        else if (cr == AVCT_RSP && req_continue == true)
         {
             avrc_cmd.pdu    = AVRC_PDU_REQUEST_CONTINUATION_RSP;
             avrc_cmd.status = AVRC_STS_NO_ERROR;
@@ -490,13 +490,13 @@
             if (AVRC_BldCommand ((tAVRC_COMMAND *)&avrc_cmd, &p_cmd) == AVRC_STS_NO_ERROR)
             {
                 drop_code = 2;
-                AVRC_MsgReq (handle, (UINT8)(label), AVRC_CMD_CTRL, p_cmd);
+                AVRC_MsgReq (handle, (uint8_t)(label), AVRC_CMD_CTRL, p_cmd);
             }
         }
         /*
          * Drop it if we are out of buffer
          */
-        else if (cr == AVCT_RSP && req_continue == FALSE  && buf_overflow == TRUE)
+        else if (cr == AVCT_RSP && req_continue == false  && buf_overflow == true)
         {
             avrc_cmd.pdu    = AVRC_PDU_ABORT_CONTINUATION_RSP;
             avrc_cmd.status = AVRC_STS_NO_ERROR;
@@ -504,7 +504,7 @@
             if (AVRC_BldCommand ((tAVRC_COMMAND *)&avrc_cmd, &p_cmd) == AVRC_STS_NO_ERROR)
             {
                 drop_code = 4;
-                AVRC_MsgReq (handle, (UINT8)(label), AVRC_CMD_CTRL, p_cmd);
+                AVRC_MsgReq (handle, (uint8_t)(label), AVRC_CMD_CTRL, p_cmd);
             }
         }
     }
@@ -523,19 +523,19 @@
 ** Returns          Nothing.
 **
 ******************************************************************************/
-static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
+static void avrc_msg_cback(uint8_t handle, uint8_t label, uint8_t cr,
                                BT_HDR *p_pkt)
 {
-    UINT8       opcode;
+    uint8_t     opcode;
     tAVRC_MSG   msg;
-    UINT8       *p_data;
-    UINT8       *p_begin;
-    BOOLEAN     drop = FALSE;
-    BOOLEAN     do_free = TRUE;
+    uint8_t     *p_data;
+    uint8_t     *p_begin;
+    bool        drop = false;
+    bool        do_free = true;
     BT_HDR      *p_rsp = NULL;
-    UINT8       *p_rsp_data;
+    uint8_t     *p_rsp_data;
     int         xx;
-    BOOLEAN     reject = FALSE;
+    bool        reject = false;
 #if (BT_USE_TRACES == TRUE)
     char        *p_drop_msg = "dropped";
 #endif
@@ -561,7 +561,7 @@
         return;
     }
 
-    p_data  = (UINT8 *)(p_pkt+1) + p_pkt->offset;
+    p_data  = (uint8_t *)(p_pkt+1) + p_pkt->offset;
     memset(&msg, 0, sizeof(tAVRC_MSG) );
     {
         msg.hdr.ctype           = p_data[0] & AVRC_CTYPE_MASK;
@@ -593,7 +593,7 @@
                 /* Panel subunit & id=0 */
                 *p_rsp_data++   = (AVRC_SUB_PANEL << AVRC_SUBTYPE_SHIFT);
                 AVRC_CO_ID_TO_BE_STREAM(p_rsp_data, avrc_cb.ccb[handle].company_id);
-                p_rsp->len      = (UINT16) (p_rsp_data - (UINT8 *)(p_rsp + 1) - p_rsp->offset);
+                p_rsp->len      = (uint16_t) (p_rsp_data - (uint8_t *)(p_rsp + 1) - p_rsp->offset);
                 cr = AVCT_RSP;
 #if (BT_USE_TRACES == TRUE)
                 p_drop_msg = "auto respond";
@@ -624,7 +624,7 @@
                 *p_rsp_data++   = (AVRC_SUB_PANEL << AVRC_SUBTYPE_SHIFT);
                 memset(p_rsp_data, AVRC_CMD_OPRND_PAD, AVRC_SUBRSP_OPRND_BYTES);
                 p_rsp_data      += AVRC_SUBRSP_OPRND_BYTES;
-                p_rsp->len      = (UINT16) (p_rsp_data - (UINT8 *)(p_rsp + 1) - p_rsp->offset);
+                p_rsp->len      = (uint16_t) (p_rsp_data - (uint8_t *)(p_rsp + 1) - p_rsp->offset);
                 cr = AVCT_RSP;
 #if (BT_USE_TRACES == TRUE)
                 p_drop_msg = "auto responded";
@@ -640,21 +640,21 @@
                 {
                     msg.sub.subunit_type[xx] = *p_data++ >> AVRC_SUBTYPE_SHIFT;
                     if (msg.sub.subunit_type[xx] == AVRC_SUB_PANEL)
-                        msg.sub.panel   = TRUE;
+                        msg.sub.panel   = true;
                     xx++;
                 }
             }
             break;
 
         case AVRC_OP_VENDOR:
-            p_data  = (UINT8 *)(p_pkt+1) + p_pkt->offset;
+            p_data  = (uint8_t *)(p_pkt+1) + p_pkt->offset;
             p_begin = p_data;
             if (p_pkt->len < AVRC_VENDOR_HDR_SIZE) /* 6 = ctype, subunit*, opcode & CO_ID */
             {
                 if (cr == AVCT_CMD)
-                    reject = TRUE;
+                    reject = true;
                 else
-                    drop = TRUE;
+                    drop = true;
                 break;
             }
             p_data += AVRC_AVC_HDR_SIZE; /* skip the first 3 bytes: ctype, subunit*, opcode */
@@ -663,28 +663,28 @@
             p_msg->vendor_len      = p_pkt->len - (p_data - p_begin);
 
 #if (AVRC_METADATA_INCLUDED == TRUE)
-            UINT8 drop_code = 0;
+            uint8_t drop_code = 0;
             if (p_msg->company_id == AVRC_CO_METADATA)
             {
                 /* Validate length for metadata message */
                 if (p_pkt->len < (AVRC_VENDOR_HDR_SIZE + AVRC_MIN_META_HDR_SIZE))
                 {
                     if (cr == AVCT_CMD)
-                        reject = TRUE;
+                        reject = true;
                     else
-                        drop = TRUE;
+                        drop = true;
                     break;
                 }
 
                 /* Check+handle fragmented messages */
                 drop_code = avrc_proc_far_msg(handle, label, cr, &p_pkt, p_msg);
                 if (drop_code > 0)
-                    drop = TRUE;
+                    drop = true;
             }
             if (drop_code > 0)
             {
                 if (drop_code != 4)
-                    do_free = FALSE;
+                    do_free = false;
 #if (BT_USE_TRACES == TRUE)
                 switch (drop_code)
                 {
@@ -712,17 +712,17 @@
             if (p_pkt->len < 5) /* 3 bytes: ctype, subunit*, opcode & op_id & len */
             {
                 if (cr == AVCT_CMD)
-                    reject = TRUE;
+                    reject = true;
                 else
-                    drop = TRUE;
+                    drop = true;
                 break;
             }
             p_data += AVRC_AVC_HDR_SIZE; /* skip the first 3 bytes: ctype, subunit*, opcode */
             msg.pass.op_id  = (AVRC_PASS_OP_ID_MASK & *p_data);
             if (AVRC_PASS_STATE_MASK & *p_data)
-                msg.pass.state  = TRUE;
+                msg.pass.state  = true;
             else
-                msg.pass.state  = FALSE;
+                msg.pass.state  = false;
             p_data++;
             msg.pass.pass_len    = *p_data++;
             if (msg.pass.pass_len != p_pkt->len - 5)
@@ -738,15 +738,15 @@
             if ((avrc_cb.ccb[handle].control & AVRC_CT_TARGET) && (cr == AVCT_CMD))
             {
                 /* reject unsupported opcode */
-                reject = TRUE;
+                reject = true;
             }
-            drop    = TRUE;
+            drop    = true;
             break;
         }
     }
     else /* drop the event */
     {
-            drop    = TRUE;
+            drop    = true;
     }
 
     if (reject)
@@ -759,17 +759,17 @@
         p_drop_msg = "rejected";
 #endif
         cr      = AVCT_RSP;
-        drop    = TRUE;
+        drop    = true;
     }
 
     if (p_rsp)
     {
         /* set to send response right away */
         AVCT_MsgReq( handle, label, cr, p_rsp);
-        drop = TRUE;
+        drop = true;
     }
 
-    if (drop == FALSE)
+    if (drop == false)
     {
         msg.hdr.opcode = opcode;
         (*avrc_cb.ccb[handle].p_msg_cback)(handle, label, opcode, &msg);
@@ -816,7 +816,7 @@
     p_cmd->offset = AVCT_MSG_OFFSET;
     p_cmd->layer_specific = AVCT_DATA_CTRL;
 
-    UINT8 *p_data = (UINT8 *)(p_cmd + 1) + p_cmd->offset;
+    uint8_t *p_data = (uint8_t *)(p_cmd + 1) + p_cmd->offset;
     *p_data++ = (p_msg->hdr.ctype & AVRC_CTYPE_MASK);
     *p_data++ = (AVRC_SUB_PANEL << AVRC_SUBTYPE_SHIFT); /* Panel subunit & id=0 */
     *p_data++ = AVRC_OP_PASS_THRU;
@@ -835,7 +835,7 @@
         /* set msg len to 0 for other op_id */
         *p_data++       = 0;
     }
-    p_cmd->len = (UINT16) (p_data - (UINT8 *)(p_cmd + 1) - p_cmd->offset);
+    p_cmd->len = (uint16_t) (p_data - (uint8_t *)(p_cmd + 1) - p_cmd->offset);
 
     return p_cmd;
 }
@@ -885,9 +885,9 @@
 **                  the connection.
 **
 ******************************************************************************/
-UINT16 AVRC_Open(UINT8 *p_handle, tAVRC_CONN_CB *p_ccb, BD_ADDR_PTR peer_addr)
+uint16_t AVRC_Open(uint8_t *p_handle, tAVRC_CONN_CB *p_ccb, BD_ADDR_PTR peer_addr)
 {
-    UINT16      status;
+    uint16_t    status;
     tAVCT_CC    cc;
 
     cc.p_ctrl_cback = avrc_ctrl_cback;      /* Control callback */
@@ -929,7 +929,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-UINT16 AVRC_Close(UINT8 handle)
+uint16_t AVRC_Close(uint8_t handle)
 {
     AVRC_TRACE_DEBUG("AVRC_Close handle:%d", handle);
     return AVCT_RemoveConn(handle);
@@ -952,15 +952,15 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-UINT16 AVRC_MsgReq (UINT8 handle, UINT8 label, UINT8 ctype, BT_HDR *p_pkt)
+uint16_t AVRC_MsgReq (uint8_t handle, uint8_t label, uint8_t ctype, BT_HDR *p_pkt)
 {
 #if (AVRC_METADATA_INCLUDED == TRUE)
-    UINT8   *p_data;
-    UINT8   cr = AVCT_CMD;
-    BOOLEAN chk_frag = TRUE;
-    UINT8   *p_start = NULL;
+    uint8_t *p_data;
+    uint8_t cr = AVCT_CMD;
+    bool    chk_frag = true;
+    uint8_t *p_start = NULL;
     tAVRC_FRAG_CB   *p_fcb;
-    UINT16  len;
+    uint16_t len;
 
     if (!p_pkt)
         return AVRC_BAD_PARAM;
@@ -974,10 +974,10 @@
     if (p_pkt->event == AVRC_OP_VENDOR)
     {
         /* add AVRCP Vendor Dependent headers */
-        p_start = ((UINT8 *)(p_pkt + 1) + p_pkt->offset);
+        p_start = ((uint8_t *)(p_pkt + 1) + p_pkt->offset);
         p_pkt->offset -= AVRC_VENDOR_HDR_SIZE;
         p_pkt->len += AVRC_VENDOR_HDR_SIZE;
-        p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+        p_data = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
         *p_data++       = (ctype & AVRC_CTYPE_MASK);
         *p_data++       = (AVRC_SUB_PANEL << AVRC_SUBTYPE_SHIFT);
         *p_data++       = AVRC_OP_VENDOR;
@@ -986,10 +986,10 @@
     else if (p_pkt->event == AVRC_OP_PASS_THRU)
     {
         /* add AVRCP Pass Through headers */
-        p_start = ((UINT8 *)(p_pkt + 1) + p_pkt->offset);
+        p_start = ((uint8_t *)(p_pkt + 1) + p_pkt->offset);
         p_pkt->offset -= AVRC_PASS_THRU_SIZE;
         p_pkt->len += AVRC_PASS_THRU_SIZE;
-        p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+        p_data = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
         *p_data++       = (ctype & AVRC_CTYPE_MASK);
         *p_data++       = (AVRC_SUB_PANEL << AVRC_SUBTYPE_SHIFT);
         *p_data++       = AVRC_OP_PASS_THRU;/* opcode */
@@ -1001,13 +1001,13 @@
     /* abandon previous fragments */
     p_fcb = &avrc_cb.fcb[handle];
     if (p_fcb->frag_enabled)
-        p_fcb->frag_enabled = FALSE;
+        p_fcb->frag_enabled = false;
 
     osi_free_and_reset((void **)&p_fcb->p_fmsg);
 
     /* AVRCP spec has not defined any control channel commands that needs fragmentation at this level
      * check for fragmentation only on the response */
-    if ((cr == AVCT_RSP) && (chk_frag == TRUE))
+    if ((cr == AVCT_RSP) && (chk_frag == true))
     {
         if (p_pkt->len > AVRC_MAX_CTRL_DATA_LEN)
         {
@@ -1015,7 +1015,7 @@
             BT_HDR *p_pkt_new =
                 (BT_HDR *)osi_malloc(AVRC_PACKET_LEN + offset_len + BT_HDR_SIZE);
             if (p_start != NULL) {
-                p_fcb->frag_enabled = TRUE;
+                p_fcb->frag_enabled = true;
                 p_fcb->p_fmsg       = p_pkt;
                 p_fcb->frag_pdu     = *p_start;
                 p_pkt               = p_pkt_new;
@@ -1024,7 +1024,7 @@
                 p_pkt->offset       = p_pkt_new->offset;
                 p_pkt->layer_specific = p_pkt_new->layer_specific;
                 p_pkt->event = p_pkt_new->event;
-                p_data = (UINT8 *)(p_pkt+1) + p_pkt->offset;
+                p_data = (uint8_t *)(p_pkt+1) + p_pkt->offset;
                 p_start -= AVRC_VENDOR_HDR_SIZE;
                 memcpy (p_data, p_start, AVRC_MAX_CTRL_DATA_LEN);
                 /* use AVRC start packet type */
@@ -1078,7 +1078,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-UINT16 AVRC_PassCmd(UINT8 handle, UINT8 label, tAVRC_MSG_PASS *p_msg)
+uint16_t AVRC_PassCmd(uint8_t handle, uint8_t label, tAVRC_MSG_PASS *p_msg)
 {
     BT_HDR *p_buf;
     assert(p_msg != NULL);
@@ -1117,7 +1117,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-UINT16 AVRC_PassRsp(UINT8 handle, UINT8 label, tAVRC_MSG_PASS *p_msg)
+uint16_t AVRC_PassRsp(uint8_t handle, uint8_t label, tAVRC_MSG_PASS *p_msg)
 {
     BT_HDR *p_buf;
     assert(p_msg != NULL);
diff --git a/stack/avrc/avrc_bld_ct.c b/stack/avrc/avrc_bld_ct.c
index 99ecb10..ab33913 100644
--- a/stack/avrc/avrc_bld_ct.c
+++ b/stack/avrc/avrc_bld_ct.c
@@ -40,12 +40,12 @@
 *******************************************************************************/
 static tAVRC_STS avrc_bld_next_cmd (tAVRC_NEXT_CMD *p_cmd, BT_HDR *p_pkt)
 {
-    UINT8   *p_data, *p_start;
+    uint8_t *p_data, *p_start;
 
     AVRC_TRACE_API("avrc_bld_next_cmd");
 
     /* get the existing length, if any, and also the num attributes */
-    p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_data = p_start + 2; /* pdu + rsvd */
 
     /* add fixed lenth 1 - pdu_id (1) */
@@ -73,11 +73,11 @@
 *******************************************************************************/
 static tAVRC_STS avrc_bld_set_abs_volume_cmd (tAVRC_SET_VOLUME_CMD *p_cmd, BT_HDR *p_pkt)
 {
-    UINT8   *p_data, *p_start;
+    uint8_t *p_data, *p_start;
 
     AVRC_TRACE_API("avrc_bld_set_abs_volume_cmd");
     /* get the existing length, if any, and also the num attributes */
-    p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_data = p_start + 2; /* pdu + rsvd */
     /* add fixed lenth 1 - volume (1) */
     UINT16_TO_BE_STREAM(p_data, 1);
@@ -96,14 +96,14 @@
 **                  Otherwise, the error code.
 **
 *******************************************************************************/
-static tAVRC_STS avrc_bld_register_notifn(BT_HDR * p_pkt, UINT8 event_id, UINT32 event_param)
+static tAVRC_STS avrc_bld_register_notifn(BT_HDR * p_pkt, uint8_t event_id, uint32_t event_param)
 {
-    UINT8   *p_data, *p_start;
+    uint8_t *p_data, *p_start;
 
     AVRC_TRACE_API("avrc_bld_register_notifn");
     /* get the existing length, if any, and also the num attributes */
     // Set the notify value
-    p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_data = p_start + 2; /* pdu + rsvd */
     /* add fixed length 5 -*/
     UINT16_TO_BE_STREAM(p_data, 5);
@@ -124,11 +124,11 @@
 **                  Otherwise, the error code.
 **
 *******************************************************************************/
-static tAVRC_STS avrc_bld_get_capability_cmd(BT_HDR * p_pkt, UINT8 cap_id)
+static tAVRC_STS avrc_bld_get_capability_cmd(BT_HDR * p_pkt, uint8_t cap_id)
 {
     AVRC_TRACE_API("avrc_bld_get_capability_cmd");
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
-    UINT8 *p_data = p_start + 2; /* pdu + rsvd */
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_data = p_start + 2; /* pdu + rsvd */
     /* add fixed length 1 -*/
     UINT16_TO_BE_STREAM(p_data, 1);
     UINT8_TO_BE_STREAM(p_data,cap_id);
@@ -149,8 +149,8 @@
 static tAVRC_STS avrc_bld_list_player_app_attr_cmd(BT_HDR * p_pkt)
 {
     AVRC_TRACE_API("avrc_bld_list_player_app_attr_cmd");
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
-    UINT8 *p_data = p_start + 2; /* pdu + rsvd */
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_data = p_start + 2; /* pdu + rsvd */
     /* add fixed length 1 -*/
     UINT16_TO_BE_STREAM(p_data, 0);
     p_pkt->len = (p_data - p_start);
@@ -167,11 +167,11 @@
 **                  Otherwise, the error code.
 **
 *******************************************************************************/
-static tAVRC_STS avrc_bld_list_player_app_values_cmd(BT_HDR * p_pkt, UINT8 attrib_id)
+static tAVRC_STS avrc_bld_list_player_app_values_cmd(BT_HDR * p_pkt, uint8_t attrib_id)
 {
     AVRC_TRACE_API("avrc_bld_list_player_app_values_cmd");
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
-    UINT8 *p_data = p_start + 2; /* pdu + rsvd */
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_data = p_start + 2; /* pdu + rsvd */
     /* add fixed length 1 -*/
     UINT16_TO_BE_STREAM(p_data, 1);
     UINT8_TO_BE_STREAM(p_data,attrib_id);
@@ -190,12 +190,12 @@
 **
 *******************************************************************************/
 static tAVRC_STS avrc_bld_get_current_player_app_values_cmd(
-    BT_HDR * p_pkt, UINT8 num_attrib_id, UINT8* attrib_ids)
+    BT_HDR * p_pkt, uint8_t num_attrib_id, uint8_t* attrib_ids)
 {
     AVRC_TRACE_API("avrc_bld_get_current_player_app_values_cmd");
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
-    UINT8 *p_data = p_start + 2; /* pdu + rsvd */
-    UINT8 param_len = num_attrib_id + 1; // 1 additional to hold num attributes feild
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_data = p_start + 2; /* pdu + rsvd */
+    uint8_t param_len = num_attrib_id + 1; // 1 additional to hold num attributes feild
     /* add length -*/
     UINT16_TO_BE_STREAM(p_data, param_len);
     UINT8_TO_BE_STREAM(p_data,num_attrib_id);
@@ -217,15 +217,15 @@
 **                  Otherwise, the error code.
 **
 *******************************************************************************/
-static tAVRC_STS avrc_bld_set_current_player_app_values_cmd(BT_HDR * p_pkt, UINT8 num_attrib_id, tAVRC_APP_SETTING* p_val)
+static tAVRC_STS avrc_bld_set_current_player_app_values_cmd(BT_HDR * p_pkt, uint8_t num_attrib_id, tAVRC_APP_SETTING* p_val)
 {
     AVRC_TRACE_API("avrc_bld_set_current_player_app_values_cmd");
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
-    UINT8 *p_data = p_start + 2; /* pdu + rsvd */
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_data = p_start + 2; /* pdu + rsvd */
     /* we have to store attrib- value pair
      * 1 additional to store num elements
      */
-    UINT8 param_len = (2*num_attrib_id) + 1;
+    uint8_t param_len = (2*num_attrib_id) + 1;
     /* add length */
     UINT16_TO_BE_STREAM(p_data, param_len);
     UINT8_TO_BE_STREAM(p_data,num_attrib_id);
@@ -250,12 +250,12 @@
 *******************************************************************************/
 static tAVRC_STS avrc_bld_get_player_app_setting_attr_text_cmd (BT_HDR * p_pkt, tAVRC_GET_APP_ATTR_TXT_CMD *p_cmd)
 {
-    AVRC_TRACE_API("%s", __FUNCTION__);
+    AVRC_TRACE_API("%s", __func__);
 
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
-    UINT8 *p_data = p_start + 2; /* pdu + rsvd */
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_data = p_start + 2; /* pdu + rsvd */
 
-    UINT8 param_len = p_cmd->num_attr + 1;
+    uint8_t param_len = p_cmd->num_attr + 1;
     /* add length */
     UINT16_TO_BE_STREAM(p_data, param_len);
     UINT8_TO_BE_STREAM(p_data, p_cmd->num_attr);
@@ -279,12 +279,12 @@
 *******************************************************************************/
 static tAVRC_STS avrc_bld_get_player_app_setting_value_text_cmd (BT_HDR * p_pkt, tAVRC_GET_APP_VAL_TXT_CMD *p_cmd)
 {
-    AVRC_TRACE_API("%s", __FUNCTION__);
+    AVRC_TRACE_API("%s", __func__);
 
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
-    UINT8 *p_data = p_start + 2; /* pdu + rsvd */
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_data = p_start + 2; /* pdu + rsvd */
 
-    UINT8 param_len = p_cmd->num_val + 1;
+    uint8_t param_len = p_cmd->num_val + 1;
     /* add length */
     UINT16_TO_BE_STREAM(p_data, param_len);
     UINT8_TO_BE_STREAM(p_data, p_cmd->num_val);
@@ -306,15 +306,15 @@
 **                  Otherwise, the error code.
 **
 *******************************************************************************/
-static tAVRC_STS avrc_bld_get_element_attr_cmd(BT_HDR * p_pkt, UINT8 num_attrib, UINT32* attrib_ids)
+static tAVRC_STS avrc_bld_get_element_attr_cmd(BT_HDR * p_pkt, uint8_t num_attrib, uint32_t* attrib_ids)
 {
     AVRC_TRACE_API("avrc_bld_get_element_attr_cmd");
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
-    UINT8 *p_data = p_start + 2; /* pdu + rsvd */
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_data = p_start + 2; /* pdu + rsvd */
     /* we have to store attrib- value pair
      * 1 additional to store num elements
      */
-    UINT8 param_len = (4*num_attrib) + 9;
+    uint8_t param_len = (4*num_attrib) + 9;
     /* add length */
     UINT16_TO_BE_STREAM(p_data, param_len);
     /* 8 bytes of identifier as 0 (playing)*/
@@ -342,8 +342,8 @@
 static tAVRC_STS avrc_bld_get_play_status_cmd(BT_HDR * p_pkt)
 {
     AVRC_TRACE_API("avrc_bld_list_player_app_attr_cmd");
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
-    UINT8 *p_data = p_start + 2; /* pdu + rsvd */
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_data = p_start + 2; /* pdu + rsvd */
     /* add fixed length 1 -*/
     UINT16_TO_BE_STREAM(p_data, 0);
     p_pkt->len = (p_data - p_start);
@@ -363,10 +363,10 @@
 *******************************************************************************/
 static BT_HDR *avrc_bld_init_cmd_buffer(tAVRC_COMMAND *p_cmd)
 {
-    UINT8  opcode = avrc_opcode_from_pdu(p_cmd->pdu);
+    uint8_t opcode = avrc_opcode_from_pdu(p_cmd->pdu);
     AVRC_TRACE_API("avrc_bld_init_cmd_buffer: pdu=%x, opcode=%x", p_cmd->pdu, opcode);
 
-    UINT16 offset = 0;
+    uint16_t offset = 0;
     switch (opcode)
     {
     case AVRC_OP_PASS_THRU:
@@ -380,12 +380,12 @@
 
     /* allocate and initialize the buffer */
     BT_HDR *p_pkt = (BT_HDR *)osi_malloc(AVRC_META_CMD_BUF_SIZE);
-    UINT8 *p_data, *p_start;
+    uint8_t *p_data, *p_start;
 
     p_pkt->layer_specific = AVCT_DATA_CTRL;
     p_pkt->event = opcode;
     p_pkt->offset = offset;
-    p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_data = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_start = p_data;
 
     /* pass thru - group navigation - has a two byte op_id, so dont do it here */
@@ -422,7 +422,7 @@
 tAVRC_STS AVRC_BldCommand( tAVRC_COMMAND *p_cmd, BT_HDR **pp_pkt)
 {
     tAVRC_STS status = AVRC_STS_BAD_PARAM;
-    BOOLEAN alloc = FALSE;
+    bool    alloc = false;
     AVRC_TRACE_API("AVRC_BldCommand: pdu=%x status=%x", p_cmd->cmd.pdu, p_cmd->cmd.status);
     if (!p_cmd || !pp_pkt)
     {
@@ -438,7 +438,7 @@
             AVRC_TRACE_API("AVRC_BldCommand: Failed to initialize command buffer");
             return AVRC_STS_INTERNAL_ERR;
         }
-        alloc = TRUE;
+        alloc = true;
     }
     status = AVRC_STS_NO_ERROR;
     BT_HDR* p_pkt = *pp_pkt;
diff --git a/stack/avrc/avrc_bld_tg.c b/stack/avrc/avrc_bld_tg.c
index 129b386..f31fe00 100644
--- a/stack/avrc/avrc_bld_tg.c
+++ b/stack/avrc/avrc_bld_tg.c
@@ -40,11 +40,11 @@
 *******************************************************************************/
 static tAVRC_STS avrc_bld_get_capability_rsp (tAVRC_GET_CAPS_RSP *p_rsp, BT_HDR *p_pkt)
 {
-    UINT8   *p_data, *p_start, *p_len, *p_count;
-    UINT16  len = 0;
-    UINT8   xx;
-    UINT32  *p_company_id;
-    UINT8   *p_event_id;
+    uint8_t *p_data, *p_start, *p_len, *p_count;
+    uint16_t len = 0;
+    uint8_t xx;
+    uint32_t *p_company_id;
+    uint8_t *p_event_id;
     tAVRC_STS status = AVRC_STS_NO_ERROR;
 
     if (!(AVRC_IS_VALID_CAP_ID(p_rsp->capability_id)))
@@ -56,7 +56,7 @@
 
     AVRC_TRACE_API("%s", __func__);
     /* get the existing length, if any, and also the num attributes */
-    p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_data = p_len = p_start + 2; /* pdu + rsvd */
 
     BE_STREAM_TO_UINT16(len, p_data);
@@ -118,13 +118,13 @@
 *******************************************************************************/
 static tAVRC_STS avrc_bld_list_app_settings_attr_rsp (tAVRC_LIST_APP_ATTR_RSP *p_rsp, BT_HDR *p_pkt)
 {
-    UINT8   *p_data, *p_start, *p_len, *p_num;
-    UINT16  len = 0;
-    UINT8   xx;
+    uint8_t *p_data, *p_start, *p_len, *p_num;
+    uint16_t len = 0;
+    uint8_t xx;
 
     AVRC_TRACE_API("%s", __func__);
     /* get the existing length, if any, and also the num attributes */
-    p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_data = p_len = p_start + 2; /* pdu + rsvd */
 
     BE_STREAM_TO_UINT16(len, p_data);
@@ -170,13 +170,13 @@
 static tAVRC_STS avrc_bld_list_app_settings_values_rsp (tAVRC_LIST_APP_VALUES_RSP *p_rsp,
     BT_HDR *p_pkt)
 {
-    UINT8   *p_data, *p_start, *p_len, *p_num;
-    UINT8   xx;
-    UINT16  len;
+    uint8_t *p_data, *p_start, *p_len, *p_num;
+    uint8_t xx;
+    uint16_t len;
 
     AVRC_TRACE_API("%s", __func__);
 
-    p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_data = p_len = p_start + 2; /* pdu + rsvd */
 
     /* get the existing length, if any, and also the num attributes */
@@ -220,9 +220,9 @@
 static tAVRC_STS avrc_bld_get_cur_app_setting_value_rsp (tAVRC_GET_CUR_APP_VALUE_RSP *p_rsp,
     BT_HDR *p_pkt)
 {
-    UINT8   *p_data, *p_start, *p_len, *p_count;
-    UINT16  len;
-    UINT8   xx;
+    uint8_t *p_data, *p_start, *p_len, *p_count;
+    uint16_t len;
+    uint8_t xx;
 
     if (!p_rsp->p_vals)
     {
@@ -232,7 +232,7 @@
 
     AVRC_TRACE_API("%s", __func__);
     /* get the existing length, if any, and also the num attributes */
-    p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_data = p_len = p_start + 2; /* pdu + rsvd */
 
     BE_STREAM_TO_UINT16(len, p_data);
@@ -298,11 +298,11 @@
 *******************************************************************************/
 static tAVRC_STS avrc_bld_app_setting_text_rsp (tAVRC_GET_APP_ATTR_TXT_RSP *p_rsp, BT_HDR *p_pkt)
 {
-    UINT8   *p_data, *p_start, *p_len, *p_count;
-    UINT16  len, len_left;
-    UINT8   xx;
+    uint8_t *p_data, *p_start, *p_len, *p_count;
+    uint16_t len, len_left;
+    uint8_t xx;
     tAVRC_STS   sts = AVRC_STS_NO_ERROR;
-    UINT8       num_added = 0;
+    uint8_t     num_added = 0;
 
     if (!p_rsp->p_attrs)
     {
@@ -310,7 +310,7 @@
         return AVRC_STS_BAD_PARAM;
     }
     /* get the existing length, if any, and also the num attributes */
-    p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_data = p_len = p_start + 2; /* pdu + rsvd */
 
     /*
@@ -452,9 +452,9 @@
 *******************************************************************************/
 static tAVRC_STS avrc_bld_get_elem_attrs_rsp (tAVRC_GET_ELEM_ATTRS_RSP *p_rsp, BT_HDR *p_pkt)
 {
-    UINT8   *p_data, *p_start, *p_len, *p_count;
-    UINT16  len;
-    UINT8   xx;
+    uint8_t *p_data, *p_start, *p_len, *p_count;
+    uint16_t len;
+    uint8_t xx;
 
     AVRC_TRACE_API("%s", __func__);
     if (!p_rsp->p_attrs)
@@ -464,7 +464,7 @@
     }
 
     /* get the existing length, if any, and also the num attributes */
-    p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_data = p_len = p_start + 2; /* pdu + rsvd */
 
     BE_STREAM_TO_UINT16(len, p_data);
@@ -517,10 +517,10 @@
 *******************************************************************************/
 static tAVRC_STS avrc_bld_get_play_status_rsp (tAVRC_GET_PLAY_STATUS_RSP *p_rsp, BT_HDR *p_pkt)
 {
-    UINT8   *p_data, *p_start;
+    uint8_t *p_data, *p_start;
 
     AVRC_TRACE_API("avrc_bld_get_play_status_rsp");
-    p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_data = p_start + 2;
 
     /* add fixed lenth - song len(4) + song position(4) + status(1) */
@@ -545,15 +545,15 @@
 *******************************************************************************/
 static tAVRC_STS avrc_bld_notify_rsp (tAVRC_REG_NOTIF_RSP *p_rsp, BT_HDR *p_pkt)
 {
-    UINT8   *p_data, *p_start;
-    UINT8   *p_len;
-    UINT16  len = 0;
-    UINT8   xx;
+    uint8_t *p_data, *p_start;
+    uint8_t *p_len;
+    uint16_t len = 0;
+    uint8_t xx;
     tAVRC_STS status = AVRC_STS_NO_ERROR;
 
     AVRC_TRACE_API("%s event_id %d", __func__, p_rsp->event_id);
 
-    p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_data = p_len = p_start + 2; /* pdu + rsvd */
     p_data += 2;
 
@@ -561,7 +561,7 @@
     switch (p_rsp->event_id)
     {
     case AVRC_EVT_PLAY_STATUS_CHANGE:       /* 0x01 */
-        /* p_rsp->param.play_status >= AVRC_PLAYSTATE_STOPPED is always TRUE */
+        /* p_rsp->param.play_status >= AVRC_PLAYSTATE_STOPPED is always true */
         if ((p_rsp->param.play_status <= AVRC_PLAYSTATE_REV_SEEK) ||
             (p_rsp->param.play_status == AVRC_PLAYSTATE_ERROR) )
         {
@@ -577,7 +577,7 @@
 
     case AVRC_EVT_TRACK_CHANGE:             /* 0x02 */
         ARRAY_TO_BE_STREAM(p_data, p_rsp->param.track, AVRC_UID_SIZE);
-        len = (UINT8)(AVRC_UID_SIZE + 1);
+        len = (uint8_t)(AVRC_UID_SIZE + 1);
         break;
 
     case AVRC_EVT_TRACK_REACHED_END:        /* 0x03 */
@@ -694,9 +694,9 @@
 static tAVRC_STS avrc_bld_set_address_player_rsp(tAVRC_RSP *p_rsp, BT_HDR *p_pkt)
 {
     AVRC_TRACE_API("%s", __func__);
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     /* To calculate length */
-    UINT8 *p_data = p_start + 2;
+    uint8_t *p_data = p_start + 2;
     /* add fixed lenth status(1) */
     UINT16_TO_BE_STREAM(p_data, 1);
     UINT8_TO_BE_STREAM(p_data, p_rsp->status);
@@ -716,9 +716,9 @@
 static tAVRC_STS avrc_bld_play_item_rsp(tAVRC_RSP *p_rsp, BT_HDR *p_pkt)
 {
     AVRC_TRACE_API("%s", __func__);
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     /* To calculate length */
-    UINT8 *p_data = p_start + 2;
+    uint8_t *p_data = p_start + 2;
     /* add fixed lenth status(1) */
     UINT16_TO_BE_STREAM(p_data, 1);
     UINT8_TO_BE_STREAM(p_data, p_rsp->status);
@@ -738,9 +738,9 @@
 static tAVRC_STS avrc_bld_set_absolute_volume_rsp(uint8_t abs_vol, BT_HDR *p_pkt)
 {
     AVRC_TRACE_API("%s", __func__);
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     /* To calculate length */
-    UINT8 *p_data = p_start + 2;
+    uint8_t *p_data = p_start + 2;
     /* add fixed lenth status(1) */
     UINT16_TO_BE_STREAM(p_data, 1);
     UINT8_TO_BE_STREAM(p_data, abs_vol);
@@ -759,7 +759,7 @@
 **                  Otherwise, the error code.
 **
 *******************************************************************************/
-tAVRC_STS avrc_bld_group_navigation_rsp (UINT16 navi_id, BT_HDR *p_pkt)
+tAVRC_STS avrc_bld_group_navigation_rsp (uint16_t navi_id, BT_HDR *p_pkt)
 {
     if (!AVRC_IS_VALID_GROUP(navi_id))
     {
@@ -767,7 +767,7 @@
         return AVRC_STS_BAD_PARAM;
     }
     AVRC_TRACE_API("%s", __func__);
-    UINT8 *p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_data = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     UINT16_TO_BE_STREAM(p_data, navi_id);
     p_pkt->len = 2;
     return AVRC_STS_NO_ERROR;
@@ -786,8 +786,8 @@
 {
     AVRC_TRACE_API("%s: status=%d, pdu:x%x", __func__, p_rsp->status, p_rsp->pdu);
 
-    UINT8 *p_start = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
-    UINT8 *p_data = p_start + 2;
+    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
+    uint8_t *p_data = p_start + 2;
     AVRC_TRACE_DEBUG("%s pdu:x%x", __func__, *p_start);
 
     UINT16_TO_BE_STREAM(p_data, 1);
@@ -809,9 +809,9 @@
 *******************************************************************************/
 static BT_HDR *avrc_bld_init_rsp_buffer(tAVRC_RESPONSE *p_rsp)
 {
-    UINT16 offset = AVRC_MSG_PASS_THRU_OFFSET;
-    UINT16 chnl = AVCT_DATA_CTRL;
-    UINT8  opcode = avrc_opcode_from_pdu(p_rsp->pdu);
+    uint16_t offset = AVRC_MSG_PASS_THRU_OFFSET;
+    uint16_t chnl = AVCT_DATA_CTRL;
+    uint8_t opcode = avrc_opcode_from_pdu(p_rsp->pdu);
 
     AVRC_TRACE_API("%s: pdu=%x, opcode=%x/%x", __func__, p_rsp->pdu, opcode, p_rsp->rsp.opcode);
     if (opcode != p_rsp->rsp.opcode && p_rsp->rsp.status != AVRC_STS_NO_ERROR &&
@@ -834,12 +834,12 @@
 
     /* allocate and initialize the buffer */
     BT_HDR *p_pkt = (BT_HDR *)osi_malloc(BT_DEFAULT_BUFFER_SIZE);
-    UINT8 *p_data, *p_start;
+    uint8_t *p_data, *p_start;
 
     p_pkt->layer_specific = chnl;
     p_pkt->event    = opcode;
     p_pkt->offset   = offset;
-    p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p_data = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     p_start = p_data;
 
     /* pass thru - group navigation - has a two byte op_id, so dont do it here */
@@ -873,11 +873,11 @@
 **                  Otherwise, the error code.
 **
 *******************************************************************************/
-tAVRC_STS AVRC_BldResponse( UINT8 handle, tAVRC_RESPONSE *p_rsp, BT_HDR **pp_pkt)
+tAVRC_STS AVRC_BldResponse( uint8_t handle, tAVRC_RESPONSE *p_rsp, BT_HDR **pp_pkt)
 {
     tAVRC_STS status = AVRC_STS_BAD_PARAM;
     BT_HDR *p_pkt;
-    BOOLEAN alloc = FALSE;
+    bool    alloc = false;
     UNUSED(handle);
 
     if (!p_rsp || !pp_pkt)
@@ -894,7 +894,7 @@
             AVRC_TRACE_API("%s Failed to initialize response buffer", __func__);
             return AVRC_STS_INTERNAL_ERR;
         }
-        alloc = TRUE;
+        alloc = true;
     }
     status = AVRC_STS_NO_ERROR;
     p_pkt = *pp_pkt;
diff --git a/stack/avrc/avrc_int.h b/stack/avrc/avrc_int.h
index 661c64c..a80e696 100644
--- a/stack/avrc/avrc_int.h
+++ b/stack/avrc/avrc_int.h
@@ -74,8 +74,8 @@
 
 
 /* Company ID is 24-bit integer We can not use the macros in bt_types.h */
-#define AVRC_CO_ID_TO_BE_STREAM(p, u32) {*(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)(u32); }
-#define AVRC_BE_STREAM_TO_CO_ID(u32, p) {(u32) = (((UINT32)(*((p) + 2))) + (((UINT32)(*((p) + 1))) << 8) + (((UINT32)(*(p))) << 16)); (p) += 3;}
+#define AVRC_CO_ID_TO_BE_STREAM(p, u32) {*(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 8); *(p)++ = (uint8_t)(u32); }
+#define AVRC_BE_STREAM_TO_CO_ID(u32, p) {(u32) = (((uint32_t)(*((p) + 2))) + (((uint32_t)(*((p) + 1))) << 8) + (((uint32_t)(*(p))) << 16)); (p) += 3;}
 
 #define AVRC_AVC_HDR_SIZE           3   /* ctype, subunit*, opcode */
 
@@ -92,7 +92,7 @@
 
 #define AVRC_MIN_BROWSE_SIZE        (AVCT_BROWSE_OFFSET + BT_HDR_SIZE + AVRC_MIN_BROWSE_HDR_SIZE)
 
-#define AVRC_CTRL_PKT_LEN(pf, pk)   {(pf) = (UINT8 *)((pk) + 1) + (pk)->offset + 2;}
+#define AVRC_CTRL_PKT_LEN(pf, pk)   {(pf) = (uint8_t *)((pk) + 1) + (pk)->offset + 2;}
 
 #define AVRC_MAX_CTRL_DATA_LEN      (AVRC_PACKET_LEN)
 
@@ -105,16 +105,16 @@
 typedef struct
 {
     BT_HDR              *p_fmsg;        /* the fragmented message */
-    UINT8               frag_pdu;       /* the PDU ID for fragmentation */
-    BOOLEAN             frag_enabled;   /* fragmentation flag */
+    uint8_t             frag_pdu;       /* the PDU ID for fragmentation */
+    bool                frag_enabled;   /* fragmentation flag */
 } tAVRC_FRAG_CB;
 
 /* type for Metadata re-assembly control block */
 typedef struct
 {
     BT_HDR              *p_rmsg;        /* the received message */
-    UINT16              rasm_offset;    /* re-assembly flag, the offset of the start fragment */
-    UINT8               rasm_pdu;       /* the PDU ID for re-assembly */
+    uint16_t            rasm_offset;    /* re-assembly flag, the offset of the start fragment */
+    uint8_t             rasm_pdu;       /* the PDU ID for re-assembly */
 } tAVRC_RASM_CB;
 #endif
 
@@ -127,26 +127,26 @@
 #endif
     tAVRC_FIND_CBACK    *p_cback;       /* pointer to application callback */
     tSDP_DISCOVERY_DB   *p_db;          /* pointer to discovery database */
-    UINT16              service_uuid;   /* service UUID to search */
-    UINT8               trace_level;
+    uint16_t            service_uuid;   /* service UUID to search */
+    uint8_t             trace_level;
 } tAVRC_CB;
 
 /******************************************************************************
 ** Main Control Block
 *******************************************************************************/
-#if AVRC_DYNAMIC_MEMORY == FALSE
+#if (AVRC_DYNAMIC_MEMORY == FALSE)
 extern tAVRC_CB  avrc_cb;
 #else
 extern tAVRC_CB *avrc_cb_ptr;
 #define avrc_cb (*avrc_cb_ptr)
 #endif
 
-extern BOOLEAN avrc_is_valid_pdu_id(UINT8 pdu_id);
-extern BOOLEAN avrc_is_valid_player_attrib_value(UINT8 attrib, UINT8 value);
-extern BT_HDR * avrc_alloc_ctrl_pkt (UINT8 pdu);
-extern tAVRC_STS avrc_pars_pass_thru(tAVRC_MSG_PASS *p_msg, UINT16 *p_vendor_unique_id);
-extern UINT8 avrc_opcode_from_pdu(UINT8 pdu);
-extern BOOLEAN avrc_is_valid_opcode(UINT8 opcode);
+extern bool    avrc_is_valid_pdu_id(uint8_t pdu_id);
+extern bool    avrc_is_valid_player_attrib_value(uint8_t attrib, uint8_t value);
+extern BT_HDR * avrc_alloc_ctrl_pkt (uint8_t pdu);
+extern tAVRC_STS avrc_pars_pass_thru(tAVRC_MSG_PASS *p_msg, uint16_t *p_vendor_unique_id);
+extern uint8_t avrc_opcode_from_pdu(uint8_t pdu);
+extern bool    avrc_is_valid_opcode(uint8_t opcode);
 
 #ifdef __cplusplus
 }
diff --git a/stack/avrc/avrc_opt.c b/stack/avrc/avrc_opt.c
index 53b5bd3..25e58fe 100644
--- a/stack/avrc/avrc_opt.c
+++ b/stack/avrc/avrc_opt.c
@@ -47,11 +47,11 @@
 static BT_HDR  * avrc_vendor_msg(tAVRC_MSG_VENDOR *p_msg)
 {
     BT_HDR  *p_cmd;
-    UINT8   *p_data;
+    uint8_t *p_data;
 
     assert(p_msg != NULL);
 
-#if AVRC_METADATA_INCLUDED == TRUE
+#if (AVRC_METADATA_INCLUDED == TRUE)
     assert(AVRC_META_CMD_BUF_SIZE > (AVRC_MIN_CMD_LEN + p_msg->vendor_len));
     p_cmd = (BT_HDR *)osi_malloc(AVRC_META_CMD_BUF_SIZE);
 #else
@@ -60,14 +60,14 @@
 #endif
 
     p_cmd->offset = AVCT_MSG_OFFSET;
-    p_data = (UINT8 *)(p_cmd + 1) + p_cmd->offset;
+    p_data = (uint8_t *)(p_cmd + 1) + p_cmd->offset;
     *p_data++ = (p_msg->hdr.ctype & AVRC_CTYPE_MASK);
     *p_data++ = (p_msg->hdr.subunit_type << AVRC_SUBTYPE_SHIFT) | p_msg->hdr.subunit_id;
     *p_data++ = AVRC_OP_VENDOR;
     AVRC_CO_ID_TO_BE_STREAM(p_data, p_msg->company_id);
     if (p_msg->vendor_len && p_msg->p_vendor_data)
         memcpy(p_data, p_msg->p_vendor_data, p_msg->vendor_len);
-    p_cmd->len  = (UINT16)(p_data + p_msg->vendor_len - (UINT8 *)(p_cmd + 1) - p_cmd->offset);
+    p_cmd->len  = (uint16_t)(p_data + p_msg->vendor_len - (uint8_t *)(p_cmd + 1) - p_cmd->offset);
     p_cmd->layer_specific = AVCT_DATA_CTRL;
 
     return p_cmd;
@@ -94,19 +94,19 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-UINT16 AVRC_UnitCmd(UINT8 handle, UINT8 label)
+uint16_t AVRC_UnitCmd(uint8_t handle, uint8_t label)
 {
     BT_HDR  *p_cmd = (BT_HDR *)osi_malloc(AVRC_CMD_BUF_SIZE);
-    UINT8   *p_data;
+    uint8_t *p_data;
 
     p_cmd->offset = AVCT_MSG_OFFSET;
-    p_data = (UINT8 *)(p_cmd + 1) + p_cmd->offset;
+    p_data = (uint8_t *)(p_cmd + 1) + p_cmd->offset;
     *p_data++ = AVRC_CMD_STATUS;
     /* unit & id ignore */
     *p_data++ = (AVRC_SUB_UNIT << AVRC_SUBTYPE_SHIFT) | AVRC_SUBID_IGNORE;
     *p_data++ = AVRC_OP_UNIT_INFO;
     memset(p_data, AVRC_CMD_OPRND_PAD, AVRC_UNIT_OPRND_BYTES);
-    p_cmd->len = p_data + AVRC_UNIT_OPRND_BYTES - (UINT8 *)(p_cmd + 1) - p_cmd->offset;
+    p_cmd->len = p_data + AVRC_UNIT_OPRND_BYTES - (uint8_t *)(p_cmd + 1) - p_cmd->offset;
     p_cmd->layer_specific = AVCT_DATA_CTRL;
 
     return AVCT_MsgReq(handle, label, AVCT_CMD, p_cmd);
@@ -137,20 +137,20 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-UINT16 AVRC_SubCmd(UINT8 handle, UINT8 label, UINT8 page)
+uint16_t AVRC_SubCmd(uint8_t handle, uint8_t label, uint8_t page)
 {
     BT_HDR  *p_cmd = (BT_HDR *)osi_malloc(AVRC_CMD_BUF_SIZE);
-    UINT8   *p_data;
+    uint8_t *p_data;
 
     p_cmd->offset = AVCT_MSG_OFFSET;
-    p_data = (UINT8 *)(p_cmd + 1) + p_cmd->offset;
+    p_data = (uint8_t *)(p_cmd + 1) + p_cmd->offset;
     *p_data++ = AVRC_CMD_STATUS;
     /* unit & id ignore */
     *p_data++ = (AVRC_SUB_UNIT << AVRC_SUBTYPE_SHIFT) | AVRC_SUBID_IGNORE;
     *p_data++ = AVRC_OP_SUB_INFO;
     *p_data++ = ((page&AVRC_SUB_PAGE_MASK) << AVRC_SUB_PAGE_SHIFT) | AVRC_SUB_EXT_CODE;
     memset(p_data, AVRC_CMD_OPRND_PAD, AVRC_SUB_OPRND_BYTES);
-    p_cmd->len = p_data + AVRC_SUB_OPRND_BYTES - (UINT8 *)(p_cmd + 1) - p_cmd->offset;
+    p_cmd->len = p_data + AVRC_SUB_OPRND_BYTES - (uint8_t *)(p_cmd + 1) - p_cmd->offset;
     p_cmd->layer_specific = AVCT_DATA_CTRL;
 
     return AVCT_MsgReq(handle, label, AVCT_CMD, p_cmd);
@@ -179,7 +179,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-UINT16 AVRC_VendorCmd(UINT8  handle, UINT8  label, tAVRC_MSG_VENDOR *p_msg)
+uint16_t AVRC_VendorCmd(uint8_t handle, uint8_t label, tAVRC_MSG_VENDOR *p_msg)
 {
     BT_HDR *p_buf = avrc_vendor_msg(p_msg);
     if (p_buf)
@@ -214,7 +214,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-UINT16 AVRC_VendorRsp(UINT8  handle, UINT8  label, tAVRC_MSG_VENDOR *p_msg)
+uint16_t AVRC_VendorRsp(uint8_t handle, uint8_t label, tAVRC_MSG_VENDOR *p_msg)
 {
     BT_HDR *p_buf = avrc_vendor_msg(p_msg);
     if (p_buf)
diff --git a/stack/avrc/avrc_pars_ct.c b/stack/avrc/avrc_pars_ct.c
index c4dd2a8..fd58c77 100644
--- a/stack/avrc/avrc_pars_ct.c
+++ b/stack/avrc/avrc_pars_ct.c
@@ -43,10 +43,10 @@
 static tAVRC_STS avrc_pars_vendor_rsp(tAVRC_MSG_VENDOR *p_msg, tAVRC_RESPONSE *p_result)
 {
     tAVRC_STS  status = AVRC_STS_NO_ERROR;
-    UINT8   *p;
-    UINT16  len;
+    uint8_t *p;
+    uint16_t len;
 #if (AVRC_ADV_CTRL_INCLUDED == TRUE)
-    UINT8 eventid=0;
+    uint8_t eventid=0;
 #endif
 
     /* Check the vendor data */
@@ -106,7 +106,7 @@
     return status;
 }
 
-void avrc_parse_notification_rsp (UINT8 *p_stream, tAVRC_REG_NOTIF_RSP *p_rsp)
+void avrc_parse_notification_rsp (uint8_t *p_stream, tAVRC_REG_NOTIF_RSP *p_rsp)
 {
     BE_STREAM_TO_UINT8(p_rsp->event_id, p_stream);
     switch (p_rsp->event_id)
@@ -163,13 +163,13 @@
 **
 *******************************************************************************/
 static tAVRC_STS avrc_ctrl_pars_vendor_rsp(
-    tAVRC_MSG_VENDOR *p_msg, tAVRC_RESPONSE *p_result, UINT8* p_buf, UINT16* buf_len)
+    tAVRC_MSG_VENDOR *p_msg, tAVRC_RESPONSE *p_result, uint8_t* p_buf, uint16_t* buf_len)
 {
-    UINT8   *p = p_msg->p_vendor_data;
+    uint8_t *p = p_msg->p_vendor_data;
     BE_STREAM_TO_UINT8 (p_result->pdu, p);
     p++; /* skip the reserved/packe_type byte */
 
-    UINT16  len;
+    uint16_t len;
     BE_STREAM_TO_UINT16 (len, p);
     AVRC_TRACE_DEBUG("%s ctype:0x%x pdu:0x%x, len:%d",
                      __func__, p_msg->hdr.ctype, p_result->pdu, len);
@@ -270,7 +270,7 @@
     case AVRC_PDU_GET_PLAYER_APP_ATTR_TEXT:
     {
         tAVRC_APP_SETTING_TEXT   *p_setting_text;
-        UINT8                    num_attrs;
+        uint8_t                  num_attrs;
 
         if (len == 0)
         {
@@ -288,7 +288,7 @@
             BE_STREAM_TO_UINT8(p_result->get_app_attr_txt.p_attrs[xx].str_len, p);
             if (p_result->get_app_attr_txt.p_attrs[xx].str_len != 0)
             {
-                UINT8 *p_str = (UINT8 *)osi_malloc(p_result->get_app_attr_txt.p_attrs[xx].str_len);
+                uint8_t *p_str = (uint8_t *)osi_malloc(p_result->get_app_attr_txt.p_attrs[xx].str_len);
                 BE_STREAM_TO_ARRAY(p, p_str, p_result->get_app_attr_txt.p_attrs[xx].str_len);
                 p_result->get_app_attr_txt.p_attrs[xx].p_str = p_str;
             } else {
@@ -301,7 +301,7 @@
     case AVRC_PDU_GET_PLAYER_APP_VALUE_TEXT:
     {
         tAVRC_APP_SETTING_TEXT   *p_setting_text;
-        UINT8                    num_vals;
+        uint8_t                  num_vals;
 
         if (len == 0)
         {
@@ -318,7 +318,7 @@
             BE_STREAM_TO_UINT16(p_result->get_app_val_txt.p_attrs[i].charset_id, p);
             BE_STREAM_TO_UINT8(p_result->get_app_val_txt.p_attrs[i].str_len, p);
             if (p_result->get_app_val_txt.p_attrs[i].str_len != 0) {
-                UINT8 *p_str = (UINT8 *)osi_malloc(p_result->get_app_val_txt.p_attrs[i].str_len);
+                uint8_t *p_str = (uint8_t *)osi_malloc(p_result->get_app_val_txt.p_attrs[i].str_len);
                 BE_STREAM_TO_ARRAY(p, p_str, p_result->get_app_val_txt.p_attrs[i].str_len);
                 p_result->get_app_val_txt.p_attrs[i].p_str = p_str;
             } else {
@@ -334,7 +334,7 @@
 
     case AVRC_PDU_GET_ELEMENT_ATTR:
     {
-        UINT8               num_attrs;
+        uint8_t             num_attrs;
 
         if (len <= 0)
         {
@@ -352,7 +352,7 @@
                 BE_STREAM_TO_UINT16(p_attrs[i].name.charset_id, p);
                 BE_STREAM_TO_UINT16(p_attrs[i].name.str_len, p);
                 if (p_attrs[i].name.str_len > 0) {
-                    p_attrs[i].name.p_str = (UINT8 *)osi_malloc(p_attrs[i].name.str_len);
+                    p_attrs[i].name.p_str = (uint8_t *)osi_malloc(p_attrs[i].name.str_len);
                     BE_STREAM_TO_ARRAY(p, p_attrs[i].name.p_str, p_attrs[i].name.str_len);
                 }
             }
@@ -387,7 +387,7 @@
 **                  Otherwise, the error code defined by AVRCP 1.4
 **
 *******************************************************************************/
-tAVRC_STS AVRC_Ctrl_ParsResponse (tAVRC_MSG *p_msg, tAVRC_RESPONSE *p_result, UINT8 *p_buf, UINT16* buf_len)
+tAVRC_STS AVRC_Ctrl_ParsResponse (tAVRC_MSG *p_msg, tAVRC_RESPONSE *p_result, uint8_t *p_buf, uint16_t* buf_len)
 {
     tAVRC_STS  status = AVRC_STS_INTERNAL_ERR;
     if (p_msg && p_result)
@@ -418,10 +418,10 @@
 **                  Otherwise, the error code defined by AVRCP 1.4
 **
 *******************************************************************************/
-tAVRC_STS AVRC_ParsResponse (tAVRC_MSG *p_msg, tAVRC_RESPONSE *p_result, UINT8 *p_buf, UINT16 buf_len)
+tAVRC_STS AVRC_ParsResponse (tAVRC_MSG *p_msg, tAVRC_RESPONSE *p_result, uint8_t *p_buf, uint16_t buf_len)
 {
     tAVRC_STS  status = AVRC_STS_INTERNAL_ERR;
-    UINT16  id;
+    uint16_t id;
     UNUSED(p_buf);
     UNUSED(buf_len);
 
@@ -437,7 +437,7 @@
             status = avrc_pars_pass_thru(&p_msg->pass, &id);
             if (status == AVRC_STS_NO_ERROR)
             {
-                p_result->pdu = (UINT8)id;
+                p_result->pdu = (uint8_t)id;
             }
             break;
 
diff --git a/stack/avrc/avrc_pars_tg.c b/stack/avrc/avrc_pars_tg.c
index 05237e7..6727a92 100644
--- a/stack/avrc/avrc_pars_tg.c
+++ b/stack/avrc/avrc_pars_tg.c
@@ -43,7 +43,7 @@
 {
     tAVRC_STS  status = AVRC_STS_NO_ERROR;
 
-    UINT8   *p = p_msg->p_vendor_data;
+    uint8_t *p = p_msg->p_vendor_data;
     p_result->pdu = *p++;
     AVRC_TRACE_DEBUG("%s pdu:0x%x", __func__, p_result->pdu);
     if (!AVRC_IsValidAvcType (p_result->pdu, p_msg->hdr.ctype))
@@ -53,7 +53,7 @@
     }
 
     p++; /* skip the reserved byte */
-    UINT16  len;
+    uint16_t len;
     BE_STREAM_TO_UINT16 (len, p);
     if ((len+4) != (p_msg->vendor_len))
     {
@@ -100,17 +100,17 @@
 **
 *******************************************************************************/
 static tAVRC_STS avrc_pars_vendor_cmd(tAVRC_MSG_VENDOR *p_msg, tAVRC_COMMAND *p_result,
-                                      UINT8 *p_buf, UINT16 buf_len)
+                                      uint8_t *p_buf, uint16_t buf_len)
 {
     tAVRC_STS  status = AVRC_STS_NO_ERROR;
-    UINT8   *p;
-    UINT16  len;
-    UINT8   xx, yy;
-    UINT8   *p_u8;
-    UINT16  *p_u16;
-    UINT32  u32, u32_2, *p_u32;
+    uint8_t *p;
+    uint16_t len;
+    uint8_t xx, yy;
+    uint8_t *p_u8;
+    uint16_t *p_u16;
+    uint32_t u32, u32_2, *p_u32;
     tAVRC_APP_SETTING       *p_app_set;
-    UINT16  size_needed;
+    uint16_t size_needed;
 
     /* Check the vendor data */
     if (p_msg->vendor_len == 0)
@@ -370,7 +370,7 @@
         p_result->cmd.opcode = p_msg->hdr.opcode;
         p_result->cmd.status = status;
     }
-    AVRC_TRACE_DEBUG("%s return status:0x%x", __FUNCTION__, status);
+    AVRC_TRACE_DEBUG("%s return status:0x%x", __func__, status);
     return status;
 }
 #endif
@@ -385,10 +385,10 @@
 **                  Otherwise, the error code defined by AVRCP 1.4
 **
 *******************************************************************************/
-tAVRC_STS AVRC_ParsCommand (tAVRC_MSG *p_msg, tAVRC_COMMAND *p_result, UINT8 *p_buf, UINT16 buf_len)
+tAVRC_STS AVRC_ParsCommand (tAVRC_MSG *p_msg, tAVRC_COMMAND *p_result, uint8_t *p_buf, uint16_t buf_len)
 {
     tAVRC_STS  status = AVRC_STS_INTERNAL_ERR;
-    UINT16  id;
+    uint16_t id;
 
     if (p_msg && p_result)
     {
@@ -402,7 +402,7 @@
             status = avrc_pars_pass_thru(&p_msg->pass, &id);
             if (status == AVRC_STS_NO_ERROR)
             {
-                p_result->pdu = (UINT8)id;
+                p_result->pdu = (uint8_t)id;
             }
             break;
 
diff --git a/stack/avrc/avrc_sdp.c b/stack/avrc/avrc_sdp.c
index da26523..93017e8 100644
--- a/stack/avrc/avrc_sdp.c
+++ b/stack/avrc/avrc_sdp.c
@@ -28,17 +28,17 @@
 #include "avrc_int.h"
 
 #ifndef SDP_AVRCP_1_4
-#define SDP_AVRCP_1_4      TRUE
+#define SDP_AVRCP_1_4      true
 #endif
 
 #ifndef SDP_AVCTP_1_4
-#define SDP_AVCTP_1_4      TRUE
+#define SDP_AVCTP_1_4      true
 #endif
 
 /*****************************************************************************
 **  Global data
 *****************************************************************************/
-#if AVRC_DYNAMIC_MEMORY == FALSE
+#if (AVRC_DYNAMIC_MEMORY == FALSE)
 tAVRC_CB avrc_cb;
 #endif
 
@@ -57,7 +57,7 @@
 ** Returns          Nothing.
 **
 ******************************************************************************/
-static void avrc_sdp_cback(UINT16 status)
+static void avrc_sdp_cback(uint16_t status)
 {
     AVRC_TRACE_API("avrc_sdp_cback status: %d", status);
 
@@ -107,12 +107,12 @@
 **                                    perform the service search.
 **
 ******************************************************************************/
-UINT16 AVRC_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
+uint16_t AVRC_FindService(uint16_t service_uuid, BD_ADDR bd_addr,
                 tAVRC_SDP_DB_PARAMS *p_db, tAVRC_FIND_CBACK *p_cback)
 {
     tSDP_UUID   uuid_list;
-    BOOLEAN     result = TRUE;
-    UINT16      a2d_attr_list[] = {ATTR_ID_SERVICE_CLASS_ID_LIST, /* update AVRC_NUM_ATTR, if changed */
+    bool        result = true;
+    uint16_t    a2d_attr_list[] = {ATTR_ID_SERVICE_CLASS_ID_LIST, /* update AVRC_NUM_ATTR, if changed */
                                    ATTR_ID_PROTOCOL_DESC_LIST,
                                    ATTR_ID_BT_PROFILE_DESC_LIST,
                                    ATTR_ID_SERVICE_NAME,
@@ -142,7 +142,7 @@
     result = SDP_InitDiscoveryDb(p_db->p_db, p_db->db_len, 1, &uuid_list, p_db->num_attr,
                                  p_db->p_attrs);
 
-    if (result == TRUE)
+    if (result == true)
     {
         /* store service_uuid and discovery db pointer */
         avrc_cb.p_db = p_db->p_db;
@@ -191,17 +191,17 @@
 **                  AVRC_NO_RESOURCES if not enough resources to build the SDP record.
 **
 ******************************************************************************/
-UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
-                char *p_provider_name, UINT16 categories, UINT32 sdp_handle,
-                BOOLEAN browse_supported, UINT16 profile_version)
+uint16_t AVRC_AddRecord(uint16_t service_uuid, char *p_service_name,
+                char *p_provider_name, uint16_t categories, uint32_t sdp_handle,
+                bool    browse_supported, uint16_t profile_version)
 {
-    UINT16      browse_list[1];
-    BOOLEAN     result = TRUE;
-    UINT8       temp[8];
-    UINT8       *p;
-    UINT16      count = 1;
-    UINT8       index = 0;
-    UINT16      class_list[2];
+    uint16_t    browse_list[1];
+    bool        result = true;
+    uint8_t     temp[8];
+    uint8_t     *p;
+    uint16_t    count = 1;
+    uint8_t     index = 0;
+    uint16_t    class_list[2];
 
 
     AVRC_TRACE_API("AVRC_AddRecord uuid: %x", service_uuid);
@@ -257,20 +257,20 @@
     p = temp;
     UINT16_TO_BE_STREAM(p, categories);
     result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE,
-              (UINT32)2, (UINT8*)temp);
+              (uint32_t)2, (uint8_t*)temp);
 
     /* add provider name */
     if (p_provider_name != NULL)
     {
         result &= SDP_AddAttribute(sdp_handle, ATTR_ID_PROVIDER_NAME, TEXT_STR_DESC_TYPE,
-                    (UINT32)(strlen(p_provider_name)+1), (UINT8 *) p_provider_name);
+                    (uint32_t)(strlen(p_provider_name)+1), (uint8_t *) p_provider_name);
     }
 
     /* add service name */
     if (p_service_name != NULL)
     {
         result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SERVICE_NAME, TEXT_STR_DESC_TYPE,
-                    (UINT32)(strlen(p_service_name)+1), (UINT8 *) p_service_name);
+                    (uint32_t)(strlen(p_service_name)+1), (uint8_t *) p_service_name);
     }
 
     /* add browse group list */
@@ -304,7 +304,7 @@
 **                  the input parameter is 0xff.
 **
 ******************************************************************************/
-UINT8 AVRC_SetTraceLevel (UINT8 new_level)
+uint8_t AVRC_SetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         avrc_cb.trace_level = new_level;
diff --git a/stack/avrc/avrc_utils.c b/stack/avrc/avrc_utils.c
index b381e84..7d1d98b 100644
--- a/stack/avrc/avrc_utils.c
+++ b/stack/avrc/avrc_utils.c
@@ -30,13 +30,13 @@
 **
 ** Description      Check if correct AVC type is specified
 **
-** Returns          returns TRUE if it is valid
+** Returns          returns true if it is valid
 **
 **
 *******************************************************************************/
-BOOLEAN AVRC_IsValidAvcType(UINT8 pdu_id, UINT8 avc_type)
+bool    AVRC_IsValidAvcType(uint8_t pdu_id, uint8_t avc_type)
 {
-    BOOLEAN result=FALSE;
+    bool    result=false;
 
     if (avc_type < AVRC_RSP_NOT_IMPL) /* command msg */
     {
@@ -51,7 +51,7 @@
         case AVRC_PDU_GET_ELEMENT_ATTR:            /* 0x20 */
         case AVRC_PDU_GET_PLAY_STATUS:             /* 0x30 */
              if (avc_type == AVRC_CMD_STATUS)
-                result=TRUE;
+                result=true;
              break;
 
         case AVRC_PDU_SET_PLAYER_APP_VALUE:        /* 0x14 */
@@ -63,12 +63,12 @@
         case AVRC_PDU_PLAY_ITEM:
         case AVRC_PDU_SET_ABSOLUTE_VOLUME:
              if (avc_type == AVRC_CMD_CTRL)
-                result=TRUE;
+                result=true;
              break;
 
         case AVRC_PDU_REGISTER_NOTIFICATION:       /* 0x31 */
              if (avc_type == AVRC_CMD_NOTIF)
-                result=TRUE;
+                result=true;
              break;
         }
     }
@@ -76,7 +76,7 @@
     {
         if (avc_type >= AVRC_RSP_NOT_IMPL  &&
            avc_type <= AVRC_RSP_INTERIM    )
-           result=TRUE;
+           result=true;
     }
 
     return result;
@@ -88,37 +88,37 @@
 **
 ** Description      Check if the given attrib value is valid for its attribute
 **
-** Returns          returns TRUE if it is valid
+** Returns          returns true if it is valid
 **
 *******************************************************************************/
-BOOLEAN avrc_is_valid_player_attrib_value(UINT8 attrib, UINT8 value)
+bool    avrc_is_valid_player_attrib_value(uint8_t attrib, uint8_t value)
 {
-    BOOLEAN result=FALSE;
+    bool    result=false;
 
     switch(attrib)
     {
     case AVRC_PLAYER_SETTING_EQUALIZER:
          if ((value > 0)  &&
             (value <= AVRC_PLAYER_VAL_ON))
-            result=TRUE;
+            result=true;
          break;
 
     case AVRC_PLAYER_SETTING_REPEAT:
          if ((value > 0)  &&
             (value <= AVRC_PLAYER_VAL_GROUP_REPEAT))
-            result=TRUE;
+            result=true;
          break;
 
     case AVRC_PLAYER_SETTING_SHUFFLE:
     case AVRC_PLAYER_SETTING_SCAN:
          if ((value > 0)  &&
             (value <= AVRC_PLAYER_VAL_GROUP_SHUFFLE))
-            result=TRUE;
+            result=true;
          break;
     }
 
     if (attrib >= AVRC_PLAYER_SETTING_LOW_MENU_EXT)
-       result = TRUE;
+       result = true;
 
     if (!result)
         AVRC_TRACE_ERROR(
@@ -134,17 +134,17 @@
 **
 ** Description      Check if the given attrib value is a valid one
 **
-** Returns          returns TRUE if it is valid
+** Returns          returns true if it is valid
 **
 *******************************************************************************/
-BOOLEAN AVRC_IsValidPlayerAttr(UINT8 attr)
+bool    AVRC_IsValidPlayerAttr(uint8_t attr)
 {
-    BOOLEAN result=FALSE;
+    bool    result=false;
 
     if ( (attr >= AVRC_PLAYER_SETTING_EQUALIZER && attr <= AVRC_PLAYER_SETTING_SCAN) ||
          (attr >= AVRC_PLAYER_SETTING_LOW_MENU_EXT) )
     {
-       result = TRUE;
+       result = true;
     }
 
     return result;
@@ -163,11 +163,11 @@
 **                  Otherwise, the error code defined by AVRCP 1.4
 **
 *******************************************************************************/
-tAVRC_STS avrc_pars_pass_thru(tAVRC_MSG_PASS *p_msg, UINT16 *p_vendor_unique_id)
+tAVRC_STS avrc_pars_pass_thru(tAVRC_MSG_PASS *p_msg, uint16_t *p_vendor_unique_id)
 {
-    UINT8      *p_data;
-    UINT32      co_id;
-    UINT16      id;
+    uint8_t    *p_data;
+    uint32_t    co_id;
+    uint16_t    id;
     tAVRC_STS  status = AVRC_STS_BAD_CMD;
 
     if (p_msg->op_id == AVRC_ID_VENDOR && p_msg->pass_len == AVRC_PASS_THRU_GROUP_LEN)
@@ -196,9 +196,9 @@
 ** Returns          AVRC_OP_VENDOR, AVRC_OP_PASS_THRU or AVRC_OP_BROWSE
 **
 *******************************************************************************/
-UINT8 avrc_opcode_from_pdu(UINT8 pdu)
+uint8_t avrc_opcode_from_pdu(uint8_t pdu)
 {
-    UINT8 opcode = 0;
+    uint8_t opcode = 0;
 
     switch (pdu)
     {
@@ -224,15 +224,15 @@
 ** Returns          AVRC_OP_VENDOR, AVRC_OP_PASS_THRU or AVRC_OP_BROWSE
 **
 *******************************************************************************/
-BOOLEAN avrc_is_valid_opcode(UINT8 opcode)
+bool    avrc_is_valid_opcode(uint8_t opcode)
 {
-    BOOLEAN is_valid = FALSE;
+    bool    is_valid = false;
     switch (opcode)
     {
     case AVRC_OP_BROWSE:
     case AVRC_OP_PASS_THRU:
     case AVRC_OP_VENDOR:
-        is_valid = TRUE;
+        is_valid = true;
         break;
     }
     return is_valid;
diff --git a/stack/bnep/bnep_api.c b/stack/bnep/bnep_api.c
index 9a7b5d9..a54ab1e 100644
--- a/stack/bnep/bnep_api.c
+++ b/stack/bnep/bnep_api.c
@@ -82,7 +82,7 @@
     if (bnep_register_with_l2cap ())
         return BNEP_SECURITY_FAIL;
 
-    bnep_cb.profile_registered  = TRUE;
+    bnep_cb.profile_registered  = true;
     return BNEP_SUCCESS;
 }
 
@@ -110,7 +110,7 @@
     bnep_cb.p_filter_ind_cb     = NULL;
     bnep_cb.p_mfilter_ind_cb    = NULL;
 
-    bnep_cb.profile_registered  = FALSE;
+    bnep_cb.profile_registered  = false;
     L2CA_Deregister (BT_PSM_BNEP);
 }
 
@@ -134,9 +134,9 @@
 tBNEP_RESULT BNEP_Connect (BD_ADDR p_rem_bda,
                            tBT_UUID *src_uuid,
                            tBT_UUID *dst_uuid,
-                           UINT16 *p_handle)
+                           uint16_t *p_handle)
 {
-    UINT16          cid;
+    uint16_t        cid;
     tBNEP_CONN      *p_bcb = bnepu_find_bcb_by_bd_addr (p_rem_bda);
 
     BNEP_TRACE_API ("BNEP_Connect()  BDA: %02x-%02x-%02x-%02x-%02x-%02x",
@@ -160,15 +160,15 @@
     else
     {
         /* Backup current UUID values to restore if role change fails */
-        memcpy ((UINT8 *)&(p_bcb->prv_src_uuid), (UINT8 *)&(p_bcb->src_uuid), sizeof (tBT_UUID));
-        memcpy ((UINT8 *)&(p_bcb->prv_dst_uuid), (UINT8 *)&(p_bcb->dst_uuid), sizeof (tBT_UUID));
+        memcpy ((uint8_t *)&(p_bcb->prv_src_uuid), (uint8_t *)&(p_bcb->src_uuid), sizeof (tBT_UUID));
+        memcpy ((uint8_t *)&(p_bcb->prv_dst_uuid), (uint8_t *)&(p_bcb->dst_uuid), sizeof (tBT_UUID));
     }
 
     /* We are the originator of this connection */
     p_bcb->con_flags |= BNEP_FLAGS_IS_ORIG;
 
-    memcpy ((UINT8 *)&(p_bcb->src_uuid), (UINT8 *)src_uuid, sizeof (tBT_UUID));
-    memcpy ((UINT8 *)&(p_bcb->dst_uuid), (UINT8 *)dst_uuid, sizeof (tBT_UUID));
+    memcpy ((uint8_t *)&(p_bcb->src_uuid), (uint8_t *)src_uuid, sizeof (tBT_UUID));
+    memcpy ((uint8_t *)&(p_bcb->dst_uuid), (uint8_t *)dst_uuid, sizeof (tBT_UUID));
 
     if (p_bcb->con_state == BNEP_STATE_CONNECTED)
     {
@@ -178,8 +178,8 @@
         BNEP_TRACE_API ("BNEP initiating security procedures for src uuid 0x%x",
             p_bcb->src_uuid.uu.uuid16);
 
-#if (defined (BNEP_DO_AUTH_FOR_ROLE_SWITCH) && BNEP_DO_AUTH_FOR_ROLE_SWITCH == TRUE)
-        btm_sec_mx_access_request (p_bcb->rem_bda, BT_PSM_BNEP, TRUE,
+#if (BNEP_DO_AUTH_FOR_ROLE_SWITCH == TRUE)
+        btm_sec_mx_access_request (p_bcb->rem_bda, BT_PSM_BNEP, true,
                                    BTM_SEC_PROTO_BNEP,
                                    bnep_get_uuid32(src_uuid),
                                    &bnep_sec_check_complete, p_bcb);
@@ -202,7 +202,7 @@
         {
             BNEP_TRACE_ERROR ("BNEP - Originate failed");
             if (bnep_cb.p_conn_state_cb)
-                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED, FALSE);
+                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED, false);
             bnepu_release_bcb (p_bcb);
             return BNEP_CONN_FAILED;
         }
@@ -233,10 +233,10 @@
 **                  BNEP_WRONG_STATE            if the responce is not expected
 **
 *******************************************************************************/
-tBNEP_RESULT BNEP_ConnectResp (UINT16 handle, tBNEP_RESULT resp)
+tBNEP_RESULT BNEP_ConnectResp (uint16_t handle, tBNEP_RESULT resp)
 {
     tBNEP_CONN      *p_bcb;
-    UINT16          resp_code = BNEP_SETUP_CONN_OK;
+    uint16_t        resp_code = BNEP_SETUP_CONN_OK;
 
     if ((!handle) || (handle > BNEP_MAX_CONNECTIONS))
         return (BNEP_WRONG_HANDLE);
@@ -267,18 +267,18 @@
         p_bcb->con_state = BNEP_STATE_CONNECTED;
         p_bcb->con_flags &= (~BNEP_FLAGS_SETUP_RCVD);
 
-        memcpy ((UINT8 *)&(p_bcb->src_uuid), (UINT8 *)&(p_bcb->prv_src_uuid), sizeof (tBT_UUID));
-        memcpy ((UINT8 *)&(p_bcb->dst_uuid), (UINT8 *)&(p_bcb->prv_dst_uuid), sizeof (tBT_UUID));
+        memcpy ((uint8_t *)&(p_bcb->src_uuid), (uint8_t *)&(p_bcb->prv_src_uuid), sizeof (tBT_UUID));
+        memcpy ((uint8_t *)&(p_bcb->dst_uuid), (uint8_t *)&(p_bcb->prv_dst_uuid), sizeof (tBT_UUID));
     }
 
     /* Process remaining part of the setup message (extension headers) */
     if (p_bcb->p_pending_data)
     {
-        UINT8   extension_present = TRUE, *p, ext_type;
-        UINT16  rem_len;
+        uint8_t extension_present = true, *p, ext_type;
+        uint16_t rem_len;
 
         rem_len = p_bcb->p_pending_data->len;
-        p       = (UINT8 *)(p_bcb->p_pending_data + 1) + p_bcb->p_pending_data->offset;
+        p       = (uint8_t *)(p_bcb->p_pending_data + 1) + p_bcb->p_pending_data->offset;
         while (extension_present && p && rem_len)
         {
             ext_type = *p++;
@@ -289,7 +289,7 @@
             if (ext_type)
                 break;
 
-            p = bnep_process_control_packet (p_bcb, p, &rem_len, TRUE);
+            p = bnep_process_control_packet (p_bcb, p, &rem_len, true);
         }
 
         osi_free_and_reset((void **)&p_bcb->p_pending_data);
@@ -310,7 +310,7 @@
 **                  BNEP_WRONG_HANDLE           if no connection is not found
 **
 *******************************************************************************/
-tBNEP_RESULT BNEP_Disconnect (UINT16 handle)
+tBNEP_RESULT BNEP_Disconnect (uint16_t handle)
 {
     tBNEP_CONN      *p_bcb;
 
@@ -353,15 +353,15 @@
 **                  BNEP_SUCCESS            - If written successfully
 **
 *******************************************************************************/
-tBNEP_RESULT BNEP_WriteBuf (UINT16 handle,
-                            UINT8 *p_dest_addr,
+tBNEP_RESULT BNEP_WriteBuf (uint16_t handle,
+                            uint8_t *p_dest_addr,
                             BT_HDR *p_buf,
-                            UINT16 protocol,
-                            UINT8 *p_src_addr,
-                            BOOLEAN fw_ext_present)
+                            uint16_t protocol,
+                            uint8_t *p_src_addr,
+                            bool    fw_ext_present)
 {
     tBNEP_CONN      *p_bcb;
-    UINT8           *p_data;
+    uint8_t         *p_data;
 
     if ((!handle) || (handle > BNEP_MAX_CONNECTIONS))
     {
@@ -379,7 +379,7 @@
     }
 
     /* Check if the packet should be filtered out */
-    p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
     if (bnep_is_packet_allowed (p_bcb, p_dest_addr, protocol, fw_ext_present, p_data) != BNEP_SUCCESS)
     {
         /*
@@ -388,8 +388,8 @@
         */
         if (fw_ext_present)
         {
-            UINT8       ext, length;
-            UINT16      org_len, new_len;
+            uint8_t     ext, length;
+            uint16_t    org_len, new_len;
             /* parse the extension headers and findout the new packet len */
             org_len = p_buf->len;
             new_len = 0;
@@ -465,16 +465,16 @@
 **                  BNEP_SUCCESS            - If written successfully
 **
 *******************************************************************************/
-tBNEP_RESULT  BNEP_Write (UINT16 handle,
-                          UINT8 *p_dest_addr,
-                          UINT8 *p_data,
-                          UINT16 len,
-                          UINT16 protocol,
-                          UINT8 *p_src_addr,
-                          BOOLEAN fw_ext_present)
+tBNEP_RESULT  BNEP_Write (uint16_t handle,
+                          uint8_t *p_dest_addr,
+                          uint8_t *p_data,
+                          uint16_t len,
+                          uint16_t protocol,
+                          uint8_t *p_src_addr,
+                          bool    fw_ext_present)
 {
     tBNEP_CONN   *p_bcb;
-    UINT8        *p;
+    uint8_t      *p;
 
     /* Check MTU size. Consider the possibility of having extension headers */
     if (len > BNEP_MTU_SIZE)
@@ -497,8 +497,8 @@
         */
         if (fw_ext_present)
         {
-            UINT8       ext, length;
-            UINT16      org_len, new_len;
+            uint8_t     ext, length;
+            uint16_t    org_len, new_len;
             /* parse the extension headers and findout the new packet len */
             org_len = len;
             new_len = 0;
@@ -540,7 +540,7 @@
 
     p_buf->len = len;
     p_buf->offset = BNEP_MINIMUM_OFFSET;
-    p = (UINT8 *)(p_buf + 1) + BNEP_MINIMUM_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + BNEP_MINIMUM_OFFSET;
 
     memcpy (p, p_data, len);
 
@@ -571,12 +571,12 @@
 **                  BNEP_SUCCESS                - if request sent successfully
 **
 *******************************************************************************/
-tBNEP_RESULT BNEP_SetProtocolFilters (UINT16 handle,
-                                      UINT16 num_filters,
-                                      UINT16 *p_start_array,
-                                      UINT16 *p_end_array)
+tBNEP_RESULT BNEP_SetProtocolFilters (uint16_t handle,
+                                      uint16_t num_filters,
+                                      uint16_t *p_start_array,
+                                      uint16_t *p_end_array)
 {
-    UINT16          xx;
+    uint16_t        xx;
     tBNEP_CONN     *p_bcb;
 
     if ((!handle) || (handle > BNEP_MAX_CONNECTIONS))
@@ -630,12 +630,12 @@
 **                  BNEP_SUCCESS                - if request sent successfully
 **
 *******************************************************************************/
-tBNEP_RESULT BNEP_SetMulticastFilters (UINT16 handle,
-                                       UINT16 num_filters,
-                                       UINT8 *p_start_array,
-                                       UINT8 *p_end_array)
+tBNEP_RESULT BNEP_SetMulticastFilters (uint16_t handle,
+                                       uint16_t num_filters,
+                                       uint8_t *p_start_array,
+                                       uint8_t *p_end_array)
 {
-    UINT16          xx;
+    uint16_t        xx;
     tBNEP_CONN     *p_bcb;
 
     if ((!handle) || (handle > BNEP_MAX_CONNECTIONS))
@@ -682,7 +682,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-UINT8 BNEP_SetTraceLevel (UINT8 new_level)
+uint8_t BNEP_SetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         bnep_cb.trace_level = new_level;
@@ -703,9 +703,9 @@
 **                  BNEP_WRONG_STATE        - if not in connected state
 **
 *******************************************************************************/
-tBNEP_RESULT BNEP_GetStatus (UINT16 handle, tBNEP_STATUS *p_status)
+tBNEP_RESULT BNEP_GetStatus (uint16_t handle, tBNEP_STATUS *p_status)
 {
-#if (defined (BNEP_SUPPORTS_STATUS_API) && BNEP_SUPPORTS_STATUS_API == TRUE)
+#if (BNEP_SUPPORTS_STATUS_API == TRUE)
     tBNEP_CONN     *p_bcb;
 
     if (!p_status)
diff --git a/stack/bnep/bnep_int.h b/stack/bnep/bnep_int.h
index b27c9dd..f0512ee 100644
--- a/stack/bnep/bnep_int.h
+++ b/stack/bnep/bnep_int.h
@@ -120,7 +120,7 @@
 #define BNEP_STATE_SEC_CHECKING      4
 #define BNEP_STATE_SETUP_RCVD        5
 #define BNEP_STATE_CONNECTED         6
-    UINT8             con_state;
+    uint8_t           con_state;
 
 #define BNEP_FLAGS_IS_ORIG           0x01
 #define BNEP_FLAGS_HIS_CFG_DONE      0x02
@@ -130,34 +130,34 @@
 #define BNEP_FLAGS_MULTI_RESP_PEND   0x20
 #define BNEP_FLAGS_SETUP_RCVD        0x40
 #define BNEP_FLAGS_CONN_COMPLETED    0x80
-    UINT8             con_flags;
+    uint8_t           con_flags;
     BT_HDR            *p_pending_data;
 
-    UINT16            l2cap_cid;
+    uint16_t          l2cap_cid;
     BD_ADDR           rem_bda;
-    UINT16            rem_mtu_size;
+    uint16_t          rem_mtu_size;
     alarm_t           *conn_timer;
     fixed_queue_t     *xmit_q;
 
-    UINT16            sent_num_filters;
-    UINT16            sent_prot_filter_start[BNEP_MAX_PROT_FILTERS];
-    UINT16            sent_prot_filter_end[BNEP_MAX_PROT_FILTERS];
+    uint16_t          sent_num_filters;
+    uint16_t          sent_prot_filter_start[BNEP_MAX_PROT_FILTERS];
+    uint16_t          sent_prot_filter_end[BNEP_MAX_PROT_FILTERS];
 
-    UINT16            sent_mcast_filters;
+    uint16_t          sent_mcast_filters;
     BD_ADDR           sent_mcast_filter_start[BNEP_MAX_MULTI_FILTERS];
     BD_ADDR           sent_mcast_filter_end[BNEP_MAX_MULTI_FILTERS];
 
-    UINT16            rcvd_num_filters;
-    UINT16            rcvd_prot_filter_start[BNEP_MAX_PROT_FILTERS];
-    UINT16            rcvd_prot_filter_end[BNEP_MAX_PROT_FILTERS];
+    uint16_t          rcvd_num_filters;
+    uint16_t          rcvd_prot_filter_start[BNEP_MAX_PROT_FILTERS];
+    uint16_t          rcvd_prot_filter_end[BNEP_MAX_PROT_FILTERS];
 
-    UINT16            rcvd_mcast_filters;
+    uint16_t          rcvd_mcast_filters;
     BD_ADDR           rcvd_mcast_filter_start[BNEP_MAX_MULTI_FILTERS];
     BD_ADDR           rcvd_mcast_filter_end[BNEP_MAX_MULTI_FILTERS];
 
-    UINT16            bad_pkts_rcvd;
-    UINT8             re_transmits;
-    UINT16            handle;
+    uint16_t          bad_pkts_rcvd;
+    uint8_t           re_transmits;
+    uint16_t          handle;
     tBT_UUID          prv_src_uuid;
     tBT_UUID          prv_dst_uuid;
     tBT_UUID          src_uuid;
@@ -183,14 +183,14 @@
 
     tL2CAP_APPL_INFO        reg_info;
 
-    BOOLEAN                 profile_registered;             /* TRUE when we got our BD addr */
-    UINT8                   trace_level;
+    bool                    profile_registered;             /* true when we got our BD addr */
+    uint8_t                 trace_level;
 
 } tBNEP_CB;
 
 /* Global BNEP data
 */
-#if BNEP_DYNAMIC_MEMORY == FALSE
+#if (BNEP_DYNAMIC_MEMORY == FALSE)
 extern tBNEP_CB  bnep_cb;
 #else
 extern tBNEP_CB  *bnep_cb_ptr;
@@ -200,43 +200,43 @@
 /* Functions provided by bnep_main.c
 */
 extern tBNEP_RESULT bnep_register_with_l2cap (void);
-extern void        bnep_disconnect (tBNEP_CONN *p_bcb, UINT16 reason);
-extern tBNEP_CONN *bnep_conn_originate (UINT8 *p_bd_addr);
+extern void        bnep_disconnect (tBNEP_CONN *p_bcb, uint16_t reason);
+extern tBNEP_CONN *bnep_conn_originate (uint8_t *p_bd_addr);
 extern void        bnep_conn_timer_timeout(void *data);
 extern void        bnep_connected (tBNEP_CONN *p_bcb);
 
 
 /* Functions provided by bnep_utils.c
 */
-extern tBNEP_CONN *bnepu_find_bcb_by_cid (UINT16 cid);
-extern tBNEP_CONN *bnepu_find_bcb_by_bd_addr (UINT8 *p_bda);
+extern tBNEP_CONN *bnepu_find_bcb_by_cid (uint16_t cid);
+extern tBNEP_CONN *bnepu_find_bcb_by_bd_addr (uint8_t *p_bda);
 extern tBNEP_CONN *bnepu_allocate_bcb (BD_ADDR p_rem_bda);
 extern void        bnepu_release_bcb (tBNEP_CONN *p_bcb);
 extern void        bnepu_send_peer_our_filters (tBNEP_CONN *p_bcb);
 extern void        bnepu_send_peer_our_multi_filters (tBNEP_CONN *p_bcb);
-extern BOOLEAN     bnepu_does_dest_support_prot (tBNEP_CONN *p_bcb, UINT16 protocol);
-extern void        bnepu_build_bnep_hdr (tBNEP_CONN *p_bcb, BT_HDR *p_buf, UINT16 protocol,
-                                         UINT8 *p_src_addr, UINT8 *p_dest_addr, BOOLEAN ext_bit);
-extern void        test_bnepu_build_bnep_hdr (tBNEP_CONN *p_bcb, BT_HDR *p_buf, UINT16 protocol,
-                                         UINT8 *p_src_addr, UINT8 *p_dest_addr, UINT8 type);
+extern bool        bnepu_does_dest_support_prot (tBNEP_CONN *p_bcb, uint16_t protocol);
+extern void        bnepu_build_bnep_hdr (tBNEP_CONN *p_bcb, BT_HDR *p_buf, uint16_t protocol,
+                                         uint8_t *p_src_addr, uint8_t *p_dest_addr, bool    ext_bit);
+extern void        test_bnepu_build_bnep_hdr (tBNEP_CONN *p_bcb, BT_HDR *p_buf, uint16_t protocol,
+                                         uint8_t *p_src_addr, uint8_t *p_dest_addr, uint8_t type);
 
-extern tBNEP_CONN *bnepu_get_route_to_dest (UINT8 *p_bda);
+extern tBNEP_CONN *bnepu_get_route_to_dest (uint8_t *p_bda);
 extern void        bnepu_check_send_packet (tBNEP_CONN *p_bcb, BT_HDR *p_buf);
-extern void        bnep_send_command_not_understood (tBNEP_CONN *p_bcb, UINT8 cmd_code);
-extern void        bnepu_process_peer_filter_set (tBNEP_CONN *p_bcb, UINT8 *p_filters, UINT16 len);
-extern void        bnepu_process_peer_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data);
-extern void        bnepu_process_multicast_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data);
+extern void        bnep_send_command_not_understood (tBNEP_CONN *p_bcb, uint8_t cmd_code);
+extern void        bnepu_process_peer_filter_set (tBNEP_CONN *p_bcb, uint8_t *p_filters, uint16_t len);
+extern void        bnepu_process_peer_filter_rsp (tBNEP_CONN *p_bcb, uint8_t *p_data);
+extern void        bnepu_process_multicast_filter_rsp (tBNEP_CONN *p_bcb, uint8_t *p_data);
 extern void        bnep_send_conn_req (tBNEP_CONN *p_bcb);
-extern void        bnep_send_conn_responce (tBNEP_CONN *p_bcb, UINT16 resp_code);
-extern void        bnep_process_setup_conn_req (tBNEP_CONN *p_bcb, UINT8 *p_setup, UINT8 len);
-extern void        bnep_process_setup_conn_responce (tBNEP_CONN *p_bcb, UINT8 *p_setup);
-extern UINT8       *bnep_process_control_packet (tBNEP_CONN *p_bcb, UINT8 *p, UINT16 *len,
-                                                        BOOLEAN is_ext);
+extern void        bnep_send_conn_responce (tBNEP_CONN *p_bcb, uint16_t resp_code);
+extern void        bnep_process_setup_conn_req (tBNEP_CONN *p_bcb, uint8_t *p_setup, uint8_t len);
+extern void        bnep_process_setup_conn_responce (tBNEP_CONN *p_bcb, uint8_t *p_setup);
+extern uint8_t     *bnep_process_control_packet (tBNEP_CONN *p_bcb, uint8_t *p, uint16_t *len,
+                                                        bool    is_ext);
 extern void        bnep_sec_check_complete (BD_ADDR bd_addr, tBT_TRANSPORT trasnport,
-                                                    void *p_ref_data, UINT8 result);
-extern tBNEP_RESULT bnep_is_packet_allowed (tBNEP_CONN *p_bcb, BD_ADDR p_dest_addr, UINT16 protocol,
-                                                    BOOLEAN fw_ext_present, UINT8 *p_data);
-extern UINT32      bnep_get_uuid32 (tBT_UUID *src_uuid);
+                                                    void *p_ref_data, uint8_t result);
+extern tBNEP_RESULT bnep_is_packet_allowed (tBNEP_CONN *p_bcb, BD_ADDR p_dest_addr, uint16_t protocol,
+                                                    bool    fw_ext_present, uint8_t *p_data);
+extern uint32_t    bnep_get_uuid32 (tBT_UUID *src_uuid);
 
 
 
diff --git a/stack/bnep/bnep_main.c b/stack/bnep/bnep_main.c
index 078a72e..8be358f 100644
--- a/stack/bnep/bnep_main.c
+++ b/stack/bnep/bnep_main.c
@@ -51,23 +51,23 @@
 /********************************************************************************/
 /*                       G L O B A L    B N E P       D A T A                   */
 /********************************************************************************/
-#if BNEP_DYNAMIC_MEMORY == FALSE
+#if (BNEP_DYNAMIC_MEMORY == FALSE)
 tBNEP_CB   bnep_cb;
 #endif
 
-const UINT16 bnep_frame_hdr_sizes[] = {14, 1, 2, 8, 8};
+const uint16_t bnep_frame_hdr_sizes[] = {14, 1, 2, 8, 8};
 
 /********************************************************************************/
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
-static void bnep_connect_ind (BD_ADDR  bd_addr, UINT16 l2cap_cid, UINT16 psm, UINT8 l2cap_id);
-static void bnep_connect_cfm (UINT16 l2cap_cid, UINT16 result);
-static void bnep_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
-static void bnep_config_cfm (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
-static void bnep_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed);
-static void bnep_disconnect_cfm (UINT16 l2cap_cid, UINT16 result);
-static void bnep_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg);
-static void bnep_congestion_ind (UINT16 lcid, BOOLEAN is_congested);
+static void bnep_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid, uint16_t psm, uint8_t l2cap_id);
+static void bnep_connect_cfm (uint16_t l2cap_cid, uint16_t result);
+static void bnep_config_ind (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
+static void bnep_config_cfm (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
+static void bnep_disconnect_ind (uint16_t l2cap_cid, bool    ack_needed);
+static void bnep_disconnect_cfm (uint16_t l2cap_cid, uint16_t result);
+static void bnep_data_ind (uint16_t l2cap_cid, BT_HDR *p_msg);
+static void bnep_congestion_ind (uint16_t lcid, bool    is_congested);
 
 
 /*******************************************************************************
@@ -84,9 +84,9 @@
     /* Initialize the L2CAP configuration. We only care about MTU and flush */
     memset(&bnep_cb.l2cap_my_cfg, 0, sizeof(tL2CAP_CFG_INFO));
 
-    bnep_cb.l2cap_my_cfg.mtu_present            = TRUE;
+    bnep_cb.l2cap_my_cfg.mtu_present            = true;
     bnep_cb.l2cap_my_cfg.mtu                    = BNEP_MTU_SIZE;
-    bnep_cb.l2cap_my_cfg.flush_to_present       = TRUE;
+    bnep_cb.l2cap_my_cfg.flush_to_present       = true;
     bnep_cb.l2cap_my_cfg.flush_to               = BNEP_FLUSH_TO;
 
     bnep_cb.reg_info.pL2CA_ConnectInd_Cb        = bnep_connect_ind;
@@ -120,7 +120,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void bnep_connect_ind (BD_ADDR  bd_addr, UINT16 l2cap_cid, UINT16 psm, UINT8 l2cap_id)
+static void bnep_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid, uint16_t psm, uint8_t l2cap_id)
 {
     tBNEP_CONN    *p_bcb = bnepu_find_bcb_by_bd_addr (bd_addr);
     UNUSED(psm);
@@ -167,7 +167,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void bnep_connect_cfm (UINT16 l2cap_cid, UINT16 result)
+static void bnep_connect_cfm (uint16_t l2cap_cid, uint16_t result)
 {
     tBNEP_CONN    *p_bcb;
 
@@ -202,7 +202,7 @@
         if (bnep_cb.p_conn_state_cb &&
             p_bcb->con_flags & BNEP_FLAGS_IS_ORIG)
         {
-            (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED, FALSE);
+            (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED, false);
         }
 
         bnepu_release_bcb (p_bcb);
@@ -219,10 +219,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void bnep_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
+static void bnep_config_ind (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
 {
     tBNEP_CONN    *p_bcb;
-    UINT16        result, mtu = 0;
+    uint16_t      result, mtu = 0;
 
     /* Find CCB based on CID */
     if ((p_bcb = bnepu_find_bcb_by_cid (l2cap_cid)) == NULL)
@@ -237,8 +237,8 @@
     if ((!p_cfg->mtu_present) || (p_cfg->mtu < BNEP_MIN_MTU_SIZE))
     {
         mtu                     = p_cfg->mtu;
-        p_cfg->flush_to_present = FALSE;
-        p_cfg->mtu_present      = TRUE;
+        p_cfg->flush_to_present = false;
+        p_cfg->mtu_present      = true;
         p_cfg->mtu              = BNEP_MIN_MTU_SIZE;
         p_cfg->result           = result = L2CAP_CFG_UNACCEPTABLE_PARAMS;
     }
@@ -250,8 +250,8 @@
             p_bcb->rem_mtu_size = p_cfg->mtu;
 
         /* For now, always accept configuration from the other side */
-        p_cfg->flush_to_present = FALSE;
-        p_cfg->mtu_present      = FALSE;
+        p_cfg->flush_to_present = false;
+        p_cfg->mtu_present      = false;
         p_cfg->result           = result = L2CAP_CFG_OK;
     }
 
@@ -276,7 +276,7 @@
 
         if (p_bcb->con_flags & BNEP_FLAGS_IS_ORIG)
         {
-            btm_sec_mx_access_request (p_bcb->rem_bda, BT_PSM_BNEP, TRUE,
+            btm_sec_mx_access_request (p_bcb->rem_bda, BT_PSM_BNEP, true,
                                        BTM_SEC_PROTO_BNEP,
                                        bnep_get_uuid32(&(p_bcb->src_uuid)),
                                        &bnep_sec_check_complete, p_bcb);
@@ -295,7 +295,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void bnep_config_cfm (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
+static void bnep_config_cfm (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
 {
     tBNEP_CONN    *p_bcb;
 
@@ -324,7 +324,7 @@
 
             if (p_bcb->con_flags & BNEP_FLAGS_IS_ORIG)
             {
-                btm_sec_mx_access_request (p_bcb->rem_bda, BT_PSM_BNEP, TRUE,
+                btm_sec_mx_access_request (p_bcb->rem_bda, BT_PSM_BNEP, true,
                                            BTM_SEC_PROTO_BNEP,
                                            bnep_get_uuid32(&(p_bcb->src_uuid)),
                                            &bnep_sec_check_complete, p_bcb);
@@ -336,7 +336,7 @@
         /* Tell the upper layer, if he has a callback */
         if ((p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) && (bnep_cb.p_conn_state_cb))
         {
-            (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED_CFG, FALSE);
+            (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED_CFG, false);
         }
 
         L2CA_DisconnectReq (p_bcb->l2cap_cid);
@@ -356,7 +356,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void bnep_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed)
+static void bnep_disconnect_ind (uint16_t l2cap_cid, bool    ack_needed)
 {
     tBNEP_CONN    *p_bcb;
 
@@ -376,13 +376,13 @@
     if (p_bcb->con_state == BNEP_STATE_CONNECTED)
     {
         if (bnep_cb.p_conn_state_cb)
-            (*bnep_cb.p_conn_state_cb)(p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_DISCONNECTED, FALSE);
+            (*bnep_cb.p_conn_state_cb)(p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_DISCONNECTED, false);
     }
     else
     {
         if ((bnep_cb.p_conn_state_cb) && ((p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) ||
             (p_bcb->con_flags & BNEP_FLAGS_CONN_COMPLETED)))
-            (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED, FALSE);
+            (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED, false);
     }
 
     bnepu_release_bcb (p_bcb);
@@ -399,7 +399,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void bnep_disconnect_cfm (UINT16 l2cap_cid, UINT16 result)
+static void bnep_disconnect_cfm (uint16_t l2cap_cid, uint16_t result)
 {
     BNEP_TRACE_EVENT ("BNEP - Rcvd L2CAP disc cfm, CID: 0x%x, Result 0x%x", l2cap_cid, result);
 }
@@ -414,7 +414,7 @@
 **                  congestion status changes
 **
 *******************************************************************************/
-static void bnep_congestion_ind (UINT16 l2cap_cid, BOOLEAN is_congested)
+static void bnep_congestion_ind (uint16_t l2cap_cid, bool    is_congested)
 {
     tBNEP_CONN    *p_bcb;
 
@@ -472,15 +472,15 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void bnep_data_ind (UINT16 l2cap_cid, BT_HDR *p_buf)
+static void bnep_data_ind (uint16_t l2cap_cid, BT_HDR *p_buf)
 {
     tBNEP_CONN    *p_bcb;
-    UINT8         *p = (UINT8 *)(p_buf + 1) + p_buf->offset;
-    UINT16        rem_len = p_buf->len;
-    UINT8         type, ctrl_type, ext_type = 0;
-    BOOLEAN       extension_present, fw_ext_present;
-    UINT16        protocol = 0;
-    UINT8         *p_src_addr, *p_dst_addr;
+    uint8_t       *p = (uint8_t *)(p_buf + 1) + p_buf->offset;
+    uint16_t      rem_len = p_buf->len;
+    uint8_t       type, ctrl_type, ext_type = 0;
+    bool          extension_present, fw_ext_present;
+    uint16_t      protocol = 0;
+    uint8_t       *p_src_addr, *p_dst_addr;
 
 
     /* Find CCB based on CID */
@@ -518,8 +518,8 @@
             ** with unknown control extension headers then those should be processed
             ** according to complain/ignore law
             */
-            UINT8       ext, length;
-            UINT16      org_len, new_len;
+            uint8_t     ext, length;
+            uint16_t    org_len, new_len;
             /* parse the extension headers and process unknown control headers */
             org_len = rem_len;
             new_len = 0;
@@ -569,14 +569,14 @@
 
     case BNEP_FRAME_CONTROL:
         ctrl_type = *p;
-        p = bnep_process_control_packet (p_bcb, p, &rem_len, FALSE);
+        p = bnep_process_control_packet (p_bcb, p, &rem_len, false);
 
         if (ctrl_type == BNEP_SETUP_CONNECTION_REQUEST_MSG &&
             p_bcb->con_state != BNEP_STATE_CONNECTED &&
             extension_present && p && rem_len)
         {
             p_bcb->p_pending_data = (BT_HDR *)osi_malloc(rem_len);
-            memcpy((UINT8 *)(p_bcb->p_pending_data + 1), p, rem_len);
+            memcpy((uint8_t *)(p_bcb->p_pending_data + 1), p, rem_len);
             p_bcb->p_pending_data->len    = rem_len;
             p_bcb->p_pending_data->offset = 0;
         }
@@ -592,7 +592,7 @@
                 if (ext_type)
                     break;
 
-                p = bnep_process_control_packet (p_bcb, p, &rem_len, TRUE);
+                p = bnep_process_control_packet (p_bcb, p, &rem_len, true);
             }
         }
         osi_free(p_buf);
@@ -634,7 +634,7 @@
 
         p++;
         rem_len--;
-        p = bnep_process_control_packet (p_bcb, p, &rem_len, TRUE);
+        p = bnep_process_control_packet (p_bcb, p, &rem_len, true);
     }
 
     p_buf->offset += p_buf->len - rem_len;
@@ -642,16 +642,16 @@
 
     /* Always give the upper layer MAC addresses */
     if (!p_src_addr)
-        p_src_addr = (UINT8 *) p_bcb->rem_bda;
+        p_src_addr = (uint8_t *) p_bcb->rem_bda;
 
     if (!p_dst_addr)
-        p_dst_addr = (UINT8 *) controller_get_interface()->get_address();
+        p_dst_addr = (uint8_t *) controller_get_interface()->get_address();
 
     /* check whether there are any extensions to be forwarded */
     if (ext_type)
-        fw_ext_present = TRUE;
+        fw_ext_present = true;
     else
-        fw_ext_present = FALSE;
+        fw_ext_present = false;
 
     if (bnep_cb.p_data_buf_cb)
     {
@@ -709,7 +709,7 @@
             L2CA_DisconnectReq (p_bcb->l2cap_cid);
 
             if ((p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) && (bnep_cb.p_conn_state_cb))
-                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED, FALSE);
+                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED, false);
 
             bnepu_release_bcb (p_bcb);
             return;
@@ -724,7 +724,7 @@
 
         /* Tell the user if he has a callback */
         if ((p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) && (bnep_cb.p_conn_state_cb))
-            (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED, FALSE);
+            (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED, false);
 
         bnepu_release_bcb (p_bcb);
     }
@@ -743,7 +743,7 @@
 
             /* Tell the user if he has a callback */
             if (bnep_cb.p_conn_state_cb)
-                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_SET_FILTER_FAIL, FALSE);
+                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_SET_FILTER_FAIL, false);
 
             bnepu_release_bcb (p_bcb);
             return;
@@ -764,7 +764,7 @@
 
             /* Tell the user if he has a callback */
             if (bnep_cb.p_conn_state_cb)
-                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_SET_FILTER_FAIL, FALSE);
+                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_SET_FILTER_FAIL, false);
 
             bnepu_release_bcb (p_bcb);
             return;
@@ -785,12 +785,12 @@
 *******************************************************************************/
 void bnep_connected (tBNEP_CONN *p_bcb)
 {
-    BOOLEAN     is_role_change;
+    bool        is_role_change;
 
     if (p_bcb->con_flags & BNEP_FLAGS_CONN_COMPLETED)
-        is_role_change = TRUE;
+        is_role_change = true;
     else
-        is_role_change = FALSE;
+        is_role_change = false;
 
     p_bcb->con_state = BNEP_STATE_CONNECTED;
     p_bcb->con_flags |= BNEP_FLAGS_CONN_COMPLETED;
diff --git a/stack/bnep/bnep_utils.c b/stack/bnep/bnep_utils.c
index 13fb189..6aa4477 100644
--- a/stack/bnep/bnep_utils.c
+++ b/stack/bnep/bnep_utils.c
@@ -38,10 +38,10 @@
 /********************************************************************************/
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
-static UINT8 *bnepu_init_hdr (BT_HDR *p_buf, UINT16 hdr_len, UINT8 pkt_type);
+static uint8_t *bnepu_init_hdr (BT_HDR *p_buf, uint16_t hdr_len, uint8_t pkt_type);
 
-void bnepu_process_peer_multicast_filter_set (tBNEP_CONN *p_bcb, UINT8 *p_filters, UINT16 len);
-void bnepu_send_peer_multicast_filter_rsp (tBNEP_CONN *p_bcb, UINT16 response_code);
+void bnepu_process_peer_multicast_filter_set (tBNEP_CONN *p_bcb, uint8_t *p_filters, uint16_t len);
+void bnepu_send_peer_multicast_filter_rsp (tBNEP_CONN *p_bcb, uint16_t response_code);
 
 
 /*******************************************************************************
@@ -54,9 +54,9 @@
 ** Returns          the BCB address, or NULL if not found.
 **
 *******************************************************************************/
-tBNEP_CONN *bnepu_find_bcb_by_cid (UINT16 cid)
+tBNEP_CONN *bnepu_find_bcb_by_cid (uint16_t cid)
 {
-    UINT16          xx;
+    uint16_t        xx;
     tBNEP_CONN     *p_bcb;
 
     /* Look through each connection control block */
@@ -81,9 +81,9 @@
 ** Returns          the BCB address, or NULL if not found.
 **
 *******************************************************************************/
-tBNEP_CONN *bnepu_find_bcb_by_bd_addr (UINT8 *p_bda)
+tBNEP_CONN *bnepu_find_bcb_by_bd_addr (uint8_t *p_bda)
 {
-    UINT16          xx;
+    uint16_t        xx;
     tBNEP_CONN     *p_bcb;
 
     /* Look through each connection control block */
@@ -91,7 +91,7 @@
     {
         if (p_bcb->con_state != BNEP_STATE_IDLE)
         {
-            if (!memcmp ((UINT8 *)(p_bcb->rem_bda), p_bda, BD_ADDR_LEN))
+            if (!memcmp ((uint8_t *)(p_bcb->rem_bda), p_bda, BD_ADDR_LEN))
                 return (p_bcb);
         }
     }
@@ -112,7 +112,7 @@
 *******************************************************************************/
 tBNEP_CONN *bnepu_allocate_bcb (BD_ADDR p_rem_bda)
 {
-    UINT16          xx;
+    uint16_t        xx;
     tBNEP_CONN     *p_bcb;
 
     /* Look through each connection control block for a free one */
@@ -121,10 +121,10 @@
         if (p_bcb->con_state == BNEP_STATE_IDLE)
         {
             alarm_free(p_bcb->conn_timer);
-            memset ((UINT8 *)p_bcb, 0, sizeof (tBNEP_CONN));
+            memset ((uint8_t *)p_bcb, 0, sizeof (tBNEP_CONN));
             p_bcb->conn_timer = alarm_new("bnep.conn_timer");
 
-            memcpy ((UINT8 *)(p_bcb->rem_bda), (UINT8 *)p_rem_bda, BD_ADDR_LEN);
+            memcpy ((uint8_t *)(p_bcb->rem_bda), (uint8_t *)p_rem_bda, BD_ADDR_LEN);
             p_bcb->handle = xx + 1;
             p_bcb->xmit_q = fixed_queue_new(SIZE_MAX);
 
@@ -178,13 +178,13 @@
 void bnep_send_conn_req (tBNEP_CONN *p_bcb)
 {
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(BNEP_BUF_SIZE);
-    UINT8   *p, *p_start;
+    uint8_t *p, *p_start;
 
     BNEP_TRACE_DEBUG ("%s: sending setup req with dst uuid %x",
         __func__, p_bcb->dst_uuid.uu.uuid16);
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p = p_start = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = p_start = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* Put in BNEP frame type - filter control */
     UINT8_TO_BE_STREAM (p, BNEP_FRAME_CONTROL);
@@ -217,7 +217,7 @@
             __func__, p_bcb->dst_uuid.uu.uuid16, p_bcb->dst_uuid.len);
     }
 
-    p_buf->len = (UINT16)(p - p_start);
+    p_buf->len = (uint16_t)(p - p_start);
 
     bnepu_check_send_packet (p_bcb, p_buf);
 }
@@ -232,15 +232,15 @@
 ** Returns          void
 **
 *******************************************************************************/
-void bnep_send_conn_responce (tBNEP_CONN *p_bcb, UINT16 resp_code)
+void bnep_send_conn_responce (tBNEP_CONN *p_bcb, uint16_t resp_code)
 {
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(BNEP_BUF_SIZE);
-    UINT8   *p;
+    uint8_t *p;
 
     BNEP_TRACE_EVENT ("BNEP - bnep_send_conn_responce for CID: 0x%x", p_bcb->l2cap_cid);
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* Put in BNEP frame type - filter control */
     UINT8_TO_BE_STREAM (p, BNEP_FRAME_CONTROL);
@@ -269,13 +269,13 @@
 void bnepu_send_peer_our_filters (tBNEP_CONN *p_bcb)
 {
     BT_HDR      *p_buf = (BT_HDR *)osi_malloc(BNEP_BUF_SIZE);
-    UINT8       *p;
-    UINT16      xx;
+    uint8_t     *p;
+    uint16_t    xx;
 
     BNEP_TRACE_DEBUG ("BNEP sending peer our filters");
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* Put in BNEP frame type - filter control */
     UINT8_TO_BE_STREAM (p, BNEP_FRAME_CONTROL);
@@ -315,13 +315,13 @@
 void bnepu_send_peer_our_multi_filters (tBNEP_CONN *p_bcb)
 {
     BT_HDR      *p_buf = (BT_HDR *)osi_malloc(BNEP_BUF_SIZE);
-    UINT8       *p;
-    UINT16      xx;
+    uint8_t     *p;
+    uint16_t    xx;
 
     BNEP_TRACE_DEBUG ("BNEP sending peer our multicast filters");
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* Put in BNEP frame type - filter control */
     UINT8_TO_BE_STREAM (p, BNEP_FRAME_CONTROL);
@@ -360,15 +360,15 @@
 ** Returns          void
 **
 *******************************************************************************/
-void bnepu_send_peer_filter_rsp (tBNEP_CONN *p_bcb, UINT16 response_code)
+void bnepu_send_peer_filter_rsp (tBNEP_CONN *p_bcb, uint16_t response_code)
 {
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(BNEP_BUF_SIZE);
-    UINT8   *p;
+    uint8_t *p;
 
     BNEP_TRACE_DEBUG ("BNEP sending filter response");
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* Put in BNEP frame type - filter control */
     UINT8_TO_BE_STREAM (p, BNEP_FRAME_CONTROL);
@@ -393,15 +393,15 @@
 ** Returns          void
 **
 *******************************************************************************/
-void bnep_send_command_not_understood (tBNEP_CONN *p_bcb, UINT8 cmd_code)
+void bnep_send_command_not_understood (tBNEP_CONN *p_bcb, uint8_t cmd_code)
 {
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(BNEP_BUF_SIZE);
-    UINT8   *p;
+    uint8_t *p;
 
     BNEP_TRACE_EVENT ("BNEP - bnep_send_command_not_understood for CID: 0x%x, cmd 0x%x", p_bcb->l2cap_cid, cmd_code);
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* Put in BNEP frame type - filter control */
     UINT8_TO_BE_STREAM (p, BNEP_FRAME_CONTROL);
@@ -463,12 +463,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void bnepu_build_bnep_hdr (tBNEP_CONN *p_bcb, BT_HDR *p_buf, UINT16 protocol,
-                           UINT8 *p_src_addr, UINT8 *p_dest_addr, BOOLEAN fw_ext_present)
+void bnepu_build_bnep_hdr (tBNEP_CONN *p_bcb, BT_HDR *p_buf, uint16_t protocol,
+                           uint8_t *p_src_addr, uint8_t *p_dest_addr, bool    fw_ext_present)
 {
     const controller_t *controller = controller_get_interface();
-    UINT8    ext_bit, *p = (UINT8 *)NULL;
-    UINT8    type = BNEP_FRAME_COMPRESSED_ETHERNET;
+    uint8_t  ext_bit, *p = (uint8_t *)NULL;
+    uint8_t  type = BNEP_FRAME_COMPRESSED_ETHERNET;
 
     ext_bit = fw_ext_present ? 0x80 : 0x00;
 
@@ -479,12 +479,12 @@
         type = (type == BNEP_FRAME_COMPRESSED_ETHERNET) ? BNEP_FRAME_COMPRESSED_ETHERNET_DEST_ONLY : BNEP_FRAME_GENERAL_ETHERNET;
 
     if (!p_src_addr)
-        p_src_addr = (UINT8 *)controller->get_address();
+        p_src_addr = (uint8_t *)controller->get_address();
 
     switch (type)
     {
     case BNEP_FRAME_GENERAL_ETHERNET:
-        p = bnepu_init_hdr (p_buf, 15, (UINT8)(ext_bit | BNEP_FRAME_GENERAL_ETHERNET));
+        p = bnepu_init_hdr (p_buf, 15, (uint8_t)(ext_bit | BNEP_FRAME_GENERAL_ETHERNET));
 
         memcpy (p, p_dest_addr, BD_ADDR_LEN);
         p += BD_ADDR_LEN;
@@ -494,18 +494,18 @@
         break;
 
     case BNEP_FRAME_COMPRESSED_ETHERNET:
-        p = bnepu_init_hdr (p_buf, 3, (UINT8)(ext_bit | BNEP_FRAME_COMPRESSED_ETHERNET));
+        p = bnepu_init_hdr (p_buf, 3, (uint8_t)(ext_bit | BNEP_FRAME_COMPRESSED_ETHERNET));
         break;
 
     case BNEP_FRAME_COMPRESSED_ETHERNET_SRC_ONLY:
-        p = bnepu_init_hdr (p_buf, 9, (UINT8)(ext_bit | BNEP_FRAME_COMPRESSED_ETHERNET_SRC_ONLY));
+        p = bnepu_init_hdr (p_buf, 9, (uint8_t)(ext_bit | BNEP_FRAME_COMPRESSED_ETHERNET_SRC_ONLY));
 
         memcpy (p, p_src_addr, BD_ADDR_LEN);
         p += BD_ADDR_LEN;
         break;
 
     case BNEP_FRAME_COMPRESSED_ETHERNET_DEST_ONLY:
-        p = bnepu_init_hdr (p_buf, 9, (UINT8)(ext_bit | BNEP_FRAME_COMPRESSED_ETHERNET_DEST_ONLY));
+        p = bnepu_init_hdr (p_buf, 9, (uint8_t)(ext_bit | BNEP_FRAME_COMPRESSED_ETHERNET_DEST_ONLY));
 
         memcpy (p, p_dest_addr, BD_ADDR_LEN);
         p += BD_ADDR_LEN;
@@ -525,20 +525,20 @@
 ** Returns          pointer to header in buffer
 **
 *******************************************************************************/
-static UINT8 *bnepu_init_hdr (BT_HDR *p_buf, UINT16 hdr_len, UINT8 pkt_type)
+static uint8_t *bnepu_init_hdr (BT_HDR *p_buf, uint16_t hdr_len, uint8_t pkt_type)
 {
-    UINT8    *p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    uint8_t  *p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     /* See if we need to make space in the buffer */
     if (p_buf->offset < (hdr_len + L2CAP_MIN_OFFSET))
     {
-        UINT16 xx, diff = BNEP_MINIMUM_OFFSET - p_buf->offset;
+        uint16_t xx, diff = BNEP_MINIMUM_OFFSET - p_buf->offset;
         p = p + p_buf->len - 1;
         for (xx = 0; xx < p_buf->len; xx++, p--)
             p[diff] = *p;
 
         p_buf->offset = BNEP_MINIMUM_OFFSET;
-        p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+        p = (uint8_t *)(p_buf + 1) + p_buf->offset;
     }
 
     p_buf->len    += hdr_len;
@@ -562,7 +562,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void bnep_process_setup_conn_req (tBNEP_CONN *p_bcb, UINT8 *p_setup, UINT8 len)
+void bnep_process_setup_conn_req (tBNEP_CONN *p_bcb, uint8_t *p_setup, uint8_t len)
 {
     BNEP_TRACE_EVENT ("BNEP - bnep_process_setup_conn_req for CID: 0x%x", p_bcb->l2cap_cid);
 
@@ -594,8 +594,8 @@
 
     if (p_bcb->con_state == BNEP_STATE_CONNECTED)
     {
-        memcpy ((UINT8 *)&(p_bcb->prv_src_uuid), (UINT8 *)&(p_bcb->src_uuid), sizeof (tBT_UUID));
-        memcpy ((UINT8 *)&(p_bcb->prv_dst_uuid), (UINT8 *)&(p_bcb->dst_uuid), sizeof (tBT_UUID));
+        memcpy ((uint8_t *)&(p_bcb->prv_src_uuid), (uint8_t *)&(p_bcb->src_uuid), sizeof (tBT_UUID));
+        memcpy ((uint8_t *)&(p_bcb->prv_dst_uuid), (uint8_t *)&(p_bcb->dst_uuid), sizeof (tBT_UUID));
     }
 
     p_bcb->dst_uuid.len = p_bcb->src_uuid.len = len;
@@ -638,12 +638,12 @@
     p_bcb->con_flags |= BNEP_FLAGS_SETUP_RCVD;
 
     BNEP_TRACE_EVENT ("BNEP initiating security check for incoming call for uuid 0x%x", p_bcb->src_uuid.uu.uuid16);
-#if (!defined (BNEP_DO_AUTH_FOR_ROLE_SWITCH) || BNEP_DO_AUTH_FOR_ROLE_SWITCH == FALSE)
+#if (BNEP_DO_AUTH_FOR_ROLE_SWITCH == FALSE)
     if (p_bcb->con_flags & BNEP_FLAGS_CONN_COMPLETED)
         bnep_sec_check_complete (p_bcb->rem_bda, p_bcb, BTM_SUCCESS);
     else
 #endif
-    btm_sec_mx_access_request (p_bcb->rem_bda, BT_PSM_BNEP, FALSE,
+    btm_sec_mx_access_request (p_bcb->rem_bda, BT_PSM_BNEP, false,
                                BTM_SEC_PROTO_BNEP, bnep_get_uuid32(&(p_bcb->src_uuid)),
                                &bnep_sec_check_complete, p_bcb);
 
@@ -662,10 +662,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void bnep_process_setup_conn_responce (tBNEP_CONN *p_bcb, UINT8 *p_setup)
+void bnep_process_setup_conn_responce (tBNEP_CONN *p_bcb, uint8_t *p_setup)
 {
     tBNEP_RESULT    resp;
-    UINT16          resp_code;
+    uint16_t        resp_code;
 
     BNEP_TRACE_DEBUG ("BNEP received setup responce");
     /* The state should be either SETUP or CONNECTED */
@@ -715,8 +715,8 @@
             /* Restore the earlier BNEP status */
             p_bcb->con_state = BNEP_STATE_CONNECTED;
             p_bcb->con_flags &= (~BNEP_FLAGS_SETUP_RCVD);
-            memcpy ((UINT8 *)&(p_bcb->src_uuid), (UINT8 *)&(p_bcb->prv_src_uuid), sizeof (tBT_UUID));
-            memcpy ((UINT8 *)&(p_bcb->dst_uuid), (UINT8 *)&(p_bcb->prv_dst_uuid), sizeof (tBT_UUID));
+            memcpy ((uint8_t *)&(p_bcb->src_uuid), (uint8_t *)&(p_bcb->prv_src_uuid), sizeof (tBT_UUID));
+            memcpy ((uint8_t *)&(p_bcb->dst_uuid), (uint8_t *)&(p_bcb->prv_dst_uuid), sizeof (tBT_UUID));
 
             /* Ensure timer is stopped */
             alarm_cancel(p_bcb->conn_timer);
@@ -724,7 +724,7 @@
 
             /* Tell the user if he has a callback */
             if (bnep_cb.p_conn_state_cb)
-                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, resp, TRUE);
+                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, resp, true);
 
             return;
         }
@@ -736,7 +736,7 @@
 
             /* Tell the user if he has a callback */
             if ((p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) && (bnep_cb.p_conn_state_cb))
-                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, resp, FALSE);
+                (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, resp, false);
 
             bnepu_release_bcb (p_bcb);
             return;
@@ -759,11 +759,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-UINT8 *bnep_process_control_packet (tBNEP_CONN *p_bcb, UINT8 *p, UINT16 *rem_len, BOOLEAN is_ext)
+uint8_t *bnep_process_control_packet (tBNEP_CONN *p_bcb, uint8_t *p, uint16_t *rem_len, bool    is_ext)
 {
-    UINT8       control_type;
-    BOOLEAN     bad_pkt = FALSE;
-    UINT16      len, ext_len = 0;
+    uint8_t     control_type;
+    bool        bad_pkt = false;
+    uint16_t    len, ext_len = 0;
 
     if (is_ext)
     {
@@ -788,12 +788,12 @@
         len = *p++;
         if (*rem_len < ((2 * len) + 1))
         {
-            bad_pkt = TRUE;
+            bad_pkt = true;
             BNEP_TRACE_ERROR ("BNEP Received Setup message with bad length");
             break;
         }
         if (!is_ext)
-            bnep_process_setup_conn_req (p_bcb, p, (UINT8)len);
+            bnep_process_setup_conn_req (p_bcb, p, (uint8_t)len);
         p += (2 * len);
         *rem_len = *rem_len - (2 * len) - 1;
         break;
@@ -809,7 +809,7 @@
         BE_STREAM_TO_UINT16 (len, p);
         if (*rem_len < (len + 2))
         {
-            bad_pkt = TRUE;
+            bad_pkt = true;
             BNEP_TRACE_ERROR ("BNEP Received Filter set message with bad length");
             break;
         }
@@ -828,7 +828,7 @@
         BE_STREAM_TO_UINT16 (len, p);
         if (*rem_len < (len + 2))
         {
-            bad_pkt = TRUE;
+            bad_pkt = true;
             BNEP_TRACE_ERROR ("BNEP Received Multicast Filter Set message with bad length");
             break;
         }
@@ -876,12 +876,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void bnepu_process_peer_filter_set (tBNEP_CONN *p_bcb, UINT8 *p_filters, UINT16 len)
+void bnepu_process_peer_filter_set (tBNEP_CONN *p_bcb, uint8_t *p_filters, uint16_t len)
 {
-    UINT16      num_filters = 0;
-    UINT16      xx, resp_code = BNEP_FILTER_CRL_OK;
-    UINT16      start, end;
-    UINT8       *p_temp_filters;
+    uint16_t    num_filters = 0;
+    uint16_t    xx, resp_code = BNEP_FILTER_CRL_OK;
+    uint16_t    start, end;
+    uint8_t     *p_temp_filters;
 
     if ((p_bcb->con_state != BNEP_STATE_CONNECTED) &&
         (!(p_bcb->con_flags & BNEP_FLAGS_CONN_COMPLETED)))
@@ -900,7 +900,7 @@
     }
 
     if (len)
-        num_filters = (UINT16) (len >> 2);
+        num_filters = (uint16_t) (len >> 2);
 
     /* Validate filter values */
     if (num_filters <= BNEP_MAX_PROT_FILTERS)
@@ -928,7 +928,7 @@
     }
 
     if (bnep_cb.p_filter_ind_cb)
-        (*bnep_cb.p_filter_ind_cb) (p_bcb->handle, TRUE, 0, len, p_filters);
+        (*bnep_cb.p_filter_ind_cb) (p_bcb->handle, true, 0, len, p_filters);
 
     p_bcb->rcvd_num_filters = num_filters;
     for (xx = 0; xx < num_filters; xx++)
@@ -954,9 +954,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void bnepu_process_peer_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data)
+void bnepu_process_peer_filter_rsp (tBNEP_CONN *p_bcb, uint8_t *p_data)
 {
-    UINT16          resp_code;
+    uint16_t        resp_code;
     tBNEP_RESULT    result;
 
     BNEP_TRACE_DEBUG ("BNEP received filter responce");
@@ -987,7 +987,7 @@
         result = BNEP_SET_FILTER_FAIL;
 
     if (bnep_cb.p_filter_ind_cb)
-        (*bnep_cb.p_filter_ind_cb) (p_bcb->handle, FALSE, result, 0, NULL);
+        (*bnep_cb.p_filter_ind_cb) (p_bcb->handle, false, result, 0, NULL);
 }
 
 /*******************************************************************************
@@ -1000,9 +1000,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void bnepu_process_multicast_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data)
+void bnepu_process_multicast_filter_rsp (tBNEP_CONN *p_bcb, uint8_t *p_data)
 {
-    UINT16          resp_code;
+    uint16_t        resp_code;
     tBNEP_RESULT    result;
 
     BNEP_TRACE_DEBUG ("BNEP received multicast filter responce");
@@ -1033,7 +1033,7 @@
         result = BNEP_SET_FILTER_FAIL;
 
     if (bnep_cb.p_mfilter_ind_cb)
-        (*bnep_cb.p_mfilter_ind_cb) (p_bcb->handle, FALSE, result, 0, NULL);
+        (*bnep_cb.p_mfilter_ind_cb) (p_bcb->handle, false, result, 0, NULL);
 }
 
 /*******************************************************************************
@@ -1047,11 +1047,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void bnepu_process_peer_multicast_filter_set (tBNEP_CONN *p_bcb, UINT8 *p_filters, UINT16 len)
+void bnepu_process_peer_multicast_filter_set (tBNEP_CONN *p_bcb, uint8_t *p_filters, uint16_t len)
 {
-    UINT16          resp_code = BNEP_FILTER_CRL_OK;
-    UINT16          num_filters, xx;
-    UINT8           *p_temp_filters, null_bda[BD_ADDR_LEN] = {0,0,0,0,0,0};
+    uint16_t        resp_code = BNEP_FILTER_CRL_OK;
+    uint16_t        num_filters, xx;
+    uint8_t         *p_temp_filters, null_bda[BD_ADDR_LEN] = {0,0,0,0,0,0};
 
     if ((p_bcb->con_state != BNEP_STATE_CONNECTED) &&
         (!(p_bcb->con_flags & BNEP_FLAGS_CONN_COMPLETED)))
@@ -1076,7 +1076,7 @@
 
     num_filters = 0;
     if (len)
-        num_filters = (UINT16) (len / 12);
+        num_filters = (uint16_t) (len / 12);
 
     /* Validate filter values */
     if (num_filters <= BNEP_MAX_MULTI_FILTERS)
@@ -1114,7 +1114,7 @@
     bnepu_send_peer_multicast_filter_rsp (p_bcb, resp_code);
 
     if (bnep_cb.p_mfilter_ind_cb)
-        (*bnep_cb.p_mfilter_ind_cb) (p_bcb->handle, TRUE, 0, len, p_filters);
+        (*bnep_cb.p_mfilter_ind_cb) (p_bcb->handle, true, 0, len, p_filters);
 }
 
 
@@ -1127,15 +1127,15 @@
 ** Returns          void
 **
 *******************************************************************************/
-void bnepu_send_peer_multicast_filter_rsp (tBNEP_CONN *p_bcb, UINT16 response_code)
+void bnepu_send_peer_multicast_filter_rsp (tBNEP_CONN *p_bcb, uint16_t response_code)
 {
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(BNEP_BUF_SIZE);
-    UINT8   *p;
+    uint8_t *p;
 
     BNEP_TRACE_DEBUG ("BNEP sending multicast filter response %d", response_code);
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* Put in BNEP frame type - filter control */
     UINT8_TO_BE_STREAM (p, BNEP_FRAME_CONTROL);
@@ -1163,19 +1163,19 @@
 **
 *******************************************************************************/
 void bnep_sec_check_complete (BD_ADDR bd_addr, tBT_TRANSPORT trasnport,
-                                    void *p_ref_data, UINT8 result)
+                                    void *p_ref_data, uint8_t result)
 {
     tBNEP_CONN      *p_bcb = (tBNEP_CONN *)p_ref_data;
-    UINT16          resp_code = BNEP_SETUP_CONN_OK;
-    BOOLEAN         is_role_change;
+    uint16_t        resp_code = BNEP_SETUP_CONN_OK;
+    bool            is_role_change;
     UNUSED(bd_addr);
     UNUSED(trasnport);
 
     BNEP_TRACE_EVENT ("BNEP security callback returned result %d", result);
     if (p_bcb->con_flags & BNEP_FLAGS_CONN_COMPLETED)
-        is_role_change = TRUE;
+        is_role_change = true;
     else
-        is_role_change = FALSE;
+        is_role_change = false;
 
     /* check if the port is still waiting for security to complete */
     if (p_bcb->con_state != BNEP_STATE_SEC_CHECKING)
@@ -1196,8 +1196,8 @@
                     (*bnep_cb.p_conn_state_cb) (p_bcb->handle, p_bcb->rem_bda, BNEP_SECURITY_FAIL, is_role_change);
 
                 p_bcb->con_state = BNEP_STATE_CONNECTED;
-                memcpy ((UINT8 *)&(p_bcb->src_uuid), (UINT8 *)&(p_bcb->prv_src_uuid), sizeof (tBT_UUID));
-                memcpy ((UINT8 *)&(p_bcb->dst_uuid), (UINT8 *)&(p_bcb->prv_dst_uuid), sizeof (tBT_UUID));
+                memcpy ((uint8_t *)&(p_bcb->src_uuid), (uint8_t *)&(p_bcb->prv_src_uuid), sizeof (tBT_UUID));
+                memcpy ((uint8_t *)&(p_bcb->dst_uuid), (uint8_t *)&(p_bcb->prv_dst_uuid), sizeof (tBT_UUID));
                 return;
             }
 
@@ -1230,8 +1230,8 @@
             /* Role change is failed because of security. Revert back to connected state */
             p_bcb->con_state = BNEP_STATE_CONNECTED;
             p_bcb->con_flags &= (~BNEP_FLAGS_SETUP_RCVD);
-            memcpy ((UINT8 *)&(p_bcb->src_uuid), (UINT8 *)&(p_bcb->prv_src_uuid), sizeof (tBT_UUID));
-            memcpy ((UINT8 *)&(p_bcb->dst_uuid), (UINT8 *)&(p_bcb->prv_dst_uuid), sizeof (tBT_UUID));
+            memcpy ((uint8_t *)&(p_bcb->src_uuid), (uint8_t *)&(p_bcb->prv_src_uuid), sizeof (tBT_UUID));
+            memcpy ((uint8_t *)&(p_bcb->dst_uuid), (uint8_t *)&(p_bcb->prv_dst_uuid), sizeof (tBT_UUID));
             return;
         }
 
@@ -1270,13 +1270,13 @@
 *******************************************************************************/
 tBNEP_RESULT bnep_is_packet_allowed (tBNEP_CONN *p_bcb,
                                      BD_ADDR p_dest_addr,
-                                     UINT16 protocol,
-                                     BOOLEAN fw_ext_present,
-                                     UINT8 *p_data)
+                                     uint16_t protocol,
+                                     bool    fw_ext_present,
+                                     uint8_t *p_data)
 {
     if (p_bcb->rcvd_num_filters)
     {
-        UINT16          i, proto;
+        uint16_t        i, proto;
 
         /* Findout the actual protocol to check for the filtering */
         proto = protocol;
@@ -1284,7 +1284,7 @@
         {
             if (fw_ext_present)
             {
-                UINT8       len, ext;
+                uint8_t     len, ext;
                 /* parse the extension headers and findout actual protocol */
                 do {
 
@@ -1316,7 +1316,7 @@
     if ((p_dest_addr[0] & 0x01) &&
         p_bcb->rcvd_mcast_filters)
     {
-        UINT16          i;
+        uint16_t        i;
 
         /* Check if every multicast should be filtered */
         if (p_bcb->rcvd_mcast_filters != 0xFFFF)
@@ -1352,15 +1352,15 @@
 **
 ** Description      This function returns the 32 bit equivalent of the given UUID
 **
-** Returns          UINT32          - 32 bit equivalent of the UUID
+** Returns          uint32_t        - 32 bit equivalent of the UUID
 **
 *******************************************************************************/
-UINT32 bnep_get_uuid32 (tBT_UUID *src_uuid)
+uint32_t bnep_get_uuid32 (tBT_UUID *src_uuid)
 {
-    UINT32      result;
+    uint32_t    result;
 
     if (src_uuid->len == 2)
-        return ((UINT32)src_uuid->uu.uuid16);
+        return ((uint32_t)src_uuid->uu.uuid16);
     else if (src_uuid->len == 4)
         return (src_uuid->uu.uuid32 & 0x0000FFFF);
     else
diff --git a/stack/btm/btm_acl.c b/stack/btm/btm_acl.c
index 8fdac49..afcf31a 100644
--- a/stack/btm/btm_acl.c
+++ b/stack/btm/btm_acl.c
@@ -51,9 +51,9 @@
 
 extern fixed_queue_t *btu_general_alarm_queue;
 
-static void btm_read_remote_features (UINT16 handle);
-static void btm_read_remote_ext_features (UINT16 handle, UINT8 page_number);
-static void btm_process_remote_ext_features (tACL_CONN *p_acl_cb, UINT8 num_read_pages);
+static void btm_read_remote_features (uint16_t handle);
+static void btm_read_remote_ext_features (uint16_t handle, uint8_t page_number);
+static void btm_process_remote_ext_features (tACL_CONN *p_acl_cb, uint8_t num_read_pages);
 
 /* 3 seconds timeout waiting for responses */
 #define BTM_DEV_REPLY_TIMEOUT_MS (3 * 1000)
@@ -72,7 +72,7 @@
     BTM_TRACE_DEBUG ("btm_acl_init");
 #if 0  /* cleared in btm_init; put back in if called from anywhere else! */
     memset (&btm_cb.acl_db, 0, sizeof (btm_cb.acl_db));
-    memset (btm_cb.btm_scn, 0, BTM_MAX_SCN);          /* Initialize the SCN usage to FALSE */
+    memset (btm_cb.btm_scn, 0, BTM_MAX_SCN);          /* Initialize the SCN usage to false */
     btm_cb.btm_def_link_policy     = 0;
     btm_cb.p_bl_changed_cb         = NULL;
 #endif
@@ -98,13 +98,13 @@
 tACL_CONN *btm_bda_to_acl (const BD_ADDR bda, tBT_TRANSPORT transport)
 {
     tACL_CONN   *p = &btm_cb.acl_db[0];
-    UINT16       xx;
+    uint16_t     xx;
     if (bda)
     {
         for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p++)
         {
             if ((p->in_use) && (!memcmp (p->remote_addr, bda, BD_ADDR_LEN))
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
                 && p->transport == transport
 #endif
                 )
@@ -128,10 +128,10 @@
 ** Returns          index to the acl_db or MAX_L2CAP_LINKS.
 **
 *******************************************************************************/
-UINT8 btm_handle_to_acl_index (UINT16 hci_handle)
+uint8_t btm_handle_to_acl_index (uint16_t hci_handle)
 {
     tACL_CONN   *p = &btm_cb.acl_db[0];
-    UINT8       xx;
+    uint8_t     xx;
     BTM_TRACE_DEBUG ("btm_handle_to_acl_index");
     for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p++)
     {
@@ -145,7 +145,7 @@
     return(xx);
 }
 
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
 /*******************************************************************************
 **
 ** Function         btm_ble_get_acl_remote_addr
@@ -153,19 +153,19 @@
 ** Description      This function reads the active remote address used for the
 **                  connection.
 **
-** Returns          success return TRUE, otherwise FALSE.
+** Returns          success return true, otherwise false.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_get_acl_remote_addr(tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR conn_addr,
+bool    btm_ble_get_acl_remote_addr(tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR conn_addr,
                                     tBLE_ADDR_TYPE *p_addr_type)
 {
-#if BLE_INCLUDED == TRUE
-    BOOLEAN         st = TRUE;
+#if (BLE_INCLUDED == TRUE)
+    bool            st = true;
 
     if (p_dev_rec == NULL)
     {
         BTM_TRACE_ERROR("btm_ble_get_acl_remote_addr can not find device with matching address");
-        return FALSE;
+        return false;
     }
 
     switch (p_dev_rec->ble.active_addr_type)
@@ -187,7 +187,7 @@
 
     default:
         BTM_TRACE_ERROR("Unknown active address: %d", p_dev_rec->ble.active_addr_type);
-        st = FALSE;
+        st = false;
         break;
     }
 
@@ -196,7 +196,7 @@
     UNUSED(p_dev_rec);
     UNUSED(conn_addr);
     UNUSED(p_addr_type);
-    return FALSE;
+    return false;
 #endif
 }
 #endif
@@ -211,11 +211,11 @@
 **
 *******************************************************************************/
 void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
-                      UINT16 hci_handle, UINT8 link_role, tBT_TRANSPORT transport)
+                      uint16_t hci_handle, uint8_t link_role, tBT_TRANSPORT transport)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = NULL;
     tACL_CONN        *p;
-    UINT8             xx;
+    uint8_t           xx;
 
     BTM_TRACE_DEBUG ("btm_acl_created hci_handle=%d link_role=%d  transport=%d",
                       hci_handle,link_role, transport);
@@ -225,7 +225,7 @@
     {
         p->hci_handle = hci_handle;
         p->link_role  = link_role;
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         p->transport = transport;
 #endif
         BTM_TRACE_DEBUG ("Duplicate btm_acl_created: RemBdAddr: %02x%02x%02x%02x%02x%02x",
@@ -239,15 +239,15 @@
     {
         if (!p->in_use)
         {
-            p->in_use            = TRUE;
+            p->in_use            = true;
             p->hci_handle        = hci_handle;
             p->link_role         = link_role;
-            p->link_up_issued    = FALSE;
+            p->link_up_issued    = false;
             memcpy (p->remote_addr, bda, BD_ADDR_LEN);
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             p->transport = transport;
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
             if (transport == BT_TRANSPORT_LE)
                 btm_ble_refresh_local_resolvable_private_addr(bda,
                                                     btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr);
@@ -293,12 +293,12 @@
                         (HCI_FEATURE_BYTES_PER_PAGE * p_dev_rec->num_read_pages));
                     p->num_read_pages = p_dev_rec->num_read_pages;
 
-                    const UINT8 req_pend = (p_dev_rec->sm4 & BTM_SM4_REQ_PEND);
+                    const uint8_t req_pend = (p_dev_rec->sm4 & BTM_SM4_REQ_PEND);
 
                     /* Store the Peer Security Capabilites (in SM4 and rmt_sec_caps) */
                     btm_sec_set_peer_sec_caps(p, p_dev_rec);
 
-                    BTM_TRACE_API("%s: pend:%d", __FUNCTION__, req_pend);
+                    BTM_TRACE_API("%s: pend:%d", __func__, req_pend);
                     if (req_pend)
                     {
                         /* Request for remaining Security Features (if any) */
@@ -313,7 +313,7 @@
             /* If here, features are not known yet */
             if (p_dev_rec && transport == BT_TRANSPORT_LE)
             {
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
                 btm_ble_get_acl_remote_addr (p_dev_rec, p->active_remote_addr,
                     &p->active_remote_addr_type);
 #endif
@@ -351,7 +351,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_acl_report_role_change (UINT8 hci_status, BD_ADDR bda)
+void btm_acl_report_role_change (uint8_t hci_status, BD_ADDR bda)
 {
     tBTM_ROLE_SWITCH_CMPL   ref_data;
     BTM_TRACE_DEBUG ("btm_acl_report_role_change");
@@ -381,14 +381,14 @@
 {
     tACL_CONN   *p;
     tBTM_BL_EVENT_DATA  evt_data;
-#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
+#if (BLE_INCLUDED == TRUE)
     tBTM_SEC_DEV_REC *p_dev_rec=NULL;
 #endif
     BTM_TRACE_DEBUG ("btm_acl_removed");
     p = btm_bda_to_acl(bda, transport);
     if (p != (tACL_CONN *)NULL)
     {
-        p->in_use = FALSE;
+        p->in_use = false;
 
         /* if the disconnected channel has a pending role switch, clear it now */
         btm_acl_report_role_change(HCI_ERR_NO_CONNECTION, bda);
@@ -396,14 +396,14 @@
         /* Only notify if link up has had a chance to be issued */
         if (p->link_up_issued)
         {
-            p->link_up_issued = FALSE;
+            p->link_up_issued = false;
 
             /* If anyone cares, tell him database changed */
             if (btm_cb.p_bl_changed_cb)
             {
                 evt_data.event = BTM_BL_DISCN_EVT;
                 evt_data.discn.p_bda = bda;
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
                 evt_data.discn.handle = p->hci_handle;
                 evt_data.discn.transport = p->transport;
 #endif
@@ -413,7 +413,7 @@
             btm_acl_update_busy_level (BTM_BLI_ACL_DOWN_EVT);
         }
 
-#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
+#if (BLE_INCLUDED == TRUE)
 
         BTM_TRACE_DEBUG ("acl hci_handle=%d transport=%d connectable_mode=0x%0x link_role=%d",
                           p->hci_handle,
@@ -473,7 +473,7 @@
 void btm_acl_device_down (void)
 {
     tACL_CONN   *p = &btm_cb.acl_db[0];
-    UINT16      xx;
+    uint16_t    xx;
     BTM_TRACE_DEBUG ("btm_acl_device_down");
     for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p++)
     {
@@ -497,7 +497,7 @@
 *******************************************************************************/
 void btm_acl_update_busy_level (tBTM_BLI_EVENT event)
 {
-    BOOLEAN old_inquiry_state = btm_cb.is_inquiry;
+    bool    old_inquiry_state = btm_cb.is_inquiry;
     tBTM_BL_UPDATE_DATA  evt;
     evt.busy_level_flags = 0;
     switch (event)
@@ -510,32 +510,32 @@
             break;
         case BTM_BLI_PAGE_EVT:
             BTM_TRACE_DEBUG ("BTM_BLI_PAGE_EVT");
-            btm_cb.is_paging = TRUE;
+            btm_cb.is_paging = true;
             evt.busy_level_flags= BTM_BL_PAGING_STARTED;
             break;
         case BTM_BLI_PAGE_DONE_EVT:
             BTM_TRACE_DEBUG ("BTM_BLI_PAGE_DONE_EVT");
-            btm_cb.is_paging = FALSE;
+            btm_cb.is_paging = false;
             evt.busy_level_flags = BTM_BL_PAGING_COMPLETE;
             break;
         case BTM_BLI_INQ_EVT:
             BTM_TRACE_DEBUG ("BTM_BLI_INQ_EVT");
-            btm_cb.is_inquiry = TRUE;
+            btm_cb.is_inquiry = true;
             evt.busy_level_flags = BTM_BL_INQUIRY_STARTED;
             break;
         case BTM_BLI_INQ_CANCEL_EVT:
             BTM_TRACE_DEBUG ("BTM_BLI_INQ_CANCEL_EVT");
-            btm_cb.is_inquiry = FALSE;
+            btm_cb.is_inquiry = false;
             evt.busy_level_flags = BTM_BL_INQUIRY_CANCELLED;
             break;
         case BTM_BLI_INQ_DONE_EVT:
             BTM_TRACE_DEBUG ("BTM_BLI_INQ_DONE_EVT");
-            btm_cb.is_inquiry = FALSE;
+            btm_cb.is_inquiry = false;
             evt.busy_level_flags = BTM_BL_INQUIRY_COMPLETE;
             break;
     }
 
-    UINT8 busy_level;
+    uint8_t busy_level;
     if (btm_cb.is_paging || btm_cb.is_inquiry)
         busy_level = 10;
     else
@@ -564,7 +564,7 @@
 **                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
 **
 *******************************************************************************/
-tBTM_STATUS BTM_GetRole (BD_ADDR remote_bd_addr, UINT8 *p_role)
+tBTM_STATUS BTM_GetRole (BD_ADDR remote_bd_addr, uint8_t *p_role)
 {
     tACL_CONN   *p;
     BTM_TRACE_DEBUG ("BTM_GetRole");
@@ -597,12 +597,12 @@
 **                  BTM_BUSY if the previous command is not completed
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr, UINT8 new_role, tBTM_CMPL_CB *p_cb)
+tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr, uint8_t new_role, tBTM_CMPL_CB *p_cb)
 {
     tACL_CONN   *p;
     tBTM_SEC_DEV_REC  *p_dev_rec = NULL;
-#if BTM_SCO_INCLUDED == TRUE
-    BOOLEAN    is_sco_active;
+#if (BTM_SCO_INCLUDED == TRUE)
+    bool       is_sco_active;
 #endif
     tBTM_STATUS  status;
     tBTM_PM_MODE pwr_mode;
@@ -636,11 +636,11 @@
     if (p->link_role == new_role)
         return(BTM_SUCCESS);
 
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
     /* Check if there is any SCO Active on this BD Address */
     is_sco_active = btm_is_sco_active_by_bdaddr(remote_bd_addr);
 
-    if (is_sco_active == TRUE)
+    if (is_sco_active == true)
         return(BTM_NO_RESOURCES);
 #endif
 
@@ -677,7 +677,7 @@
             /* bypass turning off encryption if change link key is already doing it */
             if (p->encrypt_state != BTM_ACL_ENCRYPT_STATE_ENCRYPT_OFF)
             {
-                if (!btsnd_hcic_set_conn_encrypt (p->hci_handle, FALSE))
+                if (!btsnd_hcic_set_conn_encrypt (p->hci_handle, false))
                     return(BTM_NO_RESOURCES);
                 else
                     p->encrypt_state = BTM_ACL_ENCRYPT_STATE_ENCRYPT_OFF;
@@ -692,7 +692,7 @@
 
             p->switch_role_state = BTM_ACL_SWKEY_STATE_IN_PROGRESS;
 
-#if BTM_DISC_DURING_RS == TRUE
+#if (BTM_DISC_DURING_RS == TRUE)
             if (p_dev_rec)
                 p_dev_rec->rs_disc_pending = BTM_SEC_RS_PENDING;
 #endif
@@ -724,10 +724,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_acl_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable)
+void btm_acl_encrypt_change (uint16_t handle, uint8_t status, uint8_t encr_enable)
 {
     tACL_CONN *p;
-    UINT8     xx;
+    uint8_t   xx;
     tBTM_SEC_DEV_REC  *p_dev_rec;
     tBTM_BL_ROLE_CHG_DATA   evt;
 
@@ -755,13 +755,13 @@
             p->encrypt_state = BTM_ACL_ENCRYPT_STATE_TEMP_FUNC;
         }
 
-        if (!btsnd_hcic_switch_role (p->remote_addr, (UINT8)!p->link_role))
+        if (!btsnd_hcic_switch_role (p->remote_addr, (uint8_t)!p->link_role))
         {
             p->switch_role_state = BTM_ACL_SWKEY_STATE_IDLE;
             p->encrypt_state = BTM_ACL_ENCRYPT_STATE_IDLE;
             btm_acl_report_role_change(btm_cb.devcb.switch_role_ref_data.hci_status, p->remote_addr);
         }
-#if BTM_DISC_DURING_RS == TRUE
+#if (BTM_DISC_DURING_RS == TRUE)
         else
         {
             if ((p_dev_rec = btm_find_dev (p->remote_addr)) != NULL)
@@ -790,7 +790,7 @@
                              evt.new_role, evt.hci_status, p->switch_role_state);
         }
 
-#if BTM_DISC_DURING_RS == TRUE
+#if (BTM_DISC_DURING_RS == TRUE)
         /* If a disconnect is pending, issue it now that role switch has completed */
         if ((p_dev_rec = btm_find_dev (p->remote_addr)) != NULL)
         {
@@ -815,10 +815,10 @@
 ** Returns          status of the operation
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetLinkPolicy (BD_ADDR remote_bda, UINT16 *settings)
+tBTM_STATUS BTM_SetLinkPolicy (BD_ADDR remote_bda, uint16_t *settings)
 {
     tACL_CONN   *p;
-    UINT8       *localFeatures = BTM_ReadLocalFeatures();
+    uint8_t     *localFeatures = BTM_ReadLocalFeatures();
     BTM_TRACE_DEBUG ("BTM_SetLinkPolicy");
 /*    BTM_TRACE_API ("BTM_SetLinkPolicy: requested settings: 0x%04x", *settings ); */
 
@@ -864,9 +864,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void BTM_SetDefaultLinkPolicy (UINT16 settings)
+void BTM_SetDefaultLinkPolicy (uint16_t settings)
 {
-    UINT8 *localFeatures = BTM_ReadLocalFeatures();
+    uint8_t *localFeatures = BTM_ReadLocalFeatures();
 
     BTM_TRACE_DEBUG("BTM_SetDefaultLinkPolicy setting:0x%04x", settings);
 
@@ -908,11 +908,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_remote_version_complete (UINT8 *p)
+void btm_read_remote_version_complete (uint8_t *p)
 {
     tACL_CONN        *p_acl_cb = &btm_cb.acl_db[0];
-    UINT8             status;
-    UINT16            handle;
+    uint8_t           status;
+    uint16_t          handle;
     int               xx;
     BTM_TRACE_DEBUG ("btm_read_remote_version_complete");
 
@@ -931,10 +931,10 @@
                 STREAM_TO_UINT16 (p_acl_cb->lmp_subversion, p);
             }
 
-#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
+#if (BLE_INCLUDED == TRUE)
             if (p_acl_cb->transport == BT_TRANSPORT_LE)
                 l2cble_notify_le_connection (p_acl_cb->remote_addr);
-#endif  // (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
+#endif  // (defined(BLE_INCLUDED) && (BLE_INCLUDED == true))
             break;
         }
     }
@@ -951,11 +951,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_process_remote_ext_features (tACL_CONN *p_acl_cb, UINT8 num_read_pages)
+void btm_process_remote_ext_features (tACL_CONN *p_acl_cb, uint8_t num_read_pages)
 {
-    UINT16              handle = p_acl_cb->hci_handle;
+    uint16_t            handle = p_acl_cb->hci_handle;
     tBTM_SEC_DEV_REC    *p_dev_rec = btm_find_dev_by_handle (handle);
-    UINT8               page_idx;
+    uint8_t             page_idx;
 
     BTM_TRACE_DEBUG ("btm_process_remote_ext_features");
 
@@ -974,19 +974,19 @@
     {
         if (page_idx > HCI_EXT_FEATURES_PAGE_MAX)
         {
-            BTM_TRACE_ERROR("%s: page=%d unexpected", __FUNCTION__, page_idx);
+            BTM_TRACE_ERROR("%s: page=%d unexpected", __func__, page_idx);
             break;
         }
         memcpy (p_dev_rec->features[page_idx], p_acl_cb->peer_lmp_features[page_idx],
                 HCI_FEATURE_BYTES_PER_PAGE);
     }
 
-    const UINT8 req_pend = (p_dev_rec->sm4 & BTM_SM4_REQ_PEND);
+    const uint8_t req_pend = (p_dev_rec->sm4 & BTM_SM4_REQ_PEND);
 
     /* Store the Peer Security Capabilites (in SM4 and rmt_sec_caps) */
     btm_sec_set_peer_sec_caps(p_acl_cb, p_dev_rec);
 
-    BTM_TRACE_API("%s: pend:%d", __FUNCTION__, req_pend);
+    BTM_TRACE_API("%s: pend:%d", __func__, req_pend);
     if (req_pend)
     {
         /* Request for remaining Security Features (if any) */
@@ -1005,9 +1005,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_remote_features (UINT16 handle)
+void btm_read_remote_features (uint16_t handle)
 {
-    UINT8       acl_idx;
+    uint8_t     acl_idx;
     tACL_CONN   *p_acl_cb;
 
     BTM_TRACE_DEBUG("btm_read_remote_features() handle: %d", handle);
@@ -1037,7 +1037,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_remote_ext_features (UINT16 handle, UINT8 page_number)
+void btm_read_remote_ext_features (uint16_t handle, uint8_t page_number)
 {
     BTM_TRACE_DEBUG("btm_read_remote_ext_features() handle: %d page: %d", handle, page_number);
 
@@ -1055,12 +1055,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_remote_features_complete (UINT8 *p)
+void btm_read_remote_features_complete (uint8_t *p)
 {
     tACL_CONN        *p_acl_cb;
-    UINT8             status;
-    UINT16            handle;
-    UINT8            acl_idx;
+    uint8_t           status;
+    uint16_t          handle;
+    uint8_t          acl_idx;
 
     BTM_TRACE_DEBUG ("btm_read_remote_features_complete");
     STREAM_TO_UINT8  (status, p);
@@ -1114,12 +1114,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_remote_ext_features_complete (UINT8 *p)
+void btm_read_remote_ext_features_complete (uint8_t *p)
 {
     tACL_CONN   *p_acl_cb;
-    UINT8       page_num, max_page;
-    UINT16      handle;
-    UINT8       acl_idx;
+    uint8_t     page_num, max_page;
+    uint16_t    handle;
+    uint8_t     acl_idx;
 
     BTM_TRACE_DEBUG ("btm_read_remote_ext_features_complete");
 
@@ -1160,7 +1160,7 @@
     BTM_TRACE_DEBUG("BTM reached last remote extended features page (%d)", page_num);
 
     /* Process the pages */
-    btm_process_remote_ext_features (p_acl_cb, (UINT8) (page_num + 1));
+    btm_process_remote_ext_features (p_acl_cb, (uint8_t) (page_num + 1));
 
     /* Continue with HCI connection establishment */
     btm_establish_continue (p_acl_cb);
@@ -1176,10 +1176,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_remote_ext_features_failed (UINT8 status, UINT16 handle)
+void btm_read_remote_ext_features_failed (uint8_t status, uint16_t handle)
 {
     tACL_CONN   *p_acl_cb;
-    UINT8       acl_idx;
+    uint8_t     acl_idx;
 
     BTM_TRACE_WARNING ("btm_read_remote_ext_features_failed (status 0x%02x) for handle %d",
                          status, handle);
@@ -1213,8 +1213,8 @@
 {
         tBTM_BL_EVENT_DATA  evt_data;
         BTM_TRACE_DEBUG ("btm_establish_continue");
-#if (!defined(BTM_BYPASS_EXTRA_ACL_SETUP) || BTM_BYPASS_EXTRA_ACL_SETUP == FALSE)
-#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
+#if (BTM_BYPASS_EXTRA_ACL_SETUP == FALSE)
+#if (BLE_INCLUDED == TRUE)
         if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR)
 #endif
         {
@@ -1227,7 +1227,7 @@
                 BTM_SetLinkPolicy (p_acl_cb->remote_addr, &btm_cb.btm_def_link_policy);
         }
 #endif
-        p_acl_cb->link_up_issued = TRUE;
+        p_acl_cb->link_up_issued = true;
 
         /* If anyone cares, tell him database changed */
         if (btm_cb.p_bl_changed_cb)
@@ -1237,7 +1237,7 @@
             evt_data.conn.p_bdn = p_acl_cb->remote_name;
             evt_data.conn.p_dc  = p_acl_cb->remote_dc;
             evt_data.conn.p_features = p_acl_cb->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0];
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             evt_data.conn.handle = p_acl_cb->hci_handle;
             evt_data.conn.transport = p_acl_cb->transport;
 #endif
@@ -1258,7 +1258,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void BTM_SetDefaultLinkSuperTout (UINT16 timeout)
+void BTM_SetDefaultLinkSuperTout (uint16_t timeout)
 {
     BTM_TRACE_DEBUG ("BTM_SetDefaultLinkSuperTout");
     btm_cb.btm_def_link_super_tout = timeout;
@@ -1273,7 +1273,7 @@
 ** Returns          status of the operation
 **
 *******************************************************************************/
-tBTM_STATUS BTM_GetLinkSuperTout (BD_ADDR remote_bda, UINT16 *p_timeout)
+tBTM_STATUS BTM_GetLinkSuperTout (BD_ADDR remote_bda, uint16_t *p_timeout)
 {
     tACL_CONN   *p = btm_bda_to_acl(remote_bda, BT_TRANSPORT_BR_EDR);
 
@@ -1297,7 +1297,7 @@
 ** Returns          status of the operation
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetLinkSuperTout (BD_ADDR remote_bda, UINT16 timeout)
+tBTM_STATUS BTM_SetLinkSuperTout (BD_ADDR remote_bda, uint16_t timeout)
 {
     tACL_CONN   *p = btm_bda_to_acl(remote_bda, BT_TRANSPORT_BR_EDR);
 
@@ -1330,10 +1330,10 @@
 ** Description      This function is called to check if an ACL connection exists
 **                  to a specific remote BD Address.
 **
-** Returns          TRUE if connection is up, else FALSE.
+** Returns          true if connection is up, else false.
 **
 *******************************************************************************/
-BOOLEAN BTM_IsAclConnectionUp (BD_ADDR remote_bda, tBT_TRANSPORT transport)
+bool    BTM_IsAclConnectionUp (BD_ADDR remote_bda, tBT_TRANSPORT transport)
 {
     tACL_CONN   *p;
 
@@ -1344,11 +1344,11 @@
     p = btm_bda_to_acl(remote_bda, transport);
     if (p != (tACL_CONN *)NULL)
     {
-        return(TRUE);
+        return(true);
     }
 
     /* If here, no BD Addr found */
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -1358,10 +1358,10 @@
 ** Description      This function is called to count the number of
 **                  ACL links that are active.
 **
-** Returns          UINT16  Number of active ACL links
+** Returns          uint16_t Number of active ACL links
 **
 *******************************************************************************/
-UINT16 BTM_GetNumAclLinks (void)
+uint16_t BTM_GetNumAclLinks (void)
 {
     uint16_t num_acl = 0;
 
@@ -1381,12 +1381,12 @@
 ** Description      This function is called to get the disconnection reason code
 **                  returned by the HCI at disconnection complete event.
 **
-** Returns          TRUE if connection is up, else FALSE.
+** Returns          true if connection is up, else false.
 **
 *******************************************************************************/
-UINT16 btm_get_acl_disc_reason_code (void)
+uint16_t btm_get_acl_disc_reason_code (void)
 {
-    UINT8 res = btm_cb.acl_disc_reason;
+    uint8_t res = btm_cb.acl_disc_reason;
     BTM_TRACE_DEBUG ("btm_get_acl_disc_reason_code");
     return(res);
 }
@@ -1402,7 +1402,7 @@
 ** Returns          the handle of the connection, or 0xFFFF if none.
 **
 *******************************************************************************/
-UINT16 BTM_GetHCIConnHandle (BD_ADDR remote_bda, tBT_TRANSPORT transport)
+uint16_t BTM_GetHCIConnHandle (BD_ADDR remote_bda, tBT_TRANSPORT transport)
 {
     tACL_CONN   *p;
     BTM_TRACE_DEBUG ("BTM_GetHCIConnHandle");
@@ -1428,9 +1428,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_process_clk_off_comp_evt (UINT16 hci_handle, UINT16 clock_offset)
+void btm_process_clk_off_comp_evt (uint16_t hci_handle, uint16_t clock_offset)
 {
-    UINT8      xx;
+    uint8_t    xx;
     BTM_TRACE_DEBUG ("btm_process_clk_off_comp_evt");
     /* Look up the connection by handle and set the current mode */
     if ((xx = btm_handle_to_acl_index(hci_handle)) < MAX_L2CAP_LINKS)
@@ -1449,9 +1449,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_acl_role_changed (UINT8 hci_status, BD_ADDR bd_addr, UINT8 new_role)
+void btm_acl_role_changed (uint8_t hci_status, BD_ADDR bd_addr, uint8_t new_role)
 {
-    UINT8                   *p_bda = (bd_addr) ? bd_addr :
+    uint8_t                 *p_bda = (bd_addr) ? bd_addr :
                                         btm_cb.devcb.switch_role_ref_data.remote_bd_addr;
     tACL_CONN               *p = btm_bda_to_acl(p_bda, BT_TRANSPORT_BR_EDR);
     tBTM_ROLE_SWITCH_CMPL   *p_data = &btm_cb.devcb.switch_role_ref_data;
@@ -1497,7 +1497,7 @@
     /* if idle, we did not change encryption */
     if (p->switch_role_state == BTM_ACL_SWKEY_STATE_SWITCHING)
     {
-        if (btsnd_hcic_set_conn_encrypt (p->hci_handle, TRUE))
+        if (btsnd_hcic_set_conn_encrypt (p->hci_handle, true))
         {
             p->encrypt_state = BTM_ACL_ENCRYPT_STATE_ENCRYPT_ON;
             p->switch_role_state = BTM_ACL_SWKEY_STATE_ENCRYPTION_ON;
@@ -1529,7 +1529,7 @@
     BTM_TRACE_DEBUG("Role Switch Event: new_role 0x%02x, HCI Status 0x%02x, rs_st:%d",
                      p_data->role, p_data->hci_status, p->switch_role_state);
 
-#if BTM_DISC_DURING_RS == TRUE
+#if (BTM_DISC_DURING_RS == TRUE)
     /* If a disconnect is pending, issue it now that role switch has completed */
     if ((p_dev_rec = btm_find_dev (p_bda)) != NULL)
     {
@@ -1557,9 +1557,9 @@
 **
 *******************************************************************************/
 
-UINT8 BTM_AllocateSCN(void)
+uint8_t BTM_AllocateSCN(void)
 {
-    UINT8   x;
+    uint8_t x;
     BTM_TRACE_DEBUG ("BTM_AllocateSCN");
 
     // stack reserves scn 1 for HFP, HSP we still do the correct way
@@ -1567,7 +1567,7 @@
     {
         if (!btm_cb.btm_scn[x])
         {
-            btm_cb.btm_scn[x] = TRUE;
+            btm_cb.btm_scn[x] = true;
             return(x+1);
         }
     }
@@ -1581,26 +1581,26 @@
 **
 ** Description      Try to allocate a fixed server channel
 **
-** Returns          Returns TRUE if server channel was available
+** Returns          Returns true if server channel was available
 **
 *******************************************************************************/
 
-BOOLEAN BTM_TryAllocateSCN(UINT8 scn)
+bool    BTM_TryAllocateSCN(uint8_t scn)
 {
     /* Make sure we don't exceed max port range.
      * Stack reserves scn 1 for HFP, HSP we still do the correct way.
      */
     if ( (scn>=BTM_MAX_SCN) || (scn == 1) )
-        return FALSE;
+        return false;
 
     /* check if this port is available */
     if (!btm_cb.btm_scn[scn-1])
     {
-        btm_cb.btm_scn[scn-1] = TRUE;
-        return TRUE;
+        btm_cb.btm_scn[scn-1] = true;
+        return true;
     }
 
-    return (FALSE);     /* Port was busy */
+    return (false);     /* Port was busy */
 }
 
 /*******************************************************************************
@@ -1609,19 +1609,19 @@
 **
 ** Description      Free the specified SCN.
 **
-** Returns          TRUE or FALSE
+** Returns          true or false
 **
 *******************************************************************************/
-BOOLEAN BTM_FreeSCN(UINT8 scn)
+bool    BTM_FreeSCN(uint8_t scn)
 {
     BTM_TRACE_DEBUG ("BTM_FreeSCN ");
     if (scn <= BTM_MAX_SCN)
     {
-        btm_cb.btm_scn[scn-1] = FALSE;
-        return(TRUE);
+        btm_cb.btm_scn[scn-1] = false;
+        return(true);
     }
     else
-        return(FALSE);      /* Illegal SCN passed in */
+        return(false);      /* Illegal SCN passed in */
 }
 
 /*******************************************************************************
@@ -1635,9 +1635,9 @@
 ** Returns          status of the operation
 **
 *******************************************************************************/
-tBTM_STATUS btm_set_packet_types (tACL_CONN *p, UINT16 pkt_types)
+tBTM_STATUS btm_set_packet_types (tACL_CONN *p, uint16_t pkt_types)
 {
-    UINT16 temp_pkt_types;
+    uint16_t temp_pkt_types;
     BTM_TRACE_DEBUG ("btm_set_packet_types");
     /* Save in the ACL control blocks, types that we support */
     temp_pkt_types = (pkt_types & BTM_ACL_SUPPORTED_PKTS_MASK &
@@ -1670,11 +1670,11 @@
 **                  connection, 0 if connection is not established
 **
 *******************************************************************************/
-UINT16 btm_get_max_packet_size (BD_ADDR addr)
+uint16_t btm_get_max_packet_size (BD_ADDR addr)
 {
     tACL_CONN   *p = btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
-    UINT16      pkt_types = 0;
-    UINT16      pkt_size = 0;
+    uint16_t    pkt_types = 0;
+    uint16_t    pkt_size = 0;
     BTM_TRACE_DEBUG ("btm_get_max_packet_size");
     if (p != NULL)
     {
@@ -1727,8 +1727,8 @@
 ** Returns          If connected report peer device info
 **
 *******************************************************************************/
-tBTM_STATUS BTM_ReadRemoteVersion (BD_ADDR addr, UINT8 *lmp_version,
-                                   UINT16 *manufacturer, UINT16 *lmp_sub_version)
+tBTM_STATUS BTM_ReadRemoteVersion (BD_ADDR addr, uint8_t *lmp_version,
+                                   uint16_t *manufacturer, uint16_t *lmp_sub_version)
 {
     tACL_CONN        *p = btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
     BTM_TRACE_DEBUG ("BTM_ReadRemoteVersion");
@@ -1754,7 +1754,7 @@
 ** Returns          pointer to the remote supported features mask (8 bytes)
 **
 *******************************************************************************/
-UINT8 *BTM_ReadRemoteFeatures (BD_ADDR addr)
+uint8_t *BTM_ReadRemoteFeatures (BD_ADDR addr)
 {
     tACL_CONN        *p = btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
     BTM_TRACE_DEBUG ("BTM_ReadRemoteFeatures");
@@ -1774,7 +1774,7 @@
 **                  or NULL if bad page
 **
 *******************************************************************************/
-UINT8 *BTM_ReadRemoteExtendedFeatures (BD_ADDR addr, UINT8 page_number)
+uint8_t *BTM_ReadRemoteExtendedFeatures (BD_ADDR addr, uint8_t page_number)
 {
     tACL_CONN        *p = btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
     BTM_TRACE_DEBUG ("BTM_ReadRemoteExtendedFeatures");
@@ -1799,7 +1799,7 @@
 ** Returns          number of features pages read from the remote device.
 **
 *******************************************************************************/
-UINT8 BTM_ReadNumberRemoteFeaturesPages (BD_ADDR addr)
+uint8_t BTM_ReadNumberRemoteFeaturesPages (BD_ADDR addr)
 {
     tACL_CONN        *p = btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
     BTM_TRACE_DEBUG ("BTM_ReadNumberRemoteFeaturesPages");
@@ -1818,7 +1818,7 @@
 ** Returns          pointer to all features of the remote (24 bytes).
 **
 *******************************************************************************/
-UINT8 *BTM_ReadAllRemoteFeatures (BD_ADDR addr)
+uint8_t *BTM_ReadAllRemoteFeatures (BD_ADDR addr)
 {
     tACL_CONN        *p = btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
     BTM_TRACE_DEBUG ("BTM_ReadAllRemoteFeatures");
@@ -1840,7 +1840,7 @@
 ** Returns          BTM_SUCCESS if successfully registered, otherwise error
 **
 *******************************************************************************/
-tBTM_STATUS BTM_RegBusyLevelNotif (tBTM_BL_CHANGE_CB *p_cb, UINT8 *p_level,
+tBTM_STATUS BTM_RegBusyLevelNotif (tBTM_BL_CHANGE_CB *p_cb, uint8_t *p_level,
                                    tBTM_BL_EVENT_MASK evt_mask)
 {
     BTM_TRACE_DEBUG ("BTM_RegBusyLevelNotif");
@@ -1931,7 +1931,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_qos_setup_complete(UINT8 status, UINT16 handle, FLOW_SPEC *p_flow)
+void btm_qos_setup_complete(uint8_t status, uint16_t handle, FLOW_SPEC *p_flow)
 {
     tBTM_CMPL_CB            *p_cb = btm_cb.devcb.p_qos_setup_cmpl_cb;
     tBTM_QOS_SETUP_CMPL     qossu;
@@ -1976,7 +1976,7 @@
 {
     tACL_CONN   *p;
     tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     tBT_DEVICE_TYPE dev_type;
     tBLE_ADDR_TYPE  addr_type;
 #endif
@@ -1988,7 +1988,7 @@
     if (btm_cb.devcb.p_rssi_cmpl_cb)
         return(BTM_BUSY);
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     BTM_ReadDevInfo(remote_bda, &dev_type, &addr_type);
     if (dev_type == BT_DEVICE_TYPE_BLE)
         transport = BT_TRANSPORT_LE;
@@ -2077,7 +2077,7 @@
 tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb)
 {
     tACL_CONN   *p;
-    BOOLEAN     ret;
+    bool        ret;
 #define BTM_READ_RSSI_TYPE_CUR  0x00
 #define BTM_READ_RSSI_TYPE_MAX  0X01
 
@@ -2098,7 +2098,7 @@
                        btm_read_tx_power_timeout, NULL,
                        btu_general_alarm_queue);
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         if (p->transport == BT_TRANSPORT_LE)
         {
             memcpy(btm_cb.devcb.read_tx_pwr_addr, remote_bda, BD_ADDR_LEN);
@@ -2150,13 +2150,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_tx_power_complete(UINT8 *p, BOOLEAN is_ble)
+void btm_read_tx_power_complete(uint8_t *p, bool    is_ble)
 {
     tBTM_CMPL_CB            *p_cb = btm_cb.devcb.p_tx_power_cmpl_cb;
     tBTM_TX_POWER_RESULTS   results;
-    UINT16                   handle;
+    uint16_t                 handle;
     tACL_CONN               *p_acl_cb = &btm_cb.acl_db[0];
-    UINT16                   index;
+    uint16_t                 index;
 
     BTM_TRACE_DEBUG("%s", __func__);
     alarm_cancel(btm_cb.devcb.read_tx_power_timer);
@@ -2186,7 +2186,7 @@
                     }
                 }
             }
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             else
             {
                 STREAM_TO_UINT8 (results.tx_power, p);
@@ -2230,13 +2230,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_rssi_complete (UINT8 *p)
+void btm_read_rssi_complete (uint8_t *p)
 {
     tBTM_CMPL_CB            *p_cb = btm_cb.devcb.p_rssi_cmpl_cb;
     tBTM_RSSI_RESULTS        results;
-    UINT16                   handle;
+    uint16_t                 handle;
     tACL_CONN               *p_acl_cb = &btm_cb.acl_db[0];
-    UINT16                   index;
+    uint16_t                 index;
 
     BTM_TRACE_DEBUG("%s", __func__);
     alarm_cancel(btm_cb.devcb.read_rssi_timer);
@@ -2301,13 +2301,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_link_quality_complete(UINT8 *p)
+void btm_read_link_quality_complete(uint8_t *p)
 {
     tBTM_CMPL_CB            *p_cb = btm_cb.devcb.p_link_qual_cmpl_cb;
     tBTM_LINK_QUALITY_RESULTS results;
-    UINT16                   handle;
+    uint16_t                 handle;
     tACL_CONN               *p_acl_cb = &btm_cb.acl_db[0];
-    UINT16                   index;
+    uint16_t                 index;
 
     BTM_TRACE_DEBUG("%s", __func__);
     alarm_cancel(btm_cb.devcb.read_link_quality_timer);
@@ -2356,11 +2356,11 @@
 *******************************************************************************/
 tBTM_STATUS btm_remove_acl (BD_ADDR bd_addr, tBT_TRANSPORT transport)
 {
-    UINT16  hci_handle = BTM_GetHCIConnHandle(bd_addr, transport);
+    uint16_t hci_handle = BTM_GetHCIConnHandle(bd_addr, transport);
     tBTM_STATUS status = BTM_SUCCESS;
 
     BTM_TRACE_DEBUG ("btm_remove_acl");
-#if BTM_DISC_DURING_RS == TRUE
+#if (BTM_DISC_DURING_RS == TRUE)
     tBTM_SEC_DEV_REC  *p_dev_rec = btm_find_dev (bd_addr);
 
     /* Role Switch is pending, postpone until completed */
@@ -2395,7 +2395,7 @@
 ** Returns          The new or current trace level
 **
 *******************************************************************************/
-UINT8 BTM_SetTraceLevel (UINT8 new_level)
+uint8_t BTM_SetTraceLevel (uint8_t new_level)
 {
     BTM_TRACE_DEBUG ("BTM_SetTraceLevel");
     if (new_level != 0xFF)
@@ -2416,9 +2416,9 @@
 **
 *******************************************************************************/
 void btm_cont_rswitch (tACL_CONN *p, tBTM_SEC_DEV_REC *p_dev_rec,
-                                     UINT8 hci_status)
+                                     uint8_t hci_status)
 {
-    BOOLEAN sw_ok = TRUE;
+    bool    sw_ok = true;
     BTM_TRACE_DEBUG ("btm_cont_rswitch");
     /* Check to see if encryption needs to be turned off if pending
        change of link key or role switch */
@@ -2429,7 +2429,7 @@
         if (p_dev_rec != NULL && ((p_dev_rec->sec_flags & BTM_SEC_ENCRYPTED) != 0)
             && !BTM_EPR_AVAILABLE(p))
         {
-            if (btsnd_hcic_set_conn_encrypt (p->hci_handle, FALSE))
+            if (btsnd_hcic_set_conn_encrypt (p->hci_handle, false))
             {
                 p->encrypt_state = BTM_ACL_ENCRYPT_STATE_ENCRYPT_OFF;
                 if (p->switch_role_state == BTM_ACL_SWKEY_STATE_MODE_CHANGE)
@@ -2439,7 +2439,7 @@
             {
                 /* Error occurred; set states back to Idle */
                 if (p->switch_role_state == BTM_ACL_SWKEY_STATE_MODE_CHANGE)
-                    sw_ok = FALSE;
+                    sw_ok = false;
             }
         }
         else    /* Encryption not used or EPR supported, continue with switch
@@ -2448,11 +2448,11 @@
             if (p->switch_role_state == BTM_ACL_SWKEY_STATE_MODE_CHANGE)
             {
                 p->switch_role_state = BTM_ACL_SWKEY_STATE_IN_PROGRESS;
-#if BTM_DISC_DURING_RS == TRUE
+#if (BTM_DISC_DURING_RS == TRUE)
                 if (p_dev_rec)
                     p_dev_rec->rs_disc_pending = BTM_SEC_RS_PENDING;
 #endif
-                sw_ok = btsnd_hcic_switch_role (p->remote_addr, (UINT8)!p->link_role);
+                sw_ok = btsnd_hcic_switch_role (p->remote_addr, (uint8_t)!p->link_role);
             }
         }
 
@@ -2475,7 +2475,7 @@
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
     BT_HDR  *p_buf;
-    UINT8   *pp;
+    uint8_t *pp;
     BD_ADDR bda;
     BTM_TRACE_DEBUG ("btm_acl_resubmit_page");
     /* If there were other page request schedule can start the next one */
@@ -2483,7 +2483,7 @@
     {
         /* skip 3 (2 bytes opcode and 1 byte len) to get to the bd_addr
          * for both create_conn and rmt_name */
-        pp = (UINT8 *)(p_buf + 1) + p_buf->offset + 3;
+        pp = (uint8_t *)(p_buf + 1) + p_buf->offset + 3;
 
         STREAM_TO_BDADDR (bda, pp);
 
@@ -2495,14 +2495,14 @@
         btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p_buf);
     }
     else
-        btm_cb.paging = FALSE;
+        btm_cb.paging = false;
 }
 
 /*******************************************************************************
 **
 ** Function         btm_acl_reset_paging
 **
-** Description      set paging to FALSE and free the page queue - called at hci_reset
+** Description      set paging to false and free the page queue - called at hci_reset
 **
 *******************************************************************************/
 void  btm_acl_reset_paging (void)
@@ -2513,7 +2513,7 @@
     while ((p = (BT_HDR *)fixed_queue_try_dequeue(btm_cb.page_queue)) != NULL)
         osi_free(p);
 
-    btm_cb.paging = FALSE;
+    btm_cb.paging = false;
 }
 
 /*******************************************************************************
@@ -2532,7 +2532,7 @@
                       (bda[0]<<16) + (bda[1]<<8) + bda[2], (bda[3]<<16) + (bda[4] << 8) + bda[5]);
     if (btm_cb.discing)
     {
-        btm_cb.paging = TRUE;
+        btm_cb.paging = true;
         fixed_queue_enqueue(btm_cb.page_queue, p);
     }
     else
@@ -2558,7 +2558,7 @@
                 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
             }
 
-            btm_cb.paging = TRUE;
+            btm_cb.paging = true;
         }
         else /* ACL is already up */
         {
@@ -2573,11 +2573,11 @@
 **
 ** Description      Send connection collision event to upper layer if registered
 **
-** Returns          TRUE if sent out to upper layer,
-**                  FALSE if no one needs the notification.
+** Returns          true if sent out to upper layer,
+**                  false if no one needs the notification.
 **
 *******************************************************************************/
-BOOLEAN  btm_acl_notif_conn_collision (BD_ADDR bda)
+bool     btm_acl_notif_conn_collision (BD_ADDR bda)
 {
     tBTM_BL_EVENT_DATA  evt_data;
 
@@ -2590,15 +2590,15 @@
         evt_data.event = BTM_BL_COLLISION_EVT;
         evt_data.conn.p_bda = bda;
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         evt_data.conn.transport = BT_TRANSPORT_BR_EDR;
         evt_data.conn.handle = BTM_INVALID_HCI_HANDLE;
 #endif
         (*btm_cb.p_bl_changed_cb)(&evt_data);
-        return TRUE;
+        return true;
     }
     else
-        return FALSE;
+        return false;
 }
 
 
@@ -2609,7 +2609,7 @@
 ** Description      Check if peer supports requested packets
 **
 *******************************************************************************/
-void btm_acl_chk_peer_pkt_type_support (tACL_CONN *p, UINT16 *p_pkt_type)
+void btm_acl_chk_peer_pkt_type_support (tACL_CONN *p, uint16_t *p_pkt_type)
 {
     /* 3 and 5 slot packets? */
     if (!HCI_3_SLOT_PACKETS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0]))
diff --git a/stack/btm/btm_ble.c b/stack/btm/btm_ble.c
index 40cd9d6..c3ba338 100644
--- a/stack/btm/btm_ble.c
+++ b/stack/btm/btm_ble.c
@@ -27,7 +27,7 @@
 
 #include "bt_target.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
 #include <string.h>
 
@@ -43,11 +43,11 @@
 #include "osi/include/log.h"
 #include "smp_api.h"
 
-#if SMP_INCLUDED == TRUE
-extern BOOLEAN aes_cipher_msg_auth_code(BT_OCTET16 key, UINT8 *input, UINT16 length,
-                                                 UINT16 tlen, UINT8 *p_signature);
-extern void smp_link_encrypted(BD_ADDR bda, UINT8 encr_enable);
-extern BOOLEAN smp_proc_ltk_request(BD_ADDR bda);
+#if (SMP_INCLUDED == TRUE)
+extern bool    aes_cipher_msg_auth_code(BT_OCTET16 key, uint8_t *input, uint16_t length,
+                                                 uint16_t tlen, uint8_t *p_signature);
+extern void smp_link_encrypted(BD_ADDR bda, uint8_t encr_enable);
+extern bool    smp_proc_ltk_request(BD_ADDR bda);
 #endif
 extern void gatt_notify_enc_cmpl(BD_ADDR bd_addr);
 /*******************************************************************************/
@@ -66,10 +66,10 @@
 **                  dev_type         - Remote device's device type.
 **                  addr_type        - LE device address type.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE dev_type,
+bool    BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE dev_type,
                              tBLE_ADDR_TYPE addr_type)
 {
     BTM_TRACE_DEBUG ("%s: dev_type=0x%x", __func__, dev_type);
@@ -78,7 +78,7 @@
     if (!p_dev_rec) {
         if (list_length(btm_cb.sec_dev_rec) > BTM_SEC_MAX_DEVICE_RECORDS) {
             BTM_TRACE_ERROR("%s: %d max devices reached!", __func__, BTM_SEC_MAX_DEVICE_RECORDS);
-            return FALSE;
+            return false;
         }
 
         p_dev_rec = osi_calloc(sizeof(tBTM_SEC_DEV_REC));
@@ -119,7 +119,7 @@
                          p_info->results.device_type, p_info->results.ble_addr_type);
     }
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -134,12 +134,12 @@
 **                  p_le_key         - LE key values.
 **                  key_type         - LE SMP key type.
 *
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key, tBTM_LE_KEY_TYPE key_type)
+bool    BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key, tBTM_LE_KEY_TYPE key_type)
 {
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
     tBTM_SEC_DEV_REC  *p_dev_rec;
     BTM_TRACE_DEBUG ("BTM_SecAddBleKey");
     p_dev_rec = btm_find_dev (bd_addr);
@@ -152,14 +152,14 @@
                         for bdaddr: %08x%04x, Type: %d",
                             (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8)+bd_addr[3],
                             (bd_addr[4]<<8)+bd_addr[5], key_type);
-        return(FALSE);
+        return(false);
     }
 
     BTM_TRACE_DEBUG ("BTM_SecAddLeKey()  BDA: %08x%04x, Type: 0x%02x",
                       (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8)+bd_addr[3],
                       (bd_addr[4]<<8)+bd_addr[5], key_type);
 
-    btm_sec_save_le_key (bd_addr, key_type, p_le_key, FALSE);
+    btm_sec_save_le_key (bd_addr, key_type, p_le_key, false);
 
 #if (BLE_PRIVACY_SPT == TRUE)
     if (key_type == BTM_LE_KEY_PID || key_type == BTM_LE_KEY_LID)
@@ -168,7 +168,7 @@
 
 #endif
 
-    return(TRUE);
+    return(true);
 }
 
 /*******************************************************************************
@@ -184,7 +184,7 @@
 ** Returns          non2.
 **
 *******************************************************************************/
-void BTM_BleLoadLocalKeys(UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key)
+void BTM_BleLoadLocalKeys(uint8_t key_type, tBTM_BLE_LOCAL_KEYS *p_key)
 {
     tBTM_DEVCB *p_devcb = &btm_cb.devcb;
     BTM_TRACE_DEBUG ("%s", __func__);
@@ -291,26 +291,26 @@
 ** Description      This function is called to check if the connection handle
 **                  for an LE link
 **
-** Returns          TRUE if connection is LE link, otherwise FALSE.
+** Returns          true if connection is LE link, otherwise false.
 **
 *******************************************************************************/
-BOOLEAN BTM_IsBleConnection (UINT16 conn_handle)
+bool    BTM_IsBleConnection (uint16_t conn_handle)
 {
 #if (BLE_INCLUDED == TRUE)
-    UINT8                xx;
+    uint8_t              xx;
     tACL_CONN            *p;
 
     BTM_TRACE_API ("BTM_IsBleConnection: conn_handle: %d", conn_handle);
 
     xx = btm_handle_to_acl_index (conn_handle);
     if (xx >= MAX_L2CAP_LINKS)
-        return FALSE;
+        return false;
 
     p = &btm_cb.acl_db[xx];
 
     return (p->transport == BT_TRANSPORT_LE);
 #else
-    return FALSE;
+    return false;
 #endif
 }
 
@@ -324,13 +324,13 @@
 **                conn_addr:connection address used
 **                p_addr_type : BD Address type, Public or Random of the address used
 **
-** Returns          BOOLEAN , TRUE if connection to remote device exists, else FALSE
+** Returns          bool    , true if connection to remote device exists, else false
 **
 *******************************************************************************/
-BOOLEAN BTM_ReadRemoteConnectionAddr(BD_ADDR pseudo_addr, BD_ADDR conn_addr,
+bool    BTM_ReadRemoteConnectionAddr(BD_ADDR pseudo_addr, BD_ADDR conn_addr,
                                                tBLE_ADDR_TYPE *p_addr_type)
 {
- BOOLEAN         st = TRUE;
+ bool            st = true;
 #if (BLE_PRIVACY_SPT == TRUE)
     tACL_CONN       *p = btm_bda_to_acl (pseudo_addr, BT_TRANSPORT_LE);
 
@@ -338,7 +338,7 @@
     {
         BTM_TRACE_ERROR("BTM_ReadRemoteConnectionAddr can not find connection"
                         " with matching address");
-        return FALSE;
+        return false;
     }
 
     memcpy(conn_addr, p->active_remote_addr, BD_ADDR_LEN);
@@ -368,9 +368,9 @@
 ** Returns          None
 **
 *******************************************************************************/
-void BTM_SecurityGrant(BD_ADDR bd_addr, UINT8 res)
+void BTM_SecurityGrant(BD_ADDR bd_addr, uint8_t res)
 {
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
     tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_REPEATED_ATTEMPTS;
     BTM_TRACE_DEBUG ("BTM_SecurityGrant");
     SMP_SecurityGrant(bd_addr, res_smp);
@@ -388,12 +388,12 @@
 **                  res          - result of the operation BTM_SUCCESS if success
 **                  key_len      - length in bytes of the Passkey
 **                  p_passkey        - pointer to array with the passkey
-**                  trusted_mask - bitwise OR of trusted services (array of UINT32)
+**                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
 **
 *******************************************************************************/
-void BTM_BlePasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey)
+void BTM_BlePasskeyReply (BD_ADDR bd_addr, uint8_t res, uint32_t passkey)
 {
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
     tBTM_SEC_DEV_REC  *p_dev_rec = btm_find_dev (bd_addr);
     tSMP_STATUS      res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_PASSKEY_ENTRY_FAIL;
 
@@ -421,7 +421,7 @@
 **                  res          - comparison result BTM_SUCCESS if success
 **
 *******************************************************************************/
-void BTM_BleConfirmReply (BD_ADDR bd_addr, UINT8 res)
+void BTM_BleConfirmReply (BD_ADDR bd_addr, uint8_t res)
 {
     tBTM_SEC_DEV_REC  *p_dev_rec = btm_find_dev (bd_addr);
     tSMP_STATUS      res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_PASSKEY_ENTRY_FAIL;
@@ -451,9 +451,9 @@
 **                                "Security Manager TK Value".
 **
 *******************************************************************************/
-void BTM_BleOobDataReply(BD_ADDR bd_addr, UINT8 res, UINT8 len, UINT8 *p_data)
+void BTM_BleOobDataReply(BD_ADDR bd_addr, uint8_t res, uint8_t len, uint8_t *p_data)
 {
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
     tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_OOB_FAIL;
     tBTM_SEC_DEV_REC  *p_dev_rec = btm_find_dev (bd_addr);
 
@@ -482,11 +482,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void BTM_BleSetConnScanParams (UINT32 scan_interval, UINT32 scan_window)
+void BTM_BleSetConnScanParams (uint32_t scan_interval, uint32_t scan_window)
 {
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
     tBTM_BLE_CB *p_ble_cb = &btm_cb.ble_ctr_cb;
-    BOOLEAN     new_param = FALSE;
+    bool        new_param = false;
 
     if (BTM_BLE_ISVALID_PARAM(scan_interval, BTM_BLE_SCAN_INT_MIN, BTM_BLE_SCAN_INT_MAX) &&
         BTM_BLE_ISVALID_PARAM(scan_window, BTM_BLE_SCAN_WIN_MIN, BTM_BLE_SCAN_WIN_MAX))
@@ -494,13 +494,13 @@
         if (p_ble_cb->scan_int != scan_interval)
         {
             p_ble_cb->scan_int = scan_interval;
-            new_param = TRUE;
+            new_param = true;
         }
 
         if (p_ble_cb->scan_win != scan_window)
         {
             p_ble_cb->scan_win = scan_window;
-            new_param = TRUE;
+            new_param = true;
         }
 
         if (new_param && p_ble_cb->conn_state == BLE_BG_CONN)
@@ -533,8 +533,8 @@
 **
 *******************************************************************************/
 void BTM_BleSetPrefConnParams (BD_ADDR bd_addr,
-                               UINT16 min_conn_int, UINT16 max_conn_int,
-                               UINT16 slave_latency, UINT16 supervision_tout)
+                               uint16_t min_conn_int, uint16_t max_conn_int,
+                               uint16_t slave_latency, uint16_t supervision_tout)
 {
     tBTM_SEC_DEV_REC  *p_dev_rec = btm_find_dev (bd_addr);
 
@@ -658,23 +658,23 @@
 ** Parameter        remote_bda: remote device address, carry out the transport address
 **                  transport: active transport
 **
-** Return           TRUE if an active link is identified; FALSE otherwise
+** Return           true if an active link is identified; false otherwise
 **
 *******************************************************************************/
-BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda, tBT_TRANSPORT transport)
+bool    BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda, tBT_TRANSPORT transport)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(remote_bda);
 
     /* if no device can be located, return */
     if (p_dev_rec == NULL)
-        return FALSE;
+        return false;
 
     if (transport == BT_TRANSPORT_BR_EDR)
     {
         if (btm_bda_to_acl(p_dev_rec->bd_addr, transport) != NULL)
         {
             memcpy(remote_bda, p_dev_rec->bd_addr, BD_ADDR_LEN);
-            return TRUE;
+            return true;
         }
         else if (p_dev_rec->device_type & BT_DEVICE_TYPE_BREDR)
         {
@@ -682,19 +682,19 @@
         }
         else
             memset(remote_bda, 0, BD_ADDR_LEN);
-        return FALSE;
+        return false;
     }
 
     if (transport == BT_TRANSPORT_LE)
     {
         memcpy(remote_bda, p_dev_rec->ble.pseudo_addr, BD_ADDR_LEN);
         if (btm_bda_to_acl(p_dev_rec->ble.pseudo_addr, transport) != NULL)
-            return TRUE;
+            return true;
         else
-            return FALSE;
+            return false;
     }
 
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -707,13 +707,13 @@
 **               p_cmd_cmpl_cback - Command Complete callback
 **
 *******************************************************************************/
-void BTM_BleReceiverTest(UINT8 rx_freq, tBTM_CMPL_CB *p_cmd_cmpl_cback)
+void BTM_BleReceiverTest(uint8_t rx_freq, tBTM_CMPL_CB *p_cmd_cmpl_cback)
 {
      btm_cb.devcb.p_le_test_cmd_cmpl_cb = p_cmd_cmpl_cback;
 
-     if (btsnd_hcic_ble_receiver_test(rx_freq) == FALSE)
+     if (btsnd_hcic_ble_receiver_test(rx_freq) == false)
      {
-          BTM_TRACE_ERROR("%s: Unable to Trigger LE receiver test", __FUNCTION__);
+          BTM_TRACE_ERROR("%s: Unable to Trigger LE receiver test", __func__);
      }
 }
 
@@ -729,13 +729,13 @@
 **                       p_cmd_cmpl_cback - Command Complete callback
 **
 *******************************************************************************/
-void BTM_BleTransmitterTest(UINT8 tx_freq, UINT8 test_data_len,
-                                 UINT8 packet_payload, tBTM_CMPL_CB *p_cmd_cmpl_cback)
+void BTM_BleTransmitterTest(uint8_t tx_freq, uint8_t test_data_len,
+                                 uint8_t packet_payload, tBTM_CMPL_CB *p_cmd_cmpl_cback)
 {
      btm_cb.devcb.p_le_test_cmd_cmpl_cb = p_cmd_cmpl_cback;
-     if (btsnd_hcic_ble_transmitter_test(tx_freq, test_data_len, packet_payload) == FALSE)
+     if (btsnd_hcic_ble_transmitter_test(tx_freq, test_data_len, packet_payload) == false)
      {
-          BTM_TRACE_ERROR("%s: Unable to Trigger LE transmitter test", __FUNCTION__);
+          BTM_TRACE_ERROR("%s: Unable to Trigger LE transmitter test", __func__);
      }
 }
 
@@ -752,16 +752,16 @@
 {
      btm_cb.devcb.p_le_test_cmd_cmpl_cb = p_cmd_cmpl_cback;
 
-     if (btsnd_hcic_ble_test_end() == FALSE)
+     if (btsnd_hcic_ble_test_end() == false)
      {
-          BTM_TRACE_ERROR("%s: Unable to End the LE TX/RX test", __FUNCTION__);
+          BTM_TRACE_ERROR("%s: Unable to End the LE TX/RX test", __func__);
      }
 }
 
 /*******************************************************************************
 ** Internal Functions
 *******************************************************************************/
-void btm_ble_test_command_complete(UINT8 *p)
+void btm_ble_test_command_complete(uint8_t *p)
 {
     tBTM_CMPL_CB   *p_cb = btm_cb.devcb.p_le_test_cmd_cmpl_cb;
 
@@ -779,15 +779,15 @@
 **
 ** Description      This function is to select the underneath physical link to use.
 **
-** Returns          TRUE to use LE, FALSE use BR/EDR.
+** Returns          true to use LE, false use BR/EDR.
 **
 *******************************************************************************/
-BOOLEAN BTM_UseLeLink (BD_ADDR bd_addr)
+bool    BTM_UseLeLink (BD_ADDR bd_addr)
 {
     tACL_CONN         *p;
     tBT_DEVICE_TYPE     dev_type;
     tBLE_ADDR_TYPE      addr_type;
-    BOOLEAN             use_le = FALSE;
+    bool                use_le = false;
 
     if ((p = btm_bda_to_acl(bd_addr, BT_TRANSPORT_BR_EDR)) != NULL)
     {
@@ -795,7 +795,7 @@
     }
     else if ((p = btm_bda_to_acl(bd_addr, BT_TRANSPORT_LE)) != NULL)
     {
-        use_le = TRUE;
+        use_le = true;
     }
     else
     {
@@ -814,20 +814,20 @@
 ** Returns          BTM_SUCCESS if success; otherwise failed.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length)
+tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, uint16_t tx_pdu_length)
 {
     tACL_CONN *p_acl = btm_bda_to_acl(bd_addr, BT_TRANSPORT_LE);
-    BTM_TRACE_DEBUG("%s: tx_pdu_length =%d", __FUNCTION__, tx_pdu_length);
+    BTM_TRACE_DEBUG("%s: tx_pdu_length =%d", __func__, tx_pdu_length);
 
     if (!controller_get_interface()->supports_ble_packet_extension())
     {
-        BTM_TRACE_ERROR("%s failed, request not supported", __FUNCTION__);
+        BTM_TRACE_ERROR("%s failed, request not supported", __func__);
         return BTM_ILLEGAL_VALUE;
     }
 
     if (!HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl->peer_le_features))
     {
-        BTM_TRACE_ERROR("%s failed, peer does not support request", __FUNCTION__);
+        BTM_TRACE_ERROR("%s failed, peer does not support request", __func__);
         return BTM_ILLEGAL_VALUE;
     }
 
@@ -846,7 +846,7 @@
     }
     else
     {
-        BTM_TRACE_ERROR("%s: Wrong mode: no LE link exist or LE not supported",__FUNCTION__);
+        BTM_TRACE_ERROR("%s: Wrong mode: no LE link exist or LE not supported",__func__);
         return BTM_WRONG_MODE;
     }
 }
@@ -866,7 +866,7 @@
 ** Returns          The appropriate security action required.
 **
 *******************************************************************************/
-tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bdaddr, UINT16 security_required)
+tBTM_SEC_ACTION btm_ble_determine_security_act(bool    is_originator, BD_ADDR bdaddr, uint16_t security_required)
 {
     tBTM_LE_AUTH_REQ auth_req = 0x00;
 
@@ -905,18 +905,18 @@
     if (ble_sec_act == BTM_BLE_SEC_REQ_ACT_NONE)
         return BTM_SEC_OK;
 
-    UINT8 sec_flag = 0;
+    uint8_t sec_flag = 0;
     BTM_GetSecurityFlagsByTransport(bdaddr, &sec_flag, BT_TRANSPORT_LE);
 
-    BOOLEAN is_link_encrypted = FALSE;
-    BOOLEAN is_key_mitm = FALSE;
+    bool    is_link_encrypted = false;
+    bool    is_key_mitm = false;
     if (sec_flag & (BTM_SEC_FLAG_ENCRYPTED| BTM_SEC_FLAG_LKEY_KNOWN))
     {
         if (sec_flag & BTM_SEC_FLAG_ENCRYPTED)
-            is_link_encrypted = TRUE;
+            is_link_encrypted = true;
 
         if (sec_flag & BTM_SEC_FLAG_LKEY_AUTHED)
-            is_key_mitm = TRUE;
+            is_key_mitm = true;
     }
 
     if (auth_req & BTM_LE_AUTH_REQ_MITM)
@@ -949,14 +949,14 @@
 **
 ** Parameter        bdaddr: remote device address.
 **                  psm : PSM of the LE COC sevice.
-**                  is_originator: TRUE if outgoing connection.
+**                  is_originator: true if outgoing connection.
 **                  p_callback : Pointer to the callback function.
 **                  p_ref_data : Pointer to be returned along with the callback.
 **
-** Returns          TRUE if link already meets the required security; otherwise FALSE.
+** Returns          true if link already meets the required security; otherwise false.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_start_sec_check(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator,
+bool    btm_ble_start_sec_check(BD_ADDR bd_addr, uint16_t psm, bool    is_originator,
                             tBTM_SEC_CALLBACK *p_callback, void *p_ref_data)
 {
     /* Find the service record for the PSM */
@@ -967,21 +967,21 @@
     {
         BTM_TRACE_WARNING ("%s PSM: %d no application registerd", __func__, psm);
         (*p_callback) (bd_addr, BT_TRANSPORT_LE, p_ref_data, BTM_MODE_UNSUPPORTED);
-        return FALSE;
+        return false;
     }
 
     tBTM_SEC_ACTION sec_act = btm_ble_determine_security_act(is_originator,
                                   bd_addr, p_serv_rec->security_flags);
 
     tBTM_BLE_SEC_ACT ble_sec_act = BTM_BLE_SEC_NONE;
-    BOOLEAN status = FALSE;
+    bool    status = false;
 
     switch (sec_act)
     {
         case BTM_SEC_OK:
             BTM_TRACE_DEBUG ("%s Security met", __func__);
             p_callback(bd_addr, BT_TRANSPORT_LE, p_ref_data, BTM_SUCCESS);
-            status = TRUE;
+            status = true;
             break;
 
         case BTM_SEC_ENCRYPT:
@@ -1011,7 +1011,7 @@
     p_lcb->sec_act = sec_act;
     BTM_SetEncryption(bd_addr, BT_TRANSPORT_LE, p_callback, p_ref_data, ble_sec_act);
 
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -1025,10 +1025,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_enc_cplt_cback)
+void btm_ble_rand_enc_complete (uint8_t *p, uint16_t op_code, tBTM_RAND_ENC_CB *p_enc_cplt_cback)
 {
     tBTM_RAND_ENC   params;
-    UINT8           *p_dest = params.param_buf;
+    uint8_t         *p_dest = params.param_buf;
 
     BTM_TRACE_DEBUG ("btm_ble_rand_enc_complete");
 
@@ -1056,7 +1056,7 @@
     }
 }
 
-    #if (SMP_INCLUDED == TRUE)
+    #if (SMP_INCLUDED == true)
 
 /*******************************************************************************
 **
@@ -1066,7 +1066,7 @@
 ** Returns         None
 **
 *******************************************************************************/
-void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local )
+void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, bool    is_local )
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
 
@@ -1095,7 +1095,7 @@
 ** Returns          p_key_type: output parameter to carry the key type value.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_get_enc_key_type(BD_ADDR bd_addr, UINT8 *p_key_types)
+bool    btm_ble_get_enc_key_type(BD_ADDR bd_addr, uint8_t *p_key_types)
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
 
@@ -1104,9 +1104,9 @@
     if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL)
     {
         *p_key_types = p_dev_rec->ble.key_type;
-        return TRUE;
+        return true;
     }
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -1117,10 +1117,10 @@
 **
 ** Returns          TURE - if a valid DIV is availavle
 *******************************************************************************/
-BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div)
+bool    btm_get_local_div (BD_ADDR bd_addr, uint16_t *p_div)
 {
     tBTM_SEC_DEV_REC   *p_dev_rec;
-    BOOLEAN            status = FALSE;
+    bool               status = false;
     BTM_TRACE_DEBUG ("btm_get_local_div");
 
     BTM_TRACE_DEBUG("bd_addr:%02x-%02x-%02x-%02x-%02x-%02x",
@@ -1133,7 +1133,7 @@
 
     if (p_dev_rec && p_dev_rec->ble.keys.div)
     {
-        status = TRUE;
+        status = true;
         *p_div = p_dev_rec->ble.keys.div;
     }
     BTM_TRACE_DEBUG ("btm_get_local_div status=%d (1-OK) DIV=0x%x", status, *p_div);
@@ -1154,11 +1154,11 @@
 **
 *******************************************************************************/
 void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY_VALUE *p_keys,
-                         BOOLEAN pass_to_application)
+                         bool    pass_to_application)
 {
     tBTM_SEC_DEV_REC *p_rec;
     tBTM_LE_EVT_DATA    cb_data;
-    UINT8 i;
+    uint8_t i;
 
     BTM_TRACE_DEBUG ("btm_sec_save_le_key key_type=0x%x pass_to_application=%d",key_type, pass_to_application);
     /* Store the updated key in the device database */
@@ -1297,7 +1297,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_update_sec_key_size(BD_ADDR bd_addr, UINT8 enc_key_size)
+void btm_ble_update_sec_key_size(BD_ADDR bd_addr, uint8_t enc_key_size)
 {
     tBTM_SEC_DEV_REC *p_rec;
 
@@ -1318,7 +1318,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-UINT8 btm_ble_read_sec_key_size(BD_ADDR bd_addr)
+uint8_t btm_ble_read_sec_key_size(BD_ADDR bd_addr)
 {
     tBTM_SEC_DEV_REC *p_rec;
 
@@ -1336,13 +1336,13 @@
 **
 ** Description      Check BLE link security level match.
 **
-** Returns          TRUE: check is OK and the *p_sec_req_act contain the action
+** Returns          true: check is OK and the *p_sec_req_act contain the action
 **
 *******************************************************************************/
 void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE_SEC_REQ_ACT *p_sec_req_act)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
-    UINT8 req_sec_level = BTM_LE_SEC_NONE, cur_sec_level = BTM_LE_SEC_NONE;
+    uint8_t req_sec_level = BTM_LE_SEC_NONE, cur_sec_level = BTM_LE_SEC_NONE;
 
     BTM_TRACE_DEBUG ("btm_ble_link_sec_check auth_req =0x%x", auth_req);
 
@@ -1416,7 +1416,7 @@
 **                  the local device ER is copied into er
 **
 *******************************************************************************/
-tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, tBTM_BLE_SEC_ACT sec_act, UINT8 link_role)
+tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, tBTM_BLE_SEC_ACT sec_act, uint8_t link_role)
 {
     tBTM_STATUS         cmd = BTM_NO_RESOURCES;
     tBTM_SEC_DEV_REC    *p_rec = btm_find_dev (bd_addr);
@@ -1442,7 +1442,7 @@
             if (link_role == BTM_ROLE_MASTER)
             {
                     /* start link layer encryption using the security info stored */
-                cmd = btm_ble_start_encrypt(bd_addr, FALSE, NULL);
+                cmd = btm_ble_start_encrypt(bd_addr, false, NULL);
                 break;
             }
             /* if salve role then fall through to call SMP_Pair below which will send a
@@ -1463,7 +1463,7 @@
 
                 if (sec_req_act == BTM_BLE_SEC_REQ_ACT_ENCRYPT)
                 {
-                   cmd = btm_ble_start_encrypt(bd_addr, FALSE, NULL);
+                   cmd = btm_ble_start_encrypt(bd_addr, false, NULL);
                    break;
                 }
             }
@@ -1493,7 +1493,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv)
+void btm_ble_ltk_request(uint16_t handle, uint8_t rand[8], uint16_t ediv)
 {
     tBTM_CB *p_cb = &btm_cb;
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
@@ -1508,7 +1508,7 @@
     if (p_dev_rec != NULL)
     {
         if (!smp_proc_ltk_request(p_dev_rec->bd_addr))
-            btm_ble_ltk_request_reply(p_dev_rec->bd_addr, FALSE, dummy_stk);
+            btm_ble_ltk_request_reply(p_dev_rec->bd_addr, false, dummy_stk);
     }
 
 }
@@ -1523,7 +1523,7 @@
 ** Returns          BTM_SUCCESS if encryption was started successfully
 **
 *******************************************************************************/
-tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk)
+tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, bool    use_stk, BT_OCTET16 stk)
 {
     tBTM_CB *p_cb = &btm_cb;
     tBTM_SEC_DEV_REC    *p_rec = btm_find_dev (bda);
@@ -1579,10 +1579,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable)
+void btm_ble_link_encrypted(BD_ADDR bd_addr, uint8_t encr_enable)
 {
     tBTM_SEC_DEV_REC    *p_dev_rec = btm_find_dev (bd_addr);
-    BOOLEAN             enc_cback;
+    bool                enc_cback;
 
     if (!p_dev_rec)
     {
@@ -1605,9 +1605,9 @@
     if (p_dev_rec->p_callback && enc_cback)
     {
         if (encr_enable)
-            btm_sec_dev_rec_cback_event(p_dev_rec, BTM_SUCCESS, TRUE);
+            btm_sec_dev_rec_cback_event(p_dev_rec, BTM_SUCCESS, true);
         else if (p_dev_rec->role_master)
-            btm_sec_dev_rec_cback_event(p_dev_rec, BTM_ERR_PROCESSING, TRUE);
+            btm_sec_dev_rec_cback_event(p_dev_rec, BTM_ERR_PROCESSING, true);
 
     }
     /* to notify GATT to send data if any request is pending */
@@ -1624,7 +1624,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_ltk_request_reply(BD_ADDR bda,  BOOLEAN use_stk, BT_OCTET16 stk)
+void btm_ble_ltk_request_reply(BD_ADDR bda,  bool    use_stk, BT_OCTET16 stk)
 {
     tBTM_SEC_DEV_REC    *p_rec = btm_find_dev (bda);
     tBTM_CB *p_cb = &btm_cb;
@@ -1662,9 +1662,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-UINT8 btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p_data)
+uint8_t btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p_data)
 {
-    UINT8           callback_rc = BTM_SUCCESS;
+    uint8_t         callback_rc = BTM_SUCCESS;
     BTM_TRACE_DEBUG ("btm_ble_io_capabilities_req");
     if (btm_cb.api.p_le_callback)
     {
@@ -1673,13 +1673,13 @@
     }
     if ((callback_rc == BTM_SUCCESS) || (BTM_OOB_UNKNOWN != p_data->oob_data))
     {
-#if BTM_BLE_CONFORMANCE_TESTING == TRUE
+#if (BTM_BLE_CONFORMANCE_TESTING == TRUE)
         if (btm_cb.devcb.keep_rfu_in_auth_req)
         {
             BTM_TRACE_DEBUG ("btm_ble_io_capabilities_req keep_rfu_in_auth_req = %u",
                 btm_cb.devcb.keep_rfu_in_auth_req);
             p_data->auth_req &= BTM_LE_AUTH_REQ_MASK_KEEP_RFU;
-            btm_cb.devcb.keep_rfu_in_auth_req = FALSE;
+            btm_cb.devcb.keep_rfu_in_auth_req = false;
         }
         else
         {   /* default */
@@ -1746,9 +1746,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-UINT8 btm_ble_br_keys_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p_data)
+uint8_t btm_ble_br_keys_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p_data)
 {
-    UINT8           callback_rc = BTM_SUCCESS;
+    uint8_t         callback_rc = BTM_SUCCESS;
     BTM_TRACE_DEBUG ("%s", __func__);
     if (btm_cb.api.p_le_callback)
     {
@@ -1760,7 +1760,7 @@
     return callback_rc;
 }
 
-#if (BLE_PRIVACY_SPT == TRUE )
+#if (BLE_PRIVACY_SPT == TRUE)
 /*******************************************************************************
 **
 ** Function         btm_ble_resolve_random_addr_on_conn_cmpl
@@ -1772,13 +1772,13 @@
 *******************************************************************************/
 static void btm_ble_resolve_random_addr_on_conn_cmpl(void * p_rec, void *p_data)
 {
-    UINT8   *p = (UINT8 *)p_data;
+    uint8_t *p = (uint8_t *)p_data;
     tBTM_SEC_DEV_REC    *match_rec = (tBTM_SEC_DEV_REC *) p_rec;
-    UINT8       role, bda_type;
-    UINT16      handle;
+    uint8_t     role, bda_type;
+    uint16_t    handle;
     BD_ADDR     bda;
-    UINT16      conn_interval, conn_latency, conn_timeout;
-    BOOLEAN     match = FALSE;
+    uint16_t    conn_interval, conn_latency, conn_timeout;
+    bool        match = false;
 
     ++p;
     STREAM_TO_UINT16   (handle, p);
@@ -1796,7 +1796,7 @@
     if (match_rec)
     {
         LOG_INFO(LOG_TAG, "%s matched and resolved random address", __func__);
-        match = TRUE;
+        match = true;
         match_rec->ble.active_addr_type = BTM_BLE_ADDR_RRA;
         memcpy(match_rec->ble.cur_rand_addr, bda, BD_ADDR_LEN);
         if (!btm_ble_init_pseudo_addr (match_rec, bda))
@@ -1833,8 +1833,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_connected (UINT8 *bda, UINT16 handle, UINT8 enc_mode, UINT8 role,
-                        tBLE_ADDR_TYPE addr_type, BOOLEAN addr_matched)
+void btm_ble_connected (uint8_t *bda, uint16_t handle, uint8_t enc_mode, uint8_t role,
+                        tBLE_ADDR_TYPE addr_type, bool    addr_matched)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bda);
     tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
@@ -1880,11 +1880,11 @@
     /* update pseudo address */
     memcpy(p_dev_rec->ble.pseudo_addr, bda, BD_ADDR_LEN);
 
-    p_dev_rec->role_master = FALSE;
+    p_dev_rec->role_master = false;
     if (role == HCI_ROLE_MASTER)
-        p_dev_rec->role_master = TRUE;
+        p_dev_rec->role_master = true;
 
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
     if (!addr_matched)
         p_dev_rec->ble.active_addr_type = BTM_BLE_ADDR_PSEUDO;
 
@@ -1903,17 +1903,17 @@
 **  Description     LE connection complete.
 **
 ******************************************************************************/
-void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced)
+void btm_ble_conn_complete(uint8_t *p, uint16_t evt_len, bool    enhanced)
 {
-#if (BLE_PRIVACY_SPT == TRUE )
-    UINT8       *p_data = p, peer_addr_type;
+#if (BLE_PRIVACY_SPT == TRUE)
+    uint8_t     *p_data = p, peer_addr_type;
     BD_ADDR     local_rpa, peer_rpa;
 #endif
-    UINT8       role, status, bda_type;
-    UINT16      handle;
+    uint8_t     role, status, bda_type;
+    uint16_t    handle;
     BD_ADDR     bda;
-    UINT16      conn_interval, conn_latency, conn_timeout;
-    BOOLEAN     match = FALSE;
+    uint16_t    conn_interval, conn_latency, conn_timeout;
+    bool        match = false;
     UNUSED(evt_len);
 
     STREAM_TO_UINT8   (status, p);
@@ -1924,9 +1924,9 @@
 
     if (status == 0)
     {
-#if (BLE_PRIVACY_SPT == TRUE )
+#if (BLE_PRIVACY_SPT == TRUE)
         peer_addr_type = bda_type;
-        match = btm_identity_addr_to_random_pseudo (bda, &bda_type, TRUE);
+        match = btm_identity_addr_to_random_pseudo (bda, &bda_type, true);
 
         if (enhanced)
         {
@@ -1970,15 +1970,15 @@
         if (status != HCI_ERR_DIRECTED_ADVERTISING_TIMEOUT)
         {
             btm_ble_set_conn_st(BLE_CONN_IDLE);
-#if (defined BLE_PRIVACY_SPT && 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
         }
         else
         {
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
             btm_cb.ble_ctr_cb.inq_var.adv_mode  = BTM_BLE_ADV_DISABLE;
-            btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, TRUE);
+            btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, true);
 #endif
         }
     }
@@ -1992,7 +1992,7 @@
 ** Description LE connection complete.
 **
 ******************************************************************************/
-void btm_ble_create_ll_conn_complete (UINT8 status)
+void btm_ble_create_ll_conn_complete (uint8_t status)
 {
     if (status != HCI_SUCCESS)
     {
@@ -2006,10 +2006,10 @@
 **  Description     This function is the SMP callback handler.
 **
 ******************************************************************************/
-UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
+uint8_t btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
 {
     tBTM_SEC_DEV_REC    *p_dev_rec = btm_find_dev (bd_addr);
-    UINT8 res = 0;
+    uint8_t res = 0;
 
     BTM_TRACE_DEBUG ("btm_proc_smp_cback event = %d", event);
 
@@ -2066,7 +2066,7 @@
                         BTM_TRACE_DEBUG ("Pairing Cancel completed");
                         (*btm_cb.api.p_bond_cancel_cmpl_callback)(BTM_SUCCESS);
                     }
-#if BTM_BLE_CONFORMANCE_TESTING == TRUE
+#if (BTM_BLE_CONFORMANCE_TESTING == TRUE)
                     if (res != BTM_SUCCESS)
                     {
                         if (!btm_cb.devcb.no_disc_if_pair_fail && p_data->cmplt.reason != SMP_CONN_TOUT)
@@ -2107,13 +2107,13 @@
                     if (res == BTM_SUCCESS)
                     {
                         p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
                         /* add all bonded device into resolving list if IRK is available*/
                         btm_ble_resolving_list_load_dev(p_dev_rec);
 #endif
                     }
 
-                    btm_sec_dev_rec_cback_event(p_dev_rec, res, TRUE);
+                    btm_sec_dev_rec_cback_event(p_dev_rec, res, true);
                 }
                 break;
 
@@ -2146,25 +2146,25 @@
 **                  signature: output parameter where data signature is going to
 **                             be stored.
 **
-** Returns          TRUE if signing sucessul, otherwise FALSE.
+** Returns          true if signing sucessul, otherwise false.
 **
 *******************************************************************************/
-BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
+bool    BTM_BleDataSignature (BD_ADDR bd_addr, uint8_t *p_text, uint16_t len,
                               BLE_SIGNATURE signature)
 {
     tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bd_addr);
 
     BTM_TRACE_DEBUG ("%s", __func__);
-    BOOLEAN ret = FALSE;
+    bool    ret = false;
     if (p_rec == NULL)
     {
         BTM_TRACE_ERROR("%s-data signing can not be done from unknown device", __func__);
     }
     else
     {
-        UINT8 *p_mac = (UINT8 *)signature;
-        UINT8 *pp;
-        UINT8 *p_buf = (UINT8 *)osi_malloc(len + 4);
+        uint8_t *p_mac = (uint8_t *)signature;
+        uint8_t *pp;
+        uint8_t *p_buf = (uint8_t *)osi_malloc(len + 4);
 
         BTM_TRACE_DEBUG("%s-Start to generate Local CSRK", __func__);
         pp = p_buf;
@@ -2177,9 +2177,9 @@
         UINT32_TO_STREAM(pp, p_rec->ble.keys.local_counter);
         UINT32_TO_STREAM(p_mac, p_rec->ble.keys.local_counter);
 
-        if ((ret = aes_cipher_msg_auth_code(p_rec->ble.keys.lcsrk, p_buf, (UINT16)(len + 4),
-                                            BTM_CMAC_TLEN_SIZE, p_mac)) == TRUE) {
-            btm_ble_increment_sign_ctr(bd_addr, TRUE);
+        if ((ret = aes_cipher_msg_auth_code(p_rec->ble.keys.lcsrk, p_buf, (uint16_t)(len + 4),
+                                            BTM_CMAC_TLEN_SIZE, p_mac)) == true) {
+            btm_ble_increment_sign_ctr(bd_addr, true);
         }
 
         BTM_TRACE_DEBUG("%s p_mac = %d", __func__, p_mac);
@@ -2204,16 +2204,16 @@
 **                  counter: counter used when doing data signing
 **                  p_comp: signature to be compared against.
 
-** Returns          TRUE if signature verified correctly; otherwise FALSE.
+** Returns          true if signature verified correctly; otherwise false.
 **
 *******************************************************************************/
-BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig, UINT16 len, UINT32 counter,
-                                UINT8 *p_comp)
+bool    BTM_BleVerifySignature (BD_ADDR bd_addr, uint8_t *p_orig, uint16_t len, uint32_t counter,
+                                uint8_t *p_comp)
 {
-    BOOLEAN verified = FALSE;
-#if SMP_INCLUDED == TRUE
+    bool    verified = false;
+#if (SMP_INCLUDED == TRUE)
     tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bd_addr);
-    UINT8 p_mac[BTM_CMAC_TLEN_SIZE];
+    uint8_t p_mac[BTM_CMAC_TLEN_SIZE];
 
     if (p_rec == NULL || (p_rec && !(p_rec->ble.key_type & BTM_LE_KEY_PCSRK)))
     {
@@ -2236,8 +2236,8 @@
         {
             if (memcmp(p_mac, p_comp, BTM_CMAC_TLEN_SIZE) == 0)
             {
-                btm_ble_increment_sign_ctr(bd_addr, FALSE);
-                verified = TRUE;
+                btm_ble_increment_sign_ctr(bd_addr, false);
+                verified = true;
             }
         }
     }
@@ -2252,14 +2252,14 @@
 ** Description      This function is called to get security mode 1 flags and
 **                  encryption key size for LE peer.
 **
-** Returns          BOOLEAN TRUE if LE device is found, FALSE otherwise.
+** Returns          bool    true if LE device is found, false otherwise.
 **
 *******************************************************************************/
-BOOLEAN BTM_GetLeSecurityState (BD_ADDR bd_addr, UINT8 *p_le_dev_sec_flags, UINT8 *p_le_key_size)
+bool    BTM_GetLeSecurityState (BD_ADDR bd_addr, uint8_t *p_le_dev_sec_flags, uint8_t *p_le_key_size)
 {
 #if (BLE_INCLUDED == TRUE)
     tBTM_SEC_DEV_REC *p_dev_rec;
-    UINT16 dev_rec_sec_flags;
+    uint16_t dev_rec_sec_flags;
 #endif
 
     *p_le_dev_sec_flags = 0;
@@ -2269,12 +2269,12 @@
     if ((p_dev_rec = btm_find_dev (bd_addr)) == NULL)
     {
         BTM_TRACE_ERROR ("%s fails", __func__);
-        return (FALSE);
+        return (false);
     }
 
     if (p_dev_rec->ble_hci_handle == BTM_SEC_INVALID_HANDLE) {
         BTM_TRACE_ERROR ("%s-this is not LE device", __func__);
-        return (FALSE);
+        return (false);
     }
 
     dev_rec_sec_flags = p_dev_rec->sec_flags;
@@ -2302,9 +2302,9 @@
     BTM_TRACE_DEBUG ("%s - le_dev_sec_flags: 0x%02x, le_key_size: %d",
         __func__, *p_le_dev_sec_flags, *p_le_key_size);
 
-    return TRUE;
+    return true;
 #else
-    return FALSE;
+    return false;
 #endif
 }
 
@@ -2315,10 +2315,10 @@
 ** Description      This function indicates if LE security procedure is
 **                  currently running with the peer.
 **
-** Returns          BOOLEAN TRUE if security procedure is running, FALSE otherwise.
+** Returns          bool    true if security procedure is running, false otherwise.
 **
 *******************************************************************************/
-BOOLEAN BTM_BleSecurityProcedureIsRunning(BD_ADDR bd_addr)
+bool    BTM_BleSecurityProcedureIsRunning(BD_ADDR bd_addr)
 {
 #if (BLE_INCLUDED == TRUE)
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
@@ -2328,13 +2328,13 @@
         BTM_TRACE_ERROR ("%s device with BDA: %08x%04x is not found",
                           __func__, (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;
     }
 
     return (p_dev_rec->sec_state == BTM_SEC_STATE_ENCRYPTING ||
             p_dev_rec->sec_state == BTM_SEC_STATE_AUTHENTICATING);
 #else
-    return FALSE;
+    return false;
 #endif
 }
 
@@ -2349,12 +2349,12 @@
 ** Returns          the key size or 0 if the size can't be retrieved.
 **
 *******************************************************************************/
-extern UINT8 BTM_BleGetSupportedKeySize (BD_ADDR bd_addr)
+extern uint8_t BTM_BleGetSupportedKeySize (BD_ADDR bd_addr)
 {
-#if ((BLE_INCLUDED == TRUE) && (L2CAP_LE_COC_INCLUDED == TRUE))
+#if (BLE_INCLUDED == TRUE && L2CAP_LE_COC_INCLUDED == TRUE)
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
     tBTM_LE_IO_REQ dev_io_cfg;
-    UINT8 callback_rc;
+    uint8_t callback_rc;
 
     if (!p_dev_rec)
     {
@@ -2399,7 +2399,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btm_notify_new_key(UINT8 key_type)
+static void btm_notify_new_key(uint8_t key_type)
 {
     tBTM_BLE_LOCAL_KEYS *p_locak_keys = NULL;
 
@@ -2502,7 +2502,7 @@
         memcpy(btm_cb.devcb.id_keys.irk, p->param_buf, BT_OCTET16_LEN);
         btm_notify_new_key(BTM_BLE_KEY_TYPE_ID);
 
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
         /* if privacy is enabled, new RPA should be calculated */
         if (btm_cb.ble_ctr_cb.privacy_mode != BTM_PRIVACY_NONE)
         {
@@ -2535,8 +2535,8 @@
 *******************************************************************************/
 static void btm_ble_process_dhk(tSMP_ENC *p)
 {
-#if SMP_INCLUDED == TRUE
-    UINT8 btm_ble_irk_pt = 0x01;
+#if (SMP_INCLUDED == TRUE)
+    uint8_t btm_ble_irk_pt = 0x01;
     tSMP_ENC output;
 
     BTM_TRACE_DEBUG ("btm_ble_process_dhk");
@@ -2579,8 +2579,8 @@
 *******************************************************************************/
 static void btm_ble_process_ir2(tBTM_RAND_ENC *p)
 {
-#if SMP_INCLUDED == TRUE
-    UINT8 btm_ble_dhk_pt = 0x03;
+#if (SMP_INCLUDED == TRUE)
+    uint8_t btm_ble_dhk_pt = 0x03;
     tSMP_ENC output;
 
     BTM_TRACE_DEBUG ("btm_ble_process_ir2");
@@ -2652,7 +2652,7 @@
     }
 }
 
-    #if BTM_BLE_CONFORMANCE_TESTING == TRUE
+    #if BTM_BLE_CONFORMANCE_TESTING == true
 /*******************************************************************************
 **
 ** Function         btm_ble_set_no_disc_if_pair_fail
@@ -2663,7 +2663,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_set_no_disc_if_pair_fail(BOOLEAN disable_disc )
+void btm_ble_set_no_disc_if_pair_fail(bool    disable_disc )
 {
     BTM_TRACE_DEBUG ("btm_ble_set_disc_enable_if_pair_fail disable_disc=%d", disable_disc);
     btm_cb.devcb.no_disc_if_pair_fail = disable_disc;
@@ -2678,7 +2678,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_set_test_mac_value(BOOLEAN enable, UINT8 *p_test_mac_val )
+void btm_ble_set_test_mac_value(bool    enable, uint8_t *p_test_mac_val )
 {
     BTM_TRACE_DEBUG ("btm_ble_set_test_mac_value enable=%d", enable);
     btm_cb.devcb.enable_test_mac_val = enable;
@@ -2694,7 +2694,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_set_test_local_sign_cntr_value(BOOLEAN enable, UINT32 test_local_sign_cntr )
+void btm_ble_set_test_local_sign_cntr_value(bool    enable, uint32_t test_local_sign_cntr )
 {
     BTM_TRACE_DEBUG ("btm_ble_set_test_local_sign_cntr_value enable=%d local_sign_cntr=%d",
                       enable, test_local_sign_cntr);
@@ -2714,7 +2714,7 @@
 void btm_set_random_address(BD_ADDR random_bda)
 {
     tBTM_LE_RANDOM_CB *p_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
-    BOOLEAN     adv_mode = btm_cb.ble_ctr_cb.inq_var.adv_mode ;
+    bool        adv_mode = btm_cb.ble_ctr_cb.inq_var.adv_mode ;
 
     BTM_TRACE_DEBUG ("btm_set_random_address");
 
@@ -2739,7 +2739,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_set_keep_rfu_in_auth_req(BOOLEAN keep_rfu)
+void btm_ble_set_keep_rfu_in_auth_req(bool    keep_rfu)
 {
     BTM_TRACE_DEBUG ("btm_ble_set_keep_rfu_in_auth_req keep_rfus=%d", keep_rfu);
     btm_cb.devcb.keep_rfu_in_auth_req = keep_rfu;
diff --git a/stack/btm/btm_ble_addr.c b/stack/btm/btm_ble_addr.c
index 81fff53..4789c6a 100644
--- a/stack/btm/btm_ble_addr.c
+++ b/stack/btm/btm_ble_addr.c
@@ -31,7 +31,7 @@
 #include "gap_api.h"
 #include "device/include/controller.h"
 
-#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
+#if (BLE_INCLUDED == TRUE)
 #include "btm_ble_int.h"
 #include "smp_api.h"
 
@@ -148,7 +148,7 @@
     tBTM_LE_RANDOM_CB *p_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
     tBTM_BLE_ADDR_CBACK *p_cback = p_cb->p_generate_cback;
     void    *p_data = p_cb->p;
-    UINT8   *pp;
+    uint8_t *pp;
     BD_ADDR     static_random;
 
     BTM_TRACE_EVENT ("btm_gen_non_resolve_paddr_cmpl");
@@ -201,7 +201,7 @@
 
 }
 
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
 /*******************************************************************************
 **  Utility functions for Random address resolving
 *******************************************************************************/
@@ -212,13 +212,13 @@
 ** Description      This function compares the X with random address 3 MSO bytes
 **                  to find a match.
 **
-** Returns          TRUE on match, FALSE otherwise
+** Returns          true on match, false otherwise
 **
 *******************************************************************************/
-static BOOLEAN btm_ble_proc_resolve_x(tSMP_ENC *p)
+static bool    btm_ble_proc_resolve_x(tSMP_ENC *p)
 {
     tBTM_LE_RANDOM_CB   *p_mgnt_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
-    UINT8    comp[3];
+    uint8_t  comp[3];
     BTM_TRACE_EVENT ("btm_ble_proc_resolve_x");
     /* compare the hash with 3 LSB of bd address */
     comp[0] = p_mgnt_cb->random_bda[5];
@@ -231,10 +231,10 @@
         {
             /* match is found */
             BTM_TRACE_EVENT ("match is found");
-            return TRUE;
+            return true;
         }
     }
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -244,20 +244,20 @@
 ** Description      This function is used to initialize pseudo address.
 **                  If pseudo address is not available, use dummy address
 **
-** Returns          TRUE is updated; FALSE otherwise.
+** Returns          true is updated; false otherwise.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_init_pseudo_addr (tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR new_pseudo_addr)
+bool    btm_ble_init_pseudo_addr (tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR new_pseudo_addr)
 {
     BD_ADDR dummy_bda = {0};
 
     if (memcmp(p_dev_rec->ble.pseudo_addr, dummy_bda, BD_ADDR_LEN) == 0)
     {
         memcpy(p_dev_rec->ble.pseudo_addr, new_pseudo_addr, BD_ADDR_LEN);
-        return TRUE;
+        return true;
     }
 
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -266,17 +266,17 @@
 **
 ** Description      This function checks if a RPA is resolvable by the device key.
 **
-** Returns          TRUE is resolvable; FALSE otherwise.
+** Returns          true is resolvable; false otherwise.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_addr_resolvable (BD_ADDR rpa, tBTM_SEC_DEV_REC *p_dev_rec)
+bool    btm_ble_addr_resolvable (BD_ADDR rpa, tBTM_SEC_DEV_REC *p_dev_rec)
 {
-    BOOLEAN rt = FALSE;
+    bool    rt = false;
 
     if (!BTM_BLE_IS_RESOLVE_BDA(rpa))
         return rt;
 
-    UINT8 rand[3];
+    uint8_t rand[3];
     tSMP_ENC output;
     if ((p_dev_rec->device_type & BT_DEVICE_TYPE_BLE) &&
         (p_dev_rec->ble.key_type & BTM_LE_KEY_PID))
@@ -298,7 +298,7 @@
         if (!memcmp(output.param_buf, &rand[0], 3))
         {
             btm_ble_init_pseudo_addr (p_dev_rec, rpa);
-            rt = TRUE;
+            rt = true;
         }
     }
     return rt;
@@ -315,13 +315,13 @@
 ** Returns          None.
 **
 *******************************************************************************/
-static BOOLEAN btm_ble_match_random_bda(void *data, void *context)
+static bool    btm_ble_match_random_bda(void *data, void *context)
 {
 #if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
     /* use the 3 MSB of bd address as prand */
 
     tBTM_LE_RANDOM_CB *p_mgnt_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
-    UINT8 rand[3];
+    uint8_t rand[3];
     rand[0] = p_mgnt_cb->random_bda[2];
     rand[1] = p_mgnt_cb->random_bda[1];
     rand[2] = p_mgnt_cb->random_bda[0];
@@ -336,7 +336,7 @@
 
     if (!(p_dev_rec->device_type & BT_DEVICE_TYPE_BLE) ||
         !(p_dev_rec->ble.key_type & BTM_LE_KEY_PID))
-        return TRUE;
+        return true;
 
     /* generate X = E irk(R0, R1, R2) and R is random address 3 LSO */
     SMP_Encrypt(p_dev_rec->ble.keys.irk, BT_OCTET16_LEN,
@@ -363,7 +363,7 @@
     BTM_TRACE_EVENT("%s", __func__);
     if ( !p_mgnt_cb->busy) {
         p_mgnt_cb->p = p;
-        p_mgnt_cb->busy = TRUE;
+        p_mgnt_cb->busy = true;
         memcpy(p_mgnt_cb->random_bda, random_bda, BD_ADDR_LEN);
         /* start to resolve random address */
         /* check for next security record */
@@ -372,7 +372,7 @@
         tBTM_SEC_DEV_REC *p_dev_rec = n ? list_node(n) : NULL;
 
         BTM_TRACE_EVENT("%s:  %sresolved", __func__, (p_dev_rec == NULL ? "not " : ""));
-        p_mgnt_cb->busy = FALSE;
+        p_mgnt_cb->busy = false;
 
         (*p_cback)(p_dev_rec, p);
     } else {
@@ -391,9 +391,9 @@
 ** Description      find the security record whose LE static address is matching
 **
 *******************************************************************************/
-tBTM_SEC_DEV_REC* btm_find_dev_by_identity_addr(BD_ADDR bd_addr, UINT8 addr_type)
+tBTM_SEC_DEV_REC* btm_find_dev_by_identity_addr(BD_ADDR bd_addr, uint8_t addr_type)
 {
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
     list_node_t *end = list_end(btm_cb.sec_dev_rec);
     for (list_node_t *node = list_begin(btm_cb.sec_dev_rec); node != end; node = list_next(node)) {
         tBTM_SEC_DEV_REC *p_dev_rec = list_node(node);
@@ -420,9 +420,9 @@
 **                  in security database.
 **
 *******************************************************************************/
-BOOLEAN btm_identity_addr_to_random_pseudo(BD_ADDR bd_addr, UINT8 *p_addr_type, BOOLEAN refresh)
+bool    btm_identity_addr_to_random_pseudo(BD_ADDR bd_addr, uint8_t *p_addr_type, bool    refresh)
 {
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
     tBTM_SEC_DEV_REC    *p_dev_rec = btm_find_dev_by_identity_addr(bd_addr, *p_addr_type);
 
     BTM_TRACE_EVENT ("%s", __func__);
@@ -438,10 +438,10 @@
             memcpy(bd_addr, p_dev_rec->ble.pseudo_addr, BD_ADDR_LEN);
 
         *p_addr_type = p_dev_rec->ble.ble_addr_type;
-        return TRUE;
+        return true;
     }
 #endif
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -452,9 +452,9 @@
 **                  random_pseudo is input and output parameter
 **
 *******************************************************************************/
-BOOLEAN btm_random_pseudo_to_identity_addr(BD_ADDR random_pseudo, UINT8 *p_static_addr_type)
+bool    btm_random_pseudo_to_identity_addr(BD_ADDR random_pseudo, uint8_t *p_static_addr_type)
 {
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
     tBTM_SEC_DEV_REC    *p_dev_rec = btm_find_dev (random_pseudo);
 
     if (p_dev_rec != NULL)
@@ -465,11 +465,11 @@
             memcpy(random_pseudo, p_dev_rec->ble.static_addr, BD_ADDR_LEN);
             if (controller_get_interface()->supports_ble_privacy())
                 *p_static_addr_type |= BLE_ADDR_TYPE_ID_BIT;
-            return TRUE;
+            return true;
         }
     }
 #endif
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -481,14 +481,14 @@
 **
 *******************************************************************************/
 void btm_ble_refresh_peer_resolvable_private_addr(BD_ADDR pseudo_bda, BD_ADDR rpa,
-                                                  UINT8 rra_type)
+                                                  uint8_t rra_type)
 {
-#if BLE_PRIVACY_SPT == TRUE
-    UINT8 rra_dummy = FALSE;
+#if (BLE_PRIVACY_SPT == TRUE)
+    uint8_t rra_dummy = false;
     BD_ADDR dummy_bda = {0};
 
     if (memcmp(dummy_bda, rpa, BD_ADDR_LEN) == 0)
-        rra_dummy = TRUE;
+        rra_dummy = true;
 
     /* update security record here, in adv event or connection complete process */
     tBTM_SEC_DEV_REC *p_sec_rec = btm_find_dev(pseudo_bda);
@@ -558,7 +558,7 @@
 void btm_ble_refresh_local_resolvable_private_addr(BD_ADDR pseudo_addr,
                                                    BD_ADDR local_rpa)
 {
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
     tACL_CONN *p = btm_bda_to_acl(pseudo_addr, BT_TRANSPORT_LE);
     BD_ADDR     dummy_bda = {0};
 
diff --git a/stack/btm/btm_ble_adv_filter.c b/stack/btm/btm_ble_adv_filter.c
index 1b4c085..baf1b58 100644
--- a/stack/btm/btm_ble_adv_filter.c
+++ b/stack/btm/btm_ble_adv_filter.c
@@ -47,14 +47,14 @@
 #define BTM_BLE_META_ADDR_LEN       7
 #define BTM_BLE_META_UUID_LEN       40
 
-#define BTM_BLE_PF_BIT_TO_MASK(x)          (UINT16)(1 << (x))
+#define BTM_BLE_PF_BIT_TO_MASK(x)          (uint16_t)(1 << (x))
 
 tBTM_BLE_ADV_FILTER_CB btm_ble_adv_filt_cb;
 tBTM_BLE_VSC_CB cmn_ble_vsc_cb;
 static const BD_ADDR     na_bda= {0};
 
-static UINT8 btm_ble_cs_update_pf_counter(tBTM_BLE_SCAN_COND_OP action,
-                                  UINT8 cond_type, tBLE_BD_ADDR *p_bd_addr, UINT8 num_available);
+static uint8_t btm_ble_cs_update_pf_counter(tBTM_BLE_SCAN_COND_OP action,
+                                  uint8_t cond_type, tBLE_BD_ADDR *p_bd_addr, uint8_t num_available);
 
 #define BTM_BLE_SET_SCAN_PF_OPCODE(x, y) (((x)<<4)|(y))
 #define BTM_BLE_GET_SCAN_PF_SUBCODE(x)    ((x) >> 4)
@@ -86,7 +86,7 @@
 {
     tBTM_STATUS st = BTM_SUCCESS;
 
-#if BLE_VND_INCLUDED == TRUE
+#if (BLE_VND_INCLUDED == TRUE)
     BTM_BleGetVendorCapabilities(&cmn_ble_vsc_cb);
     if (0 == cmn_ble_vsc_cb.max_filter)
     {
@@ -109,7 +109,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_advfilt_enq_op_q(UINT8 action, UINT8 ocf, tBTM_BLE_FILT_CB_EVT cb_evt,
+void btm_ble_advfilt_enq_op_q(uint8_t action, uint8_t ocf, tBTM_BLE_FILT_CB_EVT cb_evt,
                               tBTM_BLE_REF_VALUE ref, tBTM_BLE_PF_CFG_CBACK *p_cmpl_cback,
                               tBTM_BLE_PF_PARAM_CBACK  *p_filt_param_cback)
 {
@@ -136,7 +136,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_advfilt_deq_op_q(UINT8 *p_action,UINT8 *p_ocf, tBTM_BLE_FILT_CB_EVT *p_cb_evt,
+void btm_ble_advfilt_deq_op_q(uint8_t *p_action,uint8_t *p_ocf, tBTM_BLE_FILT_CB_EVT *p_cb_evt,
                               tBTM_BLE_REF_VALUE *p_ref, tBTM_BLE_PF_CFG_CBACK ** p_cmpl_cback,
                               tBTM_BLE_PF_PARAM_CBACK  **p_filt_param_cback)
 {
@@ -164,9 +164,9 @@
 ** Returns          Returns ocf value
 **
 *******************************************************************************/
-UINT8 btm_ble_condtype_to_ocf(UINT8 cond_type)
+uint8_t btm_ble_condtype_to_ocf(uint8_t cond_type)
 {
-    UINT8 ocf = 0;
+    uint8_t ocf = 0;
 
     switch(cond_type)
     {
@@ -207,9 +207,9 @@
 ** Returns          Returns condtype value
 **
 *******************************************************************************/
-UINT8 btm_ble_ocf_to_condtype(UINT8 ocf)
+uint8_t btm_ble_ocf_to_condtype(uint8_t ocf)
 {
-    UINT8 cond_type = 0;
+    uint8_t cond_type = 0;
 
     switch(ocf)
     {
@@ -255,11 +255,11 @@
 *******************************************************************************/
 void btm_ble_scan_pf_cmpl_cback(tBTM_VSC_CMPL *p_params)
 {
-    UINT8  status = 0;
-    UINT8  *p = p_params->p_param_buf, op_subcode = 0, action = 0xff;
-    UINT16  evt_len = p_params->param_len;
-    UINT8   ocf = BTM_BLE_META_PF_ALL, cond_type = 0;
-    UINT8   num_avail = 0, cb_evt = 0;
+    uint8_t status = 0;
+    uint8_t *p = p_params->p_param_buf, op_subcode = 0, action = 0xff;
+    uint16_t evt_len = p_params->param_len;
+    uint8_t ocf = BTM_BLE_META_PF_ALL, cond_type = 0;
+    uint8_t num_avail = 0, cb_evt = 0;
     tBTM_BLE_REF_VALUE ref_value = 0;
     tBTM_BLE_PF_CFG_CBACK *p_scan_cfg_cback = NULL;
     tBTM_BLE_PF_PARAM_CBACK *p_filt_param_cback = NULL;
@@ -368,7 +368,7 @@
 *******************************************************************************/
 tBTM_BLE_PF_COUNT* btm_ble_find_addr_filter_counter(tBLE_BD_ADDR *p_le_bda)
 {
-    UINT8               i;
+    uint8_t             i;
     tBTM_BLE_PF_COUNT   *p_addr_filter = &btm_ble_adv_filt_cb.p_addr_filter_count[1];
 
     if (p_le_bda == NULL)
@@ -396,7 +396,7 @@
 *******************************************************************************/
 tBTM_BLE_PF_COUNT * btm_ble_alloc_addr_filter_counter(BD_ADDR bd_addr)
 {
-    UINT8               i;
+    uint8_t             i;
     tBTM_BLE_PF_COUNT   *p_addr_filter = &btm_ble_adv_filt_cb.p_addr_filter_count[1];
 
     for (i = 0; i < cmn_ble_vsc_cb.max_filter; i ++, p_addr_filter ++)
@@ -404,7 +404,7 @@
         if (memcmp(na_bda, p_addr_filter->bd_addr, BD_ADDR_LEN) == 0)
         {
             memcpy(p_addr_filter->bd_addr, bd_addr, BD_ADDR_LEN);
-            p_addr_filter->in_use = TRUE;
+            p_addr_filter->in_use = true;
             return p_addr_filter;
         }
     }
@@ -416,14 +416,14 @@
 **
 ** Description      de-allocate the per device adv payload filter counter.
 **
-** Returns          TRUE if deallocation succeed; FALSE otherwise.
+** Returns          true if deallocation succeed; false otherwise.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_dealloc_addr_filter_counter(tBLE_BD_ADDR *p_bd_addr, UINT8 filter_type)
+bool    btm_ble_dealloc_addr_filter_counter(tBLE_BD_ADDR *p_bd_addr, uint8_t filter_type)
 {
-    UINT8               i;
+    uint8_t             i;
     tBTM_BLE_PF_COUNT   *p_addr_filter = &btm_ble_adv_filt_cb.p_addr_filter_count[1];
-    BOOLEAN             found = FALSE;
+    bool                found = false;
 
     if (BTM_BLE_PF_TYPE_ALL == filter_type && NULL == p_bd_addr)
         memset(&btm_ble_adv_filt_cb.p_addr_filter_count[0], 0, sizeof(tBTM_BLE_PF_COUNT));
@@ -434,7 +434,7 @@
             (NULL != p_bd_addr &&
             memcmp(p_bd_addr->bda, p_addr_filter->bd_addr, BD_ADDR_LEN) == 0)))
         {
-            found = TRUE;
+            found = true;
             memset(p_addr_filter, 0, sizeof(tBTM_BLE_PF_COUNT));
 
             if (NULL != p_bd_addr) break;
@@ -459,7 +459,7 @@
                                          tBTM_BLE_PF_COND_PARAM *p_cond)
 {
     tBTM_BLE_PF_LOCAL_NAME_COND *p_local_name = (p_cond == NULL) ? NULL : &p_cond->local_name;
-    UINT8       param[BTM_BLE_PF_STR_LEN_MAX + BTM_BLE_ADV_FILT_META_HDR_LENGTH],
+    uint8_t     param[BTM_BLE_PF_STR_LEN_MAX + BTM_BLE_ADV_FILT_META_HDR_LENGTH],
                 *p = param,
                 len = BTM_BLE_ADV_FILT_META_HDR_LENGTH;
     tBTM_STATUS st = BTM_ILLEGAL_VALUE;
@@ -519,7 +519,7 @@
 {
     tBTM_STATUS st = BTM_ILLEGAL_VALUE;
     tBLE_BD_ADDR   *p_bd_addr = p_cond ? &p_cond->target_addr : NULL;
-    UINT8           num_avail = (action == BTM_BLE_SCAN_COND_ADD) ? 0 : 1;
+    uint8_t         num_avail = (action == BTM_BLE_SCAN_COND_ADD) ? 0 : 1;
 
     if (btm_ble_cs_update_pf_counter (action, BTM_BLE_PF_SRVC_DATA, p_bd_addr, num_avail)
                     != BTM_BLE_INVALID_COUNTER)
@@ -550,7 +550,7 @@
     tBTM_BLE_PF_MANU_COND *p_manu_data = (p_data == NULL) ? NULL : &p_data->manu_data;
     tBTM_BLE_PF_SRVC_PATTERN_COND *p_srvc_data = (p_data == NULL) ? NULL : &p_data->srvc_data;
 
-    UINT8 param[BTM_BLE_PF_STR_LEN_MAX + BTM_BLE_PF_STR_LEN_MAX + BTM_BLE_ADV_FILT_META_HDR_LENGTH],
+    uint8_t param[BTM_BLE_PF_STR_LEN_MAX + BTM_BLE_PF_STR_LEN_MAX + BTM_BLE_ADV_FILT_META_HDR_LENGTH],
           *p = param,
           len = BTM_BLE_ADV_FILT_META_HDR_LENGTH;
     tBTM_STATUS st = BTM_ILLEGAL_VALUE;
@@ -662,12 +662,12 @@
 **                  counter update failed.
 **
 *******************************************************************************/
-UINT8 btm_ble_cs_update_pf_counter(tBTM_BLE_SCAN_COND_OP action,
-                                  UINT8 cond_type, tBLE_BD_ADDR *p_bd_addr,
-                                  UINT8 num_available)
+uint8_t btm_ble_cs_update_pf_counter(tBTM_BLE_SCAN_COND_OP action,
+                                  uint8_t cond_type, tBLE_BD_ADDR *p_bd_addr,
+                                  uint8_t num_available)
 {
     tBTM_BLE_PF_COUNT   *p_addr_filter = NULL;
-    UINT8               *p_counter = NULL;
+    uint8_t             *p_counter = NULL;
 
     btm_ble_obtain_vsc_details();
 
@@ -735,7 +735,7 @@
                                        tBTM_BLE_PF_FILT_INDEX filt_index,
                                        tBTM_BLE_PF_COND_PARAM *p_cond)
 {
-    UINT8       param[BTM_BLE_META_ADDR_LEN + BTM_BLE_ADV_FILT_META_HDR_LENGTH],
+    uint8_t     param[BTM_BLE_META_ADDR_LEN + BTM_BLE_ADV_FILT_META_HDR_LENGTH],
                 * p= param;
     tBTM_STATUS st = BTM_ILLEGAL_VALUE;
     tBLE_BD_ADDR *p_addr = (p_cond == NULL) ? NULL : &p_cond->target_addr;
@@ -759,7 +759,7 @@
     }
     /* send address filter */
     if ((st = BTM_VendorSpecificCommand (HCI_BLE_ADV_FILTER_OCF,
-                              (UINT8)(BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_META_ADDR_LEN),
+                              (uint8_t)(BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_META_ADDR_LEN),
                               param,
                               btm_ble_scan_pf_cmpl_cback)) != BTM_NO_RESOURCES)
     {
@@ -790,12 +790,12 @@
                                        tBTM_BLE_FILT_CB_EVT cb_evt,
                                        tBTM_BLE_REF_VALUE ref_value)
 {
-    UINT8       param[BTM_BLE_META_UUID_LEN + BTM_BLE_ADV_FILT_META_HDR_LENGTH],
+    uint8_t     param[BTM_BLE_META_UUID_LEN + BTM_BLE_ADV_FILT_META_HDR_LENGTH],
                 * p= param,
                 len = BTM_BLE_ADV_FILT_META_HDR_LENGTH;
     tBTM_STATUS st = BTM_ILLEGAL_VALUE;
     tBTM_BLE_PF_UUID_COND *p_uuid_cond;
-    UINT8           evt_type;
+    uint8_t         evt_type;
 
     memset(param, 0, BTM_BLE_META_UUID_LEN + BTM_BLE_ADV_FILT_META_HDR_LENGTH);
 
@@ -832,7 +832,7 @@
 
         /* send address filter */
         if ((st = BTM_VendorSpecificCommand (HCI_BLE_ADV_FILTER_OCF,
-                                  (UINT8)(BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_META_ADDR_LEN),
+                                  (uint8_t)(BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_META_ADDR_LEN),
                                   param,
                                   btm_ble_scan_pf_cmpl_cback)) == BTM_NO_RESOURCES)
         {
@@ -944,7 +944,7 @@
     tBLE_BD_ADDR *p_target = (p_cond == NULL)? NULL : &p_cond->target_addr;
     tBTM_BLE_PF_COUNT *p_bda_filter;
     tBTM_STATUS     st = BTM_WRONG_MODE;
-    UINT8           param[20], *p;
+    uint8_t         param[20], *p;
 
     if (BTM_BLE_SCAN_COND_CLEAR != action)
     {
@@ -1017,7 +1017,7 @@
     UINT8_TO_STREAM(p, BTM_BLE_PF_LOGIC_OR);
 
     if ((st = BTM_VendorSpecificCommand (HCI_BLE_ADV_FILTER_OCF,
-                               (UINT8)(BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_PF_FEAT_SEL_LEN),
+                               (uint8_t)(BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_PF_FEAT_SEL_LEN),
                                 param,
                                 btm_ble_scan_pf_cmpl_cback))
             != BTM_NO_RESOURCES)
@@ -1054,9 +1054,9 @@
 {
     tBTM_STATUS st = BTM_WRONG_MODE;
     tBTM_BLE_PF_COUNT *p_bda_filter = NULL;
-    UINT8 len = BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_ADV_FILT_FEAT_SELN_LEN +
+    uint8_t len = BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_ADV_FILT_FEAT_SELN_LEN +
                 BTM_BLE_ADV_FILT_TRACK_NUM;
-    UINT8 param[len], *p;
+    uint8_t param[len], *p;
 
     if (BTM_SUCCESS  != btm_ble_obtain_vsc_details())
         return st;
@@ -1115,7 +1115,7 @@
                   BTM_BLE_ADV_FILT_TRACK_NUM;
 
         if ((st = BTM_VendorSpecificCommand (HCI_BLE_ADV_FILTER_OCF,
-                                (UINT8)len,
+                                (uint8_t)len,
                                  param,
                                  btm_ble_scan_pf_cmpl_cback))
                == BTM_NO_RESOURCES)
@@ -1135,7 +1135,7 @@
         UINT8_TO_STREAM(p, filt_index);
 
         if ((st = BTM_VendorSpecificCommand (HCI_BLE_ADV_FILTER_OCF,
-                                (UINT8)(BTM_BLE_ADV_FILT_META_HDR_LENGTH),
+                                (uint8_t)(BTM_BLE_ADV_FILT_META_HDR_LENGTH),
                                  param,
                                  btm_ble_scan_pf_cmpl_cback))
                == BTM_NO_RESOURCES)
@@ -1156,7 +1156,7 @@
         UINT8_TO_STREAM(p, BTM_BLE_SCAN_COND_CLEAR);
 
         if ((st = BTM_VendorSpecificCommand (HCI_BLE_ADV_FILTER_OCF,
-                                (UINT8)(BTM_BLE_ADV_FILT_META_HDR_LENGTH-1),
+                                (uint8_t)(BTM_BLE_ADV_FILT_META_HDR_LENGTH-1),
                                  param,
                                  btm_ble_scan_pf_cmpl_cback))
                == BTM_NO_RESOURCES)
@@ -1183,11 +1183,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-tBTM_STATUS BTM_BleEnableDisableFilterFeature(UINT8 enable,
+tBTM_STATUS BTM_BleEnableDisableFilterFeature(uint8_t enable,
                                      tBTM_BLE_PF_STATUS_CBACK *p_stat_cback,
                                      tBTM_BLE_REF_VALUE ref_value)
 {
-    UINT8           param[20], *p;
+    uint8_t         param[20], *p;
     tBTM_STATUS     st = BTM_WRONG_MODE;
 
     if (BTM_SUCCESS  != btm_ble_obtain_vsc_details())
@@ -1238,7 +1238,7 @@
                                       tBTM_BLE_REF_VALUE ref_value)
 {
     tBTM_STATUS     st = BTM_ILLEGAL_VALUE;
-    UINT8 ocf = 0;
+    uint8_t ocf = 0;
     BTM_TRACE_EVENT (" BTM_BleCfgFilterCondition action:%d, cond_type:%d, index:%d", action,
                         cond_type, filt_index);
 
diff --git a/stack/btm/btm_ble_batchscan.c b/stack/btm/btm_ble_batchscan.c
index 95609de..a560038 100644
--- a/stack/btm/btm_ble_batchscan.c
+++ b/stack/btm/btm_ble_batchscan.c
@@ -58,11 +58,11 @@
 ** Returns          None
 **
 *******************************************************************************/
-void btm_ble_batchscan_filter_track_adv_vse_cback(UINT8 len, UINT8 *p)
+void btm_ble_batchscan_filter_track_adv_vse_cback(uint8_t len, uint8_t *p)
 {
     tBTM_BLE_TRACK_ADV_DATA adv_data;
 
-    UINT8   sub_event = 0;
+    uint8_t sub_event = 0;
     tBTM_BLE_VSC_CB cmn_ble_vsc_cb;
     STREAM_TO_UINT8(sub_event, p);
 
@@ -81,7 +81,7 @@
 
         memset(&adv_data, 0 , sizeof(tBTM_BLE_TRACK_ADV_DATA));
         BTM_BleGetVendorCapabilities(&cmn_ble_vsc_cb);
-        adv_data.client_if = (UINT8)ble_advtrack_cb.ref_value;
+        adv_data.client_if = (uint8_t)ble_advtrack_cb.ref_value;
         if (cmn_ble_vsc_cb.version_supported > BTM_VSC_CHIP_CAPABILITY_L_VERSION)
         {
             STREAM_TO_UINT8(adv_data.filt_index, p);
@@ -138,8 +138,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_batchscan_enq_op_q(UINT8 opcode, tBTM_BLE_BATCH_SCAN_STATE cur_state,
-                                          UINT8 cb_evt, tBTM_BLE_REF_VALUE ref_value)
+void btm_ble_batchscan_enq_op_q(uint8_t opcode, tBTM_BLE_BATCH_SCAN_STATE cur_state,
+                                          uint8_t cb_evt, tBTM_BLE_REF_VALUE ref_value)
 {
     ble_batchscan_cb.op_q.sub_code[ble_batchscan_cb.op_q.next_idx] = (opcode |(cb_evt << 4));
     ble_batchscan_cb.op_q.cur_state[ble_batchscan_cb.op_q.next_idx] = cur_state;
@@ -162,7 +162,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-tBTM_STATUS btm_ble_batchscan_enq_rep_q(UINT8 report_format, tBTM_BLE_REF_VALUE ref_value)
+tBTM_STATUS btm_ble_batchscan_enq_rep_q(uint8_t report_format, tBTM_BLE_REF_VALUE ref_value)
 {
     int i = 0;
     for (i = 0; i < BTM_BLE_BATCH_REP_MAIN_Q_SIZE; i++)
@@ -193,8 +193,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_batchscan_enq_rep_data(UINT8 report_format, UINT8 num_records, UINT8 *p_data,
-                                    UINT8 data_len)
+void btm_ble_batchscan_enq_rep_data(uint8_t report_format, uint8_t num_records, uint8_t *p_data,
+                                    uint8_t data_len)
 {
     int index = 0;
 
@@ -210,8 +210,8 @@
     if (index < BTM_BLE_BATCH_REP_MAIN_Q_SIZE && data_len > 0 && num_records > 0)
     {
         int len = ble_batchscan_cb.main_rep_q.data_len[index];
-        UINT8 *p_orig_data = ble_batchscan_cb.main_rep_q.p_data[index];
-        UINT8 *p_app_data;
+        uint8_t *p_orig_data = ble_batchscan_cb.main_rep_q.p_data[index];
+        uint8_t *p_app_data;
 
         if (NULL != p_orig_data)
         {
@@ -244,8 +244,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_batchscan_deq_rep_data(UINT8 report_format, tBTM_BLE_REF_VALUE *p_ref_value,
-                                 UINT8 *p_num_records, UINT8 **p_data, UINT16 *p_data_len)
+void btm_ble_batchscan_deq_rep_data(uint8_t report_format, tBTM_BLE_REF_VALUE *p_ref_value,
+                                 uint8_t *p_num_records, uint8_t **p_data, uint16_t *p_data_len)
 {
     int index = 0;
 
@@ -289,8 +289,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_batchscan_deq_op_q(UINT8 *p_opcode,tBTM_BLE_BATCH_SCAN_STATE *cur_state,
-                                          UINT8 *p_cb_evt, tBTM_BLE_REF_VALUE *p_ref)
+void btm_ble_batchscan_deq_op_q(uint8_t *p_opcode,tBTM_BLE_BATCH_SCAN_STATE *cur_state,
+                                          uint8_t *p_cb_evt, tBTM_BLE_REF_VALUE *p_ref)
 {
     *p_cb_evt = (ble_batchscan_cb.op_q.sub_code[ble_batchscan_cb.op_q.pending_idx] >> 4);
     *p_opcode = (ble_batchscan_cb.op_q.sub_code[ble_batchscan_cb.op_q.pending_idx]
@@ -317,7 +317,7 @@
                                           tBTM_BLE_REF_VALUE ref_value)
 {
     tBTM_STATUS     status = BTM_NO_RESOURCES;
-    UINT8 param[BTM_BLE_BATCH_SCAN_READ_RESULTS_LEN], *pp;
+    uint8_t param[BTM_BLE_BATCH_SCAN_READ_RESULTS_LEN], *pp;
     pp = param;
 
     memset(param, 0, BTM_BLE_BATCH_SCAN_READ_RESULTS_LEN);
@@ -356,16 +356,16 @@
 *******************************************************************************/
 void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params)
 {
-    UINT8  *p = p_params->p_param_buf;
-    UINT16  len = p_params->param_len;
+    uint8_t *p = p_params->p_param_buf;
+    uint16_t len = p_params->param_len;
     tBTM_BLE_REF_VALUE ref_value = 0;
 
-    UINT8  status = 0, subcode = 0, opcode = 0;
-    UINT8 report_format = 0, num_records = 0, cb_evt = 0;
-    UINT16 data_len = 0;
+    uint8_t status = 0, subcode = 0, opcode = 0;
+    uint8_t report_format = 0, num_records = 0, cb_evt = 0;
+    uint16_t data_len = 0;
     tBTM_BLE_BATCH_SCAN_STATE cur_state = 0;
     tBTM_STATUS btm_status = 0;
-    UINT8 *p_data = NULL;
+    uint8_t *p_data = NULL;
 
     if (len < 2)
     {
@@ -500,11 +500,11 @@
 ** Returns          status
 **
 *******************************************************************************/
-tBTM_STATUS btm_ble_set_storage_config(UINT8 batch_scan_full_max, UINT8 batch_scan_trunc_max,
-                                       UINT8 batch_scan_notify_threshold)
+tBTM_STATUS btm_ble_set_storage_config(uint8_t batch_scan_full_max, uint8_t batch_scan_trunc_max,
+                                       uint8_t batch_scan_notify_threshold)
 {
     tBTM_STATUS     status = BTM_NO_RESOURCES;
-    UINT8 param[BTM_BLE_BATCH_SCAN_STORAGE_CFG_LEN], *pp;
+    uint8_t param[BTM_BLE_BATCH_SCAN_STORAGE_CFG_LEN], *pp;
 
     pp = param;
     memset(param, 0, BTM_BLE_BATCH_SCAN_STORAGE_CFG_LEN);
@@ -541,11 +541,11 @@
 **
 *******************************************************************************/
 tBTM_STATUS btm_ble_set_batchscan_param(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
-                     UINT32 scan_interval, UINT32 scan_window, tBLE_ADDR_TYPE addr_type,
+                     uint32_t scan_interval, uint32_t scan_window, tBLE_ADDR_TYPE addr_type,
                      tBTM_BLE_DISCARD_RULE discard_rule)
 {
     tBTM_STATUS     status = BTM_NO_RESOURCES;
-    UINT8 scan_param[BTM_BLE_BATCH_SCAN_PARAM_CONFIG_LEN], *pp_scan;
+    uint8_t scan_param[BTM_BLE_BATCH_SCAN_PARAM_CONFIG_LEN], *pp_scan;
 
     pp_scan = scan_param;
     memset(scan_param, 0, BTM_BLE_BATCH_SCAN_PARAM_CONFIG_LEN);
@@ -583,11 +583,11 @@
 ** Returns          status
 **
 *******************************************************************************/
-tBTM_STATUS btm_ble_enable_disable_batchscan(BOOLEAN should_enable)
+tBTM_STATUS btm_ble_enable_disable_batchscan(bool    should_enable)
 {
     tBTM_STATUS     status = BTM_NO_RESOURCES;
-    UINT8 shld_enable = 0x01;
-    UINT8 enable_param[BTM_BLE_BATCH_SCAN_ENB_DISB_LEN], *pp_enable;
+    uint8_t shld_enable = 0x01;
+    uint8_t enable_param[BTM_BLE_BATCH_SCAN_ENB_DISB_LEN], *pp_enable;
 
     if (!should_enable)
         shld_enable = 0x00;
@@ -643,8 +643,8 @@
 ** Returns          tBTM_STATUS
 **
 *******************************************************************************/
-tBTM_STATUS BTM_BleSetStorageConfig(UINT8 batch_scan_full_max, UINT8 batch_scan_trunc_max,
-                                        UINT8 batch_scan_notify_threshold,
+tBTM_STATUS BTM_BleSetStorageConfig(uint8_t batch_scan_full_max, uint8_t batch_scan_trunc_max,
+                                        uint8_t batch_scan_notify_threshold,
                                         tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback,
                                         tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback,
                                         tBTM_BLE_SCAN_REP_CBACK* p_rep_cback,
@@ -685,7 +685,7 @@
          BTM_BLE_SCAN_DISABLED_STATE == ble_batchscan_cb.cur_state ||
          BTM_BLE_SCAN_DISABLE_CALLED == ble_batchscan_cb.cur_state)
     {
-        status = btm_ble_enable_disable_batchscan(TRUE);
+        status = btm_ble_enable_disable_batchscan(true);
         if (BTM_CMD_STARTED != status)
             return status;
 
@@ -722,7 +722,7 @@
 **
 *******************************************************************************/
 tBTM_STATUS BTM_BleEnableBatchScan(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
-            UINT32 scan_interval, UINT32 scan_window, tBLE_ADDR_TYPE addr_type,
+            uint32_t scan_interval, uint32_t scan_window, tBLE_ADDR_TYPE addr_type,
             tBTM_BLE_DISCARD_RULE discard_rule, tBTM_BLE_REF_VALUE ref_value)
 {
     tBTM_STATUS     status = BTM_NO_RESOURCES;
@@ -757,7 +757,7 @@
             BTM_BLE_SCAN_DISABLED_STATE == ble_batchscan_cb.cur_state ||
             BTM_BLE_SCAN_DISABLE_CALLED == ble_batchscan_cb.cur_state)
         {
-            status = btm_ble_enable_disable_batchscan(TRUE);
+            status = btm_ble_enable_disable_batchscan(true);
             if (BTM_CMD_STARTED != status)
                return status;
             btm_ble_batchscan_enq_op_q(BTM_BLE_BATCH_SCAN_ENB_DISAB_CUST_FEATURE,
@@ -815,7 +815,7 @@
         return BTM_ERR_PROCESSING;
     }
 
-    status = btm_ble_enable_disable_batchscan(FALSE);
+    status = btm_ble_enable_disable_batchscan(false);
     if (BTM_CMD_STARTED == status)
     {
        /* The user needs to be provided scan disable event */
@@ -844,9 +844,9 @@
 {
     tBTM_STATUS     status = BTM_NO_RESOURCES;
     tBTM_BLE_VSC_CB cmn_ble_vsc_cb;
-    UINT8 read_scan_mode = 0;
-    UINT8  *p_data = NULL, num_records = 0;
-    UINT16 data_len = 0;
+    uint8_t read_scan_mode = 0;
+    uint8_t *p_data = NULL, num_records = 0;
+    uint16_t data_len = 0;
 
     BTM_TRACE_EVENT (" BTM_BleReadScanReports; %d, %d", scan_mode, ref_value);
 
@@ -940,7 +940,7 @@
     BTM_TRACE_EVENT (" btm_ble_batchscan_init");
     memset(&ble_batchscan_cb, 0, sizeof(tBTM_BLE_BATCH_SCAN_CB));
     memset(&ble_advtrack_cb, 0, sizeof(tBTM_BLE_ADV_TRACK_CB));
-    BTM_RegisterForVSEvents(btm_ble_batchscan_filter_track_adv_vse_cback, TRUE);
+    BTM_RegisterForVSEvents(btm_ble_batchscan_filter_track_adv_vse_cback, true);
 }
 
 /*******************************************************************************
diff --git a/stack/btm/btm_ble_bgconn.cc b/stack/btm/btm_ble_bgconn.cc
index 01643fb..1d03a13 100644
--- a/stack/btm/btm_ble_bgconn.cc
+++ b/stack/btm/btm_ble_bgconn.cc
@@ -105,8 +105,8 @@
 {
     tBTM_BLE_INQ_CB *p_inq = &btm_cb.ble_ctr_cb.inq_var;
 
-    UINT32 scan_interval = !p_inq->scan_interval ? BTM_BLE_GAP_DISC_SCAN_INT : p_inq->scan_interval;
-    UINT32 scan_window = !p_inq->scan_window ? BTM_BLE_GAP_DISC_SCAN_WIN : p_inq->scan_window;
+    uint32_t scan_interval = !p_inq->scan_interval ? BTM_BLE_GAP_DISC_SCAN_INT : p_inq->scan_interval;
+    uint32_t scan_window = !p_inq->scan_window ? BTM_BLE_GAP_DISC_SCAN_WIN : p_inq->scan_window;
 
     BTM_TRACE_EVENT ("%s", __func__);
 
@@ -115,8 +115,8 @@
 
     if (btm_cb.cmn_ble_vsc_cb.extended_scan_support == 0)
     {
-        btsnd_hcic_ble_set_scan_params(p_inq->scan_type, (UINT16)scan_interval,
-                                       (UINT16)scan_window,
+        btsnd_hcic_ble_set_scan_params(p_inq->scan_type, (uint16_t)scan_interval,
+                                       (uint16_t)scan_window,
                                        btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type,
                                        scan_policy);
     }
@@ -133,10 +133,10 @@
 **
 ** Description      This function load the device into controller white list
 *******************************************************************************/
-BOOLEAN btm_add_dev_to_controller (BOOLEAN to_add, BD_ADDR bd_addr)
+bool    btm_add_dev_to_controller (bool    to_add, BD_ADDR bd_addr)
 {
     tBTM_SEC_DEV_REC    *p_dev_rec = btm_find_dev (bd_addr);
-    BOOLEAN             started = FALSE;
+    bool                started = false;
     BD_ADDR             dummy_bda = {0};
 
     if (p_dev_rec != NULL && p_dev_rec->device_type & BT_DEVICE_TYPE_BLE) {
@@ -162,7 +162,7 @@
         }
     } else {
         /* not a known device, i.e. attempt to connect to device never seen before */
-        UINT8 addr_type = BTM_IS_PUBLIC_BDA(bd_addr) ? BLE_ADDR_PUBLIC : BLE_ADDR_RANDOM;
+        uint8_t addr_type = BTM_IS_PUBLIC_BDA(bd_addr) ? BLE_ADDR_PUBLIC : BLE_ADDR_RANDOM;
         started = btsnd_hcic_ble_remove_from_white_list(addr_type, bd_addr);
         if (to_add)
             started = btsnd_hcic_ble_add_white_list(addr_type, bd_addr);
@@ -177,11 +177,11 @@
 **
 ** Description      execute the pending whitelist device operation(loading or removing)
 *******************************************************************************/
-BOOLEAN btm_execute_wl_dev_operation(void)
+bool    btm_execute_wl_dev_operation(void)
 {
     tBTM_BLE_WL_OP *p_dev_op = btm_cb.ble_ctr_cb.wl_op_q;
-    UINT8   i = 0;
-    BOOLEAN rt = TRUE;
+    uint8_t i = 0;
+    bool    rt = true;
 
     for (i = 0; i < BTM_BLE_MAX_BG_CONN_DEV_NUM && rt; i ++, p_dev_op ++)
     {
@@ -201,10 +201,10 @@
 **
 ** Description      enqueue the pending whitelist device operation(loading or removing).
 *******************************************************************************/
-void btm_enq_wl_dev_operation(BOOLEAN to_add, BD_ADDR bd_addr)
+void btm_enq_wl_dev_operation(bool    to_add, BD_ADDR bd_addr)
 {
     tBTM_BLE_WL_OP *p_dev_op = btm_cb.ble_ctr_cb.wl_op_q;
-    UINT8   i = 0;
+    uint8_t i = 0;
 
     for (i = 0; i < BTM_BLE_MAX_BG_CONN_DEV_NUM; i ++, p_dev_op ++)
     {
@@ -218,7 +218,7 @@
     }
     if (i != BTM_BLE_MAX_BG_CONN_DEV_NUM)
     {
-        p_dev_op->in_use = TRUE;
+        p_dev_op->in_use = true;
         p_dev_op->to_add = to_add;
         memcpy(p_dev_op->bd_addr, bd_addr, BD_ADDR_LEN);
     }
@@ -237,14 +237,14 @@
 **                  the white list.
 **
 *******************************************************************************/
-BOOLEAN btm_update_dev_to_white_list(BOOLEAN to_add, BD_ADDR bd_addr)
+bool    btm_update_dev_to_white_list(bool    to_add, BD_ADDR bd_addr)
 {
     tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
 
     if (to_add && p_cb->white_list_avail_size == 0)
     {
         BTM_TRACE_ERROR("%s Whitelist full, unable to add device", __func__);
-        return FALSE;
+        return false;
     }
 
     if (to_add)
@@ -255,7 +255,7 @@
     btm_suspend_wl_activity(p_cb->wl_state);
     btm_enq_wl_dev_operation(to_add, bd_addr);
     btm_resume_wl_activity(p_cb->wl_state);
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -279,10 +279,10 @@
 ** Description      Indicates white list cleared.
 **
 *******************************************************************************/
-void btm_ble_clear_white_list_complete(UINT8 *p_data, UINT16 evt_len)
+void btm_ble_clear_white_list_complete(uint8_t *p_data, uint16_t evt_len)
 {
     tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
-    UINT8       status;
+    uint8_t     status;
     UNUSED(evt_len);
 
     BTM_TRACE_EVENT ("btm_ble_clear_white_list_complete");
@@ -299,7 +299,7 @@
 ** Description      Initialize white list size
 **
 *******************************************************************************/
-void btm_ble_white_list_init(UINT8 white_list_size)
+void btm_ble_white_list_init(uint8_t white_list_size)
 {
     BTM_TRACE_DEBUG("%s white_list_size = %d", __func__, white_list_size);
     btm_cb.ble_ctr_cb.white_list_avail_size = white_list_size;
@@ -312,7 +312,7 @@
 ** Description      White list element added
 **
 *******************************************************************************/
-void btm_ble_add_2_white_list_complete(UINT8 status)
+void btm_ble_add_2_white_list_complete(uint8_t status)
 {
     BTM_TRACE_EVENT("%s status=%d", __func__, status);
     if (status == HCI_SUCCESS)
@@ -326,7 +326,7 @@
 ** Description      White list element removal complete
 **
 *******************************************************************************/
-void btm_ble_remove_from_white_list_complete(UINT8 *p, UINT16 evt_len)
+void btm_ble_remove_from_white_list_complete(uint8_t *p, uint16_t evt_len)
 {
     UNUSED(evt_len);
     BTM_TRACE_EVENT ("%s status=%d", __func__, *p);
@@ -340,20 +340,20 @@
 **
 ** Description      This function is to start/stop auto connection procedure.
 **
-** Parameters       start: TRUE to start; FALSE to stop.
+** Parameters       start: true to start; false to stop.
 **
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN btm_ble_start_auto_conn(BOOLEAN start)
+bool    btm_ble_start_auto_conn(bool    start)
 {
     tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
     BD_ADDR dummy_bda = {0};
-    BOOLEAN exec = TRUE;
-    UINT16 scan_int;
-    UINT16 scan_win;
-    UINT8 own_addr_type = p_cb->addr_mgnt_cb.own_addr_type;
-    UINT8 peer_addr_type = BLE_ADDR_PUBLIC;
+    bool    exec = true;
+    uint16_t scan_int;
+    uint16_t scan_win;
+    uint8_t own_addr_type = p_cb->addr_mgnt_cb.own_addr_type;
+    uint8_t peer_addr_type = BLE_ADDR_PUBLIC;
 
     if (start)
     {
@@ -364,7 +364,7 @@
 
             btm_execute_wl_dev_operation();
 
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
             btm_ble_enable_resolving_list_for_platform(BTM_BLE_RL_INIT);
 #endif
             scan_int = (p_cb->scan_int == BTM_BLE_SCAN_PARAM_UNDEF) ?
@@ -372,7 +372,7 @@
             scan_win = (p_cb->scan_win == BTM_BLE_SCAN_PARAM_UNDEF) ?
                                           BTM_BLE_SCAN_SLOW_WIN_1 : p_cb->scan_win;
 
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
             if (btm_cb.ble_ctr_cb.rl_state != BTM_BLE_RL_IDLE
                     && controller_get_interface()->supports_ble_privacy())
             {
@@ -381,21 +381,21 @@
             }
 #endif
 
-            if (!btsnd_hcic_ble_create_ll_conn (scan_int,  /* UINT16 scan_int      */
-                                                scan_win,    /* UINT16 scan_win      */
-                                                0x01,                   /* 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      */
+                                                0x01,                   /* uint8_t white_list     */
+                                                peer_addr_type,        /* uint8_t addr_type_peer */
                                                 dummy_bda,              /* BD_ADDR bda_peer     */
-                                                own_addr_type,          /* UINT8 addr_type_own */
-                                                BTM_BLE_CONN_INT_MIN_DEF,   /* UINT16 conn_int_min  */
-                                                BTM_BLE_CONN_INT_MAX_DEF,   /* UINT16 conn_int_max  */
-                                                BTM_BLE_CONN_SLAVE_LATENCY_DEF,  /* UINT16 conn_latency  */
-                                                BTM_BLE_CONN_TIMEOUT_DEF,        /* UINT16 conn_timeout  */
-                                                0,                       /* UINT16 min_len       */
-                                                0))                      /* UINT16 max_len       */
+                                                own_addr_type,          /* uint8_t addr_type_own */
+                                                BTM_BLE_CONN_INT_MIN_DEF,   /* uint16_t conn_int_min  */
+                                                BTM_BLE_CONN_INT_MAX_DEF,   /* uint16_t conn_int_max  */
+                                                BTM_BLE_CONN_SLAVE_LATENCY_DEF,  /* uint16_t conn_latency  */
+                                                BTM_BLE_CONN_TIMEOUT_DEF,        /* uint16_t conn_timeout  */
+                                                0,                       /* uint16_t min_len       */
+                                                0))                      /* uint16_t max_len       */
             {
                 /* start auto connection failed */
-                exec =  FALSE;
+                exec =  false;
                 p_cb->wl_state &= ~BTM_BLE_WL_INIT;
             }
             else
@@ -405,7 +405,7 @@
         }
         else
         {
-            exec = FALSE;
+            exec = false;
         }
     }
     else
@@ -419,7 +419,7 @@
         else
         {
             BTM_TRACE_DEBUG("conn_st = %d, not in auto conn state, cannot stop", p_cb->conn_state);
-            exec = FALSE;
+            exec = false;
         }
     }
     return exec;
@@ -431,18 +431,18 @@
 **
 ** Description      This function is to start/stop selective connection procedure.
 **
-** Parameters       start: TRUE to start; FALSE to stop.
+** Parameters       start: true to start; false to stop.
 **                  p_select_cback: callback function to return application
 **                                  selection.
 **
-** Returns          BOOLEAN: selective connectino procedure is started.
+** Returns          bool   : selective connectino procedure is started.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_start_select_conn(BOOLEAN start, tBTM_BLE_SEL_CBACK *p_select_cback)
+bool    btm_ble_start_select_conn(bool    start, tBTM_BLE_SEL_CBACK *p_select_cback)
 {
     tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
-    UINT32 scan_int = p_cb->scan_int == BTM_BLE_SCAN_PARAM_UNDEF ? BTM_BLE_SCAN_FAST_INT : p_cb->scan_int;
-    UINT32 scan_win = p_cb->scan_win == BTM_BLE_SCAN_PARAM_UNDEF ? BTM_BLE_SCAN_FAST_WIN : p_cb->scan_win;
+    uint32_t scan_int = p_cb->scan_int == BTM_BLE_SCAN_PARAM_UNDEF ? BTM_BLE_SCAN_FAST_INT : p_cb->scan_int;
+    uint32_t scan_win = p_cb->scan_win == BTM_BLE_SCAN_PARAM_UNDEF ? BTM_BLE_SCAN_FAST_WIN : p_cb->scan_win;
 
     BTM_TRACE_EVENT ("%s", __func__);
 
@@ -468,7 +468,7 @@
                                                     p_cb->addr_mgnt_cb.own_addr_type,
                                                     SP_ADV_WL))
                 {
-                    return FALSE;
+                    return false;
                 }
             }
             else
@@ -479,22 +479,22 @@
                                                        p_cb->addr_mgnt_cb.own_addr_type,
                                                        SP_ADV_WL))
                 {
-                    return FALSE;
+                    return false;
                 }
             }
 
             if (!btm_ble_topology_check(BTM_BLE_STATE_PASSIVE_SCAN))
             {
                 BTM_TRACE_ERROR("peripheral device cannot initiate passive scan for a selective connection");
-                return FALSE;
+                return false;
             }
             else if (background_connections_pending())
             {
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
                 btm_ble_enable_resolving_list_for_platform(BTM_BLE_RL_SCAN);
 #endif
-                if (!btsnd_hcic_ble_set_scan_enable(TRUE, TRUE)) /* duplicate filtering enabled */
-                     return FALSE;
+                if (!btsnd_hcic_ble_set_scan_enable(true, true)) /* duplicate filtering enabled */
+                     return false;
 
                  /* mark up inquiry status flag */
                  p_cb->scan_activity |= BTM_LE_SELECT_CONN_ACTIVE;
@@ -504,7 +504,7 @@
         else
         {
             BTM_TRACE_ERROR("scan active, can not start selective connection procedure");
-            return FALSE;
+            return false;
         }
     }
     else /* disable selective connection mode */
@@ -517,7 +517,7 @@
         if (!BTM_BLE_IS_SCAN_ACTIVE(p_cb->scan_activity))
             btm_ble_stop_scan(); /* duplicate filtering enabled */
     }
-    return TRUE;
+    return true;
 }
 /*******************************************************************************
 **
@@ -525,11 +525,11 @@
 **
 ** Description      This function is to start/stop selective connection procedure.
 **
-** Parameters       start: TRUE to start; FALSE to stop.
+** Parameters       start: true to start; false to stop.
 **                  p_select_cback: callback function to return application
 **                                  selection.
 **
-** Returns          BOOLEAN: selective connectino procedure is started.
+** Returns          bool   : selective connectino procedure is started.
 **
 *******************************************************************************/
 void btm_ble_initiate_select_conn(BD_ADDR bda)
@@ -554,16 +554,16 @@
 ** Returns          none.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_suspend_bg_conn(void)
+bool    btm_ble_suspend_bg_conn(void)
 {
     BTM_TRACE_EVENT ("%s", __func__);
 
     if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_AUTO)
-        return btm_ble_start_auto_conn(FALSE);
+        return btm_ble_start_auto_conn(false);
     else if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_SELECTIVE)
-        return btm_ble_start_select_conn(FALSE, NULL);
+        return btm_ble_start_select_conn(false, NULL);
 
-    return FALSE;
+    return false;
 }
 /*******************************************************************************
 **
@@ -578,11 +578,11 @@
 {
     if (wl_state & BTM_BLE_WL_INIT)
     {
-        btm_ble_start_auto_conn(FALSE);
+        btm_ble_start_auto_conn(false);
     }
     if (wl_state & BTM_BLE_WL_SCAN)
     {
-        btm_ble_start_select_conn(FALSE, NULL);
+        btm_ble_start_select_conn(false, NULL);
     }
     if (wl_state & BTM_BLE_WL_ADV)
     {
@@ -621,18 +621,18 @@
 ** Returns          none.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_resume_bg_conn(void)
+bool    btm_ble_resume_bg_conn(void)
 {
     tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
-    BOOLEAN ret = FALSE;
+    bool    ret = false;
 
     if (p_cb->bg_conn_type != BTM_BLE_CONN_NONE)
     {
         if (p_cb->bg_conn_type == BTM_BLE_CONN_AUTO)
-            ret = btm_ble_start_auto_conn(TRUE);
+            ret = btm_ble_start_auto_conn(true);
 
         if (p_cb->bg_conn_type == BTM_BLE_CONN_SELECTIVE)
-            ret = btm_ble_start_select_conn(TRUE, btm_cb.ble_ctr_cb.p_select_cback);
+            ret = btm_ble_start_select_conn(true, btm_cb.ble_ctr_cb.p_select_cback);
     }
 
     return ret;
@@ -692,13 +692,13 @@
 **
 ** Description      This function send the pending direct connection request in queue
 **
-** Returns          TRUE if started, FALSE otherwise
+** Returns          true if started, false otherwise
 **
 *******************************************************************************/
-BOOLEAN btm_send_pending_direct_conn(void)
+bool    btm_send_pending_direct_conn(void)
 {
     tBTM_BLE_CONN_REQ *p_req;
-    BOOLEAN     rt = FALSE;
+    bool        rt = false;
 
     p_req = (tBTM_BLE_CONN_REQ*)fixed_queue_try_dequeue(btm_cb.ble_ctr_cb.conn_pending_q);
     if (p_req != NULL) {
diff --git a/stack/btm/btm_ble_cont_energy.c b/stack/btm/btm_ble_cont_energy.c
index 0da6cf0..10022b1 100644
--- a/stack/btm/btm_ble_cont_energy.c
+++ b/stack/btm/btm_ble_cont_energy.c
@@ -43,10 +43,10 @@
 *******************************************************************************/
 void btm_ble_cont_energy_cmpl_cback (tBTM_VSC_CMPL *p_params)
 {
-    UINT8  *p = p_params->p_param_buf;
-    UINT16  len = p_params->param_len;
-    UINT8  status = 0;
-    UINT32 total_tx_time = 0, total_rx_time = 0, total_idle_time = 0, total_energy_used = 0;
+    uint8_t *p = p_params->p_param_buf;
+    uint16_t len = p_params->param_len;
+    uint8_t status = 0;
+    uint32_t total_tx_time = 0, total_rx_time = 0, total_idle_time = 0, total_energy_used = 0;
 
     if (len < 17)
     {
diff --git a/stack/btm/btm_ble_gap.c b/stack/btm/btm_ble_gap.c
index 44452c0..120d8a9 100644
--- a/stack/btm/btm_ble_gap.c
+++ b/stack/btm/btm_ble_gap.c
@@ -37,7 +37,7 @@
 #include "gap_api.h"
 #include "hcimsgs.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
 #include "btm_ble_int.h"
 #include "gatt_int.h"
@@ -58,18 +58,18 @@
 
 extern fixed_queue_t *btu_general_alarm_queue;
 
-#if BLE_VND_INCLUDED == TRUE
+#if (BLE_VND_INCLUDED == TRUE)
 static tBTM_BLE_CTRL_FEATURES_CBACK    *p_ctrl_le_feature_rd_cmpl_cback = NULL;
 #endif
 
 /*******************************************************************************
 **  Local functions
 *******************************************************************************/
-static void btm_ble_update_adv_flag(UINT8 flag);
-static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt_type, UINT8 *p);
-UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst,
+static void btm_ble_update_adv_flag(uint8_t flag);
+static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, uint8_t addr_type, uint8_t evt_type, uint8_t *p);
+uint8_t *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, uint8_t **p_dst,
                               tBTM_BLE_ADV_DATA *p_data);
-static UINT8 btm_set_conn_mode_adv_init_addr(tBTM_BLE_INQ_CB *p_cb,
+static uint8_t btm_set_conn_mode_adv_init_addr(tBTM_BLE_INQ_CB *p_cb,
                                      BD_ADDR_PTR p_peer_addr_ptr,
                                      tBLE_ADDR_TYPE *p_peer_addr_type,
                                      tBLE_ADDR_TYPE *p_own_addr_type);
@@ -86,7 +86,7 @@
 #define BTM_BLE_SEL_CONN_RESULT     0x04
 
 /* LE states combo bit to check */
-const UINT8 btm_le_state_combo_tbl[BTM_BLE_STATE_MAX][BTM_BLE_STATE_MAX][2] =
+const uint8_t btm_le_state_combo_tbl[BTM_BLE_STATE_MAX][BTM_BLE_STATE_MAX][2] =
 {
     {/* single state support */
         {HCI_SUPP_LE_STATES_CONN_ADV_MASK, HCI_SUPP_LE_STATES_CONN_ADV_OFF},  /* conn_adv */
@@ -237,12 +237,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN BTM_BleUpdateAdvWhitelist(BOOLEAN add_remove, BD_ADDR remote_bda)
+bool    BTM_BleUpdateAdvWhitelist(bool    add_remove, BD_ADDR remote_bda)
 {
     UNUSED(add_remove);
     UNUSED(remote_bda);
 
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -260,7 +260,7 @@
     tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
     tBLE_ADDR_TYPE   init_addr_type = BLE_ADDR_PUBLIC;
     BD_ADDR          p_addr_ptr= {0};
-    UINT8            adv_mode = p_cb->adv_mode;
+    uint8_t          adv_mode = p_cb->adv_mode;
 
     BTM_TRACE_EVENT ("BTM_BleUpdateAdvFilterPolicy");
 
@@ -278,9 +278,9 @@
             p_cb->evt_type = btm_set_conn_mode_adv_init_addr(p_cb, p_addr_ptr, &init_addr_type,
                                                               &p_cb->adv_addr_type);
 
-        btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
+        btsnd_hcic_ble_write_adv_params ((uint16_t)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
                                          BTM_BLE_GAP_ADV_SLOW_INT),
-                                         (UINT16)(p_cb->adv_interval_max ? p_cb->adv_interval_max :
+                                         (uint16_t)(p_cb->adv_interval_max ? p_cb->adv_interval_max :
                                          BTM_BLE_GAP_ADV_SLOW_INT),
                                          p_cb->evt_type,
                                          p_cb->adv_addr_type,
@@ -307,15 +307,15 @@
 **                  addr_type_own - Own address type
 **                  scan_filter_policy - Scan filter policy
 **
-** Returns          TRUE or FALSE
+** Returns          true or false
 **
 *******************************************************************************/
-BOOLEAN btm_ble_send_extended_scan_params(UINT8 scan_type, UINT32 scan_int,
-                                          UINT32 scan_win, UINT8 addr_type_own,
-                                          UINT8 scan_filter_policy)
+bool    btm_ble_send_extended_scan_params(uint8_t scan_type, uint32_t scan_int,
+                                          uint32_t scan_win, uint8_t addr_type_own,
+                                          uint8_t scan_filter_policy)
 {
-    UINT8 scan_param[HCIC_PARAM_SIZE_BLE_WRITE_EXTENDED_SCAN_PARAM];
-    UINT8 *pp_scan = scan_param;
+    uint8_t scan_param[HCIC_PARAM_SIZE_BLE_WRITE_EXTENDED_SCAN_PARAM];
+    uint8_t *pp_scan = scan_param;
 
     memset(scan_param, 0, HCIC_PARAM_SIZE_BLE_WRITE_EXTENDED_SCAN_PARAM);
 
@@ -330,9 +330,9 @@
          HCIC_PARAM_SIZE_BLE_WRITE_EXTENDED_SCAN_PARAM, scan_param, NULL)) != BTM_SUCCESS)
     {
         BTM_TRACE_ERROR("%s error sending extended scan parameters", __func__);
-        return FALSE;
+        return false;
     }
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -348,14 +348,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT8 duration,
+tBTM_STATUS BTM_BleObserve(bool    start, uint8_t duration,
                            tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb)
 {
     tBTM_BLE_INQ_CB *p_inq = &btm_cb.ble_ctr_cb.inq_var;
     tBTM_STATUS status = BTM_WRONG_MODE;
 
-    UINT32 scan_interval = !p_inq->scan_interval ? BTM_BLE_GAP_DISC_SCAN_INT : p_inq->scan_interval;
-    UINT32 scan_window = !p_inq->scan_window ? BTM_BLE_GAP_DISC_SCAN_WIN : p_inq->scan_window;
+    uint32_t scan_interval = !p_inq->scan_interval ? BTM_BLE_GAP_DISC_SCAN_INT : p_inq->scan_interval;
+    uint32_t scan_window = !p_inq->scan_window ? BTM_BLE_GAP_DISC_SCAN_WIN : p_inq->scan_window;
 
     BTM_TRACE_EVENT ("%s : scan_type:%d, %d, %d", __func__, btm_cb.btm_inq_vars.scan_type,
                       p_inq->scan_interval, p_inq->scan_window);
@@ -383,15 +383,15 @@
             p_inq->scan_type = (p_inq->scan_type == BTM_BLE_SCAN_MODE_NONE) ?
                                                     BTM_BLE_SCAN_MODE_ACTI: p_inq->scan_type;
             /* assume observe always not using white list */
-            #if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+            #if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == true)
                 /* enable resolving list */
                 btm_ble_enable_resolving_list_for_platform(BTM_BLE_RL_SCAN);
             #endif
 
             if (btm_cb.cmn_ble_vsc_cb.extended_scan_support == 0)
             {
-                btsnd_hcic_ble_set_scan_params(p_inq->scan_type, (UINT16)scan_interval,
-                                               (UINT16)scan_window,
+                btsnd_hcic_ble_set_scan_params(p_inq->scan_type, (uint16_t)scan_interval,
+                                               (uint16_t)scan_window,
                                                btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type,
                                                BTM_BLE_DEFAULT_SFP);
             }
@@ -443,12 +443,12 @@
 ** Returns          status.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_BleBroadcast(BOOLEAN start)
+tBTM_STATUS BTM_BleBroadcast(bool    start)
 {
     tBTM_STATUS status = BTM_NO_RESOURCES;
     tBTM_LE_RANDOM_CB *p_addr_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
     tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
-    UINT8 evt_type = p_cb->scan_rsp ? BTM_BLE_DISCOVER_EVT: BTM_BLE_NON_CONNECT_EVT;
+    uint8_t evt_type = p_cb->scan_rsp ? BTM_BLE_DISCOVER_EVT: BTM_BLE_NON_CONNECT_EVT;
 
     if (!controller_get_interface()->supports_ble())
         return BTM_ILLEGAL_VALUE;
@@ -463,9 +463,9 @@
     if (start && p_cb->adv_mode == BTM_BLE_ADV_DISABLE)
     {
         /* update adv params */
-        if (!btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
+        if (!btsnd_hcic_ble_write_adv_params ((uint16_t)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
                                               BTM_BLE_GAP_ADV_INT),
-                                              (UINT16)(p_cb->adv_interval_max ? p_cb->adv_interval_max :
+                                              (uint16_t)(p_cb->adv_interval_max ? p_cb->adv_interval_max :
                                               BTM_BLE_GAP_ADV_INT),
                                               evt_type,
                                               p_addr_cb->own_addr_type,
@@ -483,8 +483,8 @@
     else if (!start)
     {
         status = btm_ble_stop_adv();
-#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
     }
     else
@@ -496,7 +496,7 @@
     return status;
 }
 
-#if BLE_VND_INCLUDED == TRUE
+#if (BLE_VND_INCLUDED == TRUE)
 /*******************************************************************************
 **
 ** Function         btm_vsc_brcm_features_complete
@@ -508,8 +508,8 @@
 *******************************************************************************/
 static void btm_ble_vendor_capability_vsc_cmpl_cback (tBTM_VSC_CMPL *p_vcs_cplt_params)
 {
-    UINT8 status = 0xFF;
-    UINT8 *p;
+    uint8_t status = 0xFF;
+    uint8_t *p;
 
     BTM_TRACE_DEBUG("%s", __func__);
 
@@ -546,7 +546,7 @@
             STREAM_TO_UINT16(btm_cb.cmn_ble_vsc_cb.extended_scan_support, p);
             STREAM_TO_UINT16(btm_cb.cmn_ble_vsc_cb.debug_logging_supported, p);
         }
-        btm_cb.cmn_ble_vsc_cb.values_read = TRUE;
+        btm_cb.cmn_ble_vsc_cb.values_read = true;
     }
 
     BTM_TRACE_DEBUG("%s: stat=%d, irk=%d, ADV ins:%d, rpa=%d, ener=%d, ext_scan=%d",
@@ -560,12 +560,12 @@
     if (btm_cb.cmn_ble_vsc_cb.max_filter > 0)
         btm_ble_adv_filter_init();
 
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
     /* VS capability included and non-4.2 device */
     if (btm_cb.cmn_ble_vsc_cb.max_irk_list_sz > 0 &&
         controller_get_interface()->get_ble_resolving_list_max_size() == 0)
         btm_ble_resolving_list_init(btm_cb.cmn_ble_vsc_cb.max_irk_list_sz);
-#endif  /* (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE) */
+#endif  /* (BLE_PRIVACY_SPT == TRUE) */
 
     if (btm_cb.cmn_ble_vsc_cb.tot_scan_results_strg > 0)
         btm_ble_batchscan_init();
@@ -573,7 +573,7 @@
     if (p_ctrl_le_feature_rd_cmpl_cback != NULL)
         p_ctrl_le_feature_rd_cmpl_cback(status);
 }
-#endif  /* BLE_VND_INCLUDED == TRUE */
+#endif  /* (BLE_VND_INCLUDED == TRUE) */
 
 /*******************************************************************************
 **
@@ -609,10 +609,10 @@
 *******************************************************************************/
 extern void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK  *p_vsc_cback)
 {
-    if (TRUE == btm_cb.cmn_ble_vsc_cb.values_read)
+    if (true == btm_cb.cmn_ble_vsc_cb.values_read)
         return;
 
-#if BLE_VND_INCLUDED == TRUE
+#if (BLE_VND_INCLUDED == TRUE)
     BTM_TRACE_DEBUG("BTM_BleReadControllerFeatures");
 
     p_ctrl_le_feature_rd_cmpl_cback = p_vsc_cback;
@@ -642,10 +642,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void BTM_BleEnableMixedPrivacyMode(BOOLEAN mixed_on)
+void BTM_BleEnableMixedPrivacyMode(bool    mixed_on)
 {
 
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
     btm_cb.ble_ctr_cb.mixed_mode = mixed_on;
 
     /* TODO: send VSC to enabled mixed mode */
@@ -661,19 +661,19 @@
 **
 ** Parameters       privacy_mode:  privacy mode on or off.
 **
-** Returns          BOOLEAN privacy mode set success; otherwise failed.
+** Returns          bool    privacy mode set success; otherwise failed.
 **
 *******************************************************************************/
-BOOLEAN BTM_BleConfigPrivacy(BOOLEAN privacy_mode)
+bool    BTM_BleConfigPrivacy(bool    privacy_mode)
 {
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
     tBTM_BLE_CB  *p_cb = &btm_cb.ble_ctr_cb;
 
     BTM_TRACE_EVENT ("%s", __func__);
 
     /* if LE is not supported, return error */
     if (!controller_get_interface()->supports_ble())
-        return FALSE;
+        return false;
 
     uint8_t addr_resolution = 0;
     if(!privacy_mode)/* if privacy disabled, always use public address */
@@ -703,9 +703,9 @@
 
     GAP_BleAttrDBUpdate (GATT_UUID_GAP_CENTRAL_ADDR_RESOL, (tGAP_BLE_ATTR_VALUE *)&addr_resolution);
 
-    return TRUE;
+    return true;
 #else
-    return FALSE;
+    return false;
 #endif
 }
 
@@ -718,13 +718,13 @@
 ** Returns          Max multi adv instance count
 **
 *******************************************************************************/
-extern UINT8  BTM_BleMaxMultiAdvInstanceCount(void)
+extern uint8_t BTM_BleMaxMultiAdvInstanceCount(void)
 {
     return btm_cb.cmn_ble_vsc_cb.adv_inst_max < BTM_BLE_MULTI_ADV_MAX ?
         btm_cb.cmn_ble_vsc_cb.adv_inst_max : BTM_BLE_MULTI_ADV_MAX;
 }
 
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
 /*******************************************************************************
 **
 ** Function         btm_ble_resolve_random_addr_on_adv
@@ -737,10 +737,10 @@
 static void btm_ble_resolve_random_addr_on_adv(void * p_rec, void *p)
 {
     tBTM_SEC_DEV_REC    *match_rec = (tBTM_SEC_DEV_REC *) p_rec;
-    UINT8       addr_type = BLE_ADDR_RANDOM;
+    uint8_t     addr_type = BLE_ADDR_RANDOM;
     BD_ADDR     bda;
-    UINT8       *pp = (UINT8 *)p + 1;
-    UINT8           evt_type;
+    uint8_t     *pp = (uint8_t *)p + 1;
+    uint8_t         evt_type;
 
     BTM_TRACE_EVENT ("btm_ble_resolve_random_addr_on_adv ");
 
@@ -775,12 +775,12 @@
 **
 ** Description        Checks if local device supports private address
 **
-** Returns          Return TRUE if local privacy is enabled else FALSE
+** Returns          Return true if local privacy is enabled else false
 **
 *******************************************************************************/
-BOOLEAN BTM_BleLocalPrivacyEnabled(void)
+bool    BTM_BleLocalPrivacyEnabled(void)
 {
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
     return (btm_cb.ble_ctr_cb.privacy_mode != BTM_PRIVACY_NONE);
 #else
     return false;
@@ -801,46 +801,46 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE   bg_conn_type,
+bool    BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE   bg_conn_type,
                              tBTM_BLE_SEL_CBACK   *p_select_cback)
 {
-    BOOLEAN started = TRUE;
+    bool    started = true;
 
     BTM_TRACE_EVENT ("BTM_BleSetBgConnType ");
     if (!controller_get_interface()->supports_ble())
-        return FALSE;
+        return false;
 
     if (btm_cb.ble_ctr_cb.bg_conn_type != bg_conn_type)
     {
         switch (bg_conn_type)
         {
             case BTM_BLE_CONN_AUTO:
-                btm_ble_start_auto_conn(TRUE);
+                btm_ble_start_auto_conn(true);
                 break;
 
             case BTM_BLE_CONN_SELECTIVE:
                 if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_AUTO)
                 {
-                    btm_ble_start_auto_conn(FALSE);
+                    btm_ble_start_auto_conn(false);
                 }
-                btm_ble_start_select_conn(TRUE, p_select_cback);
+                btm_ble_start_select_conn(true, p_select_cback);
                 break;
 
             case BTM_BLE_CONN_NONE:
                 if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_AUTO)
                 {
-                    btm_ble_start_auto_conn(FALSE);
+                    btm_ble_start_auto_conn(false);
                 }
                 else if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_SELECTIVE)
                 {
-                    btm_ble_start_select_conn(FALSE, NULL);
+                    btm_ble_start_select_conn(false, NULL);
                 }
-                started = TRUE;
+                started = true;
                 break;
 
             default:
                 BTM_TRACE_ERROR("invalid bg connection type : %d ", bg_conn_type);
-                started = FALSE;
+                started = false;
                 break;
         }
 
@@ -865,7 +865,7 @@
 *******************************************************************************/
 void BTM_BleClearBgConnDev(void)
 {
-    btm_ble_start_auto_conn(FALSE);
+    btm_ble_start_auto_conn(false);
     btm_ble_clear_white_list();
     gatt_reset_bgdev_list();
 }
@@ -879,13 +879,13 @@
 *                   procedure is decided by the background connection type, it can be
 *                   auto connection, or selective connection.
 **
-** Parameters       add_remove: TRUE to add; FALSE to remove.
+** Parameters       add_remove: true to add; false to remove.
 **                  remote_bda: device address to add/remove.
 **
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN BTM_BleUpdateBgConnDev(BOOLEAN add_remove, BD_ADDR   remote_bda)
+bool    BTM_BleUpdateBgConnDev(bool    add_remove, BD_ADDR   remote_bda)
 {
     BTM_TRACE_EVENT("%s() add=%d", __func__, add_remove);
     return btm_update_dev_to_white_list(add_remove, remote_bda);
@@ -918,7 +918,7 @@
     return btm_ble_set_connectability( p_cb->connectable_mode);
 }
 
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
 static bool is_resolving_list_bit_set(void *data, void *context)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = data;
@@ -939,13 +939,13 @@
 **
 **
 *******************************************************************************/
-static UINT8 btm_set_conn_mode_adv_init_addr(tBTM_BLE_INQ_CB *p_cb,
+static uint8_t btm_set_conn_mode_adv_init_addr(tBTM_BLE_INQ_CB *p_cb,
                                      BD_ADDR_PTR p_peer_addr_ptr,
                                      tBLE_ADDR_TYPE *p_peer_addr_type,
                                      tBLE_ADDR_TYPE *p_own_addr_type)
 {
-    UINT8 evt_type;
-#if BLE_PRIVACY_SPT == TRUE
+    uint8_t evt_type;
+#if (BLE_PRIVACY_SPT == TRUE)
     tBTM_SEC_DEV_REC *p_dev_rec;
 #endif
 
@@ -961,7 +961,7 @@
              p_cb->directed_conn == BTM_BLE_CONNECT_LO_DUTY_DIR_EVT)
         {
 
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
             /* for privacy 1.2, convert peer address as static, own address set as ID addr */
             if (btm_cb.ble_ctr_cb.privacy_mode ==  BTM_PRIVACY_1_2 ||
                 btm_cb.ble_ctr_cb.privacy_mode ==  BTM_PRIVACY_MIXED)
@@ -979,7 +979,7 @@
                  /* otherwise fall though as normal directed adv */
                  else
                  {
-                    btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, TRUE);
+                    btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, true);
                  }
             }
 #endif
@@ -991,7 +991,7 @@
     }
 
     /* undirect adv mode or non-connectable mode*/
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
     /* when privacy 1.2 privacy only mode is used, or mixed mode */
     if ((btm_cb.ble_ctr_cb.privacy_mode ==  BTM_PRIVACY_1_2 && p_cb->afp != AP_SCAN_CONN_ALL) ||
         btm_cb.ble_ctr_cb.privacy_mode ==  BTM_PRIVACY_MIXED)
@@ -1036,7 +1036,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max,
+tBTM_STATUS BTM_BleSetAdvParams(uint16_t adv_int_min, uint16_t adv_int_max,
                                 tBLE_BD_ADDR *p_dir_bda,
                                 tBTM_BLE_ADV_CHNL_MAP chnl_map)
 {
@@ -1046,7 +1046,7 @@
     BD_ADDR     p_addr_ptr =  {0};
     tBLE_ADDR_TYPE   init_addr_type = BLE_ADDR_PUBLIC;
     tBLE_ADDR_TYPE   own_addr_type = p_addr_cb->own_addr_type;
-    UINT8            adv_mode = p_cb->adv_mode;
+    uint8_t          adv_mode = p_cb->adv_mode;
 
     BTM_TRACE_EVENT ("BTM_BleSetAdvParams");
 
@@ -1105,7 +1105,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max,
+void BTM_BleReadAdvParams (uint16_t *adv_int_min, uint16_t *adv_int_max,
                            tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP *p_chnl_map)
 {
     tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
@@ -1139,13 +1139,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void BTM_BleSetScanParams(tGATT_IF client_if, UINT32 scan_interval, UINT32 scan_window,
+void BTM_BleSetScanParams(tGATT_IF client_if, uint32_t scan_interval, uint32_t scan_window,
                           tBLE_SCAN_MODE scan_mode,
                           tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback)
 {
     tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
-    UINT32 max_scan_interval;
-    UINT32 max_scan_window;
+    uint32_t max_scan_interval;
+    uint32_t max_scan_window;
 
     BTM_TRACE_EVENT ("%s", __func__);
     if (!controller_get_interface()->supports_ble())
@@ -1200,7 +1200,7 @@
 tBTM_STATUS BTM_BleWriteScanRsp(tBTM_BLE_AD_MASK data_mask, tBTM_BLE_ADV_DATA *p_data)
 {
     tBTM_STATUS     status = BTM_NO_RESOURCES;
-    UINT8   rsp_data[BTM_BLE_AD_DATA_LEN],
+    uint8_t rsp_data[BTM_BLE_AD_DATA_LEN],
             *p = rsp_data;
 
     BTM_TRACE_EVENT ("%s: data_mask:%08x", __func__, data_mask);
@@ -1210,14 +1210,14 @@
     memset(rsp_data, 0, BTM_BLE_AD_DATA_LEN);
     btm_ble_build_adv_data(&data_mask, &p, p_data);
 
-    if (btsnd_hcic_ble_set_scan_rsp_data((UINT8)(p - rsp_data), rsp_data))
+    if (btsnd_hcic_ble_set_scan_rsp_data((uint8_t)(p - rsp_data), rsp_data))
     {
         status = BTM_SUCCESS;
 
         if (data_mask != 0)
-            btm_cb.ble_ctr_cb.inq_var.scan_rsp = TRUE;
+            btm_cb.ble_ctr_cb.inq_var.scan_rsp = true;
         else
-            btm_cb.ble_ctr_cb.inq_var.scan_rsp = FALSE;
+            btm_cb.ble_ctr_cb.inq_var.scan_rsp = false;
     }
     else
         status = BTM_ILLEGAL_VALUE;
@@ -1239,7 +1239,7 @@
 tBTM_STATUS BTM_BleWriteAdvData(tBTM_BLE_AD_MASK data_mask, tBTM_BLE_ADV_DATA *p_data)
 {
     tBTM_BLE_LOCAL_ADV_DATA *p_cb_data = &btm_cb.ble_ctr_cb.inq_var.adv_data;
-    UINT8  *p;
+    uint8_t *p;
     tBTM_BLE_AD_MASK   mask = data_mask;
 
     BTM_TRACE_EVENT ("BTM_BleWriteAdvData ");
@@ -1262,7 +1262,7 @@
 
     p_cb_data->data_mask &= ~mask;
 
-    if (btsnd_hcic_ble_set_adv_data((UINT8)(p_cb_data->p_pad - p_cb_data->ad_data),
+    if (btsnd_hcic_ble_set_adv_data((uint8_t)(p_cb_data->p_pad - p_cb_data->ad_data),
                                     p_cb_data->ad_data))
         return BTM_SUCCESS;
     else
@@ -1283,11 +1283,11 @@
 ** Returns          pointer of ADV data
 **
 *******************************************************************************/
-UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length)
+uint8_t *BTM_CheckAdvData( uint8_t *p_adv, uint8_t type, uint8_t *p_length)
 {
-    UINT8 *p = p_adv;
-    UINT8 length;
-    UINT8 adv_type;
+    uint8_t *p = p_adv;
+    uint8_t length;
+    uint8_t adv_type;
     BTM_TRACE_API("%s: type=0x%02x", __func__, type);
 
     STREAM_TO_UINT8(length, p);
@@ -1321,9 +1321,9 @@
 **                     BTM_BLE_GENRAL_DISCOVERABLE
 **
 *******************************************************************************/
-UINT16 BTM_BleReadDiscoverability()
+uint16_t BTM_BleReadDiscoverability()
 {
-    BTM_TRACE_API("%s", __FUNCTION__);
+    BTM_TRACE_API("%s", __func__);
 
     return (btm_cb.ble_ctr_cb.inq_var.discoverable_mode);
 }
@@ -1338,9 +1338,9 @@
 ** Returns          BTM_BLE_NON_CONNECTABLE or BTM_BLE_CONNECTABLE
 **
 *******************************************************************************/
-UINT16 BTM_BleReadConnectability()
+uint16_t BTM_BleReadConnectability()
 {
-    BTM_TRACE_API ("%s", __FUNCTION__);
+    BTM_TRACE_API ("%s", __func__);
 
     return (btm_cb.ble_ctr_cb.inq_var.connectable_mode);
 }
@@ -1351,14 +1351,14 @@
 **
 ** Description      This function is called build the adv data and rsp data.
 *******************************************************************************/
-UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst,
+uint8_t *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, uint8_t **p_dst,
                               tBTM_BLE_ADV_DATA *p_data)
 {
-    UINT32 data_mask = *p_data_mask;
-    UINT8   *p = *p_dst,
+    uint32_t data_mask = *p_data_mask;
+    uint8_t *p = *p_dst,
     *p_flag = NULL;
-    UINT16  len = BTM_BLE_AD_DATA_LEN, cp_len = 0;
-    UINT8   i = 0;
+    uint16_t len = BTM_BLE_AD_DATA_LEN, cp_len = 0;
+    uint8_t i = 0;
     tBTM_BLE_PROP_ELEM      *p_elem;
 
     BTM_TRACE_EVENT (" btm_ble_build_adv_data");
@@ -1395,7 +1395,7 @@
 #if BTM_MAX_LOC_BD_NAME_LEN > 0
         if (len > MIN_ADV_LENGTH && data_mask & BTM_BLE_AD_BIT_DEV_NAME)
         {
-            if (strlen(btm_cb.cfg.bd_name) > (UINT16)(len - MIN_ADV_LENGTH))
+            if (strlen(btm_cb.cfg.bd_name) > (uint16_t)(len - MIN_ADV_LENGTH))
             {
                 *p++ = len - MIN_ADV_LENGTH + 1;
                 *p++ = BTM_BLE_AD_TYPE_NAME_SHORT;
@@ -1403,7 +1403,7 @@
             }
             else
             {
-                cp_len = (UINT16)strlen(btm_cb.cfg.bd_name);
+                cp_len = (uint16_t)strlen(btm_cb.cfg.bd_name);
                 *p++ = cp_len + 1;
                 *p++ = BTM_BLE_AD_TYPE_NAME_CMPL;
                 ARRAY_TO_STREAM(p, btm_cb.cfg.bd_name, cp_len);
@@ -1625,7 +1625,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_select_adv_interval(tBTM_BLE_INQ_CB *p_cb, UINT8 evt_type, UINT16 *p_adv_int_min, UINT16 *p_adv_int_max)
+void btm_ble_select_adv_interval(tBTM_BLE_INQ_CB *p_cb, uint8_t evt_type, uint16_t *p_adv_int_min, uint16_t *p_adv_int_max)
 {
     if (p_cb->adv_interval_min && p_cb->adv_interval_max)
     {
@@ -1675,8 +1675,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_update_dmt_flag_bits(UINT8 *adv_flag_value, const UINT16 connect_mode,
-                                   const UINT16 disc_mode)
+void btm_ble_update_dmt_flag_bits(uint8_t *adv_flag_value, const uint16_t connect_mode,
+                                   const uint16_t disc_mode)
 {
     /* BR/EDR non-discoverable , non-connectable */
     if ((disc_mode & BTM_DISCOVERABLE_MASK) == 0 &&
@@ -1704,9 +1704,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_set_adv_flag(UINT16 connect_mode, UINT16 disc_mode)
+void btm_ble_set_adv_flag(uint16_t connect_mode, uint16_t disc_mode)
 {
-    UINT8 flag = 0, old_flag = 0;
+    uint8_t flag = 0, old_flag = 0;
     tBTM_BLE_LOCAL_ADV_DATA *p_adv_data = &btm_cb.ble_ctr_cb.inq_var.adv_data;
 
     if (p_adv_data->p_flags != NULL)
@@ -1747,20 +1747,20 @@
 ** Returns          BTM_SUCCESS is status set successfully; otherwise failure.
 **
 *******************************************************************************/
-tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode)
+tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode)
 {
     tBTM_LE_RANDOM_CB   *p_addr_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
     tBTM_BLE_INQ_CB     *p_cb = &btm_cb.ble_ctr_cb.inq_var;
-    UINT16              mode = (combined_mode &  BTM_BLE_DISCOVERABLE_MASK);
-    UINT8               new_mode = BTM_BLE_ADV_ENABLE;
-    UINT8               evt_type;
+    uint16_t            mode = (combined_mode &  BTM_BLE_DISCOVERABLE_MASK);
+    uint8_t             new_mode = BTM_BLE_ADV_ENABLE;
+    uint8_t             evt_type;
     tBTM_STATUS         status = BTM_SUCCESS;
     BD_ADDR             p_addr_ptr= {0};
     tBLE_ADDR_TYPE      init_addr_type = BLE_ADDR_PUBLIC,
                         own_addr_type = p_addr_cb->own_addr_type;
-    UINT16              adv_int_min, adv_int_max;
+    uint16_t            adv_int_min, adv_int_max;
 
-    BTM_TRACE_EVENT ("%s mode=0x%0x combined_mode=0x%x", __FUNCTION__, mode, combined_mode);
+    BTM_TRACE_EVENT ("%s mode=0x%0x combined_mode=0x%x", __func__, mode, combined_mode);
 
     /*** Check mode parameter ***/
     if (mode > BTM_BLE_MAX_DISCOVERABLE)
@@ -1819,7 +1819,7 @@
 
     if (p_cb->adv_mode == BTM_BLE_ADV_ENABLE)
     {
-        p_cb->fast_adv_on = TRUE;
+        p_cb->fast_adv_on = true;
         /* start initial GAP mode adv timer */
         alarm_set_on_queue(p_cb->fast_adv_timer,
                            BTM_BLE_GAP_FAST_ADV_TIMEOUT_MS,
@@ -1828,8 +1828,8 @@
     }
     else
     {
-#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
     }
 
@@ -1857,20 +1857,20 @@
 ** Returns          BTM_SUCCESS is status set successfully; otherwise failure.
 **
 *******************************************************************************/
-tBTM_STATUS btm_ble_set_connectability(UINT16 combined_mode)
+tBTM_STATUS btm_ble_set_connectability(uint16_t combined_mode)
 {
     tBTM_LE_RANDOM_CB       *p_addr_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
     tBTM_BLE_INQ_CB         *p_cb = &btm_cb.ble_ctr_cb.inq_var;
-    UINT16                  mode = (combined_mode & BTM_BLE_CONNECTABLE_MASK);
-    UINT8                   new_mode = BTM_BLE_ADV_ENABLE;
-    UINT8                   evt_type;
+    uint16_t                mode = (combined_mode & BTM_BLE_CONNECTABLE_MASK);
+    uint8_t                 new_mode = BTM_BLE_ADV_ENABLE;
+    uint8_t                 evt_type;
     tBTM_STATUS             status = BTM_SUCCESS;
     BD_ADDR                 p_addr_ptr =  {0};
     tBLE_ADDR_TYPE          peer_addr_type = BLE_ADDR_PUBLIC,
                             own_addr_type = p_addr_cb->own_addr_type;
-    UINT16                  adv_int_min, adv_int_max;
+    uint16_t                adv_int_min, adv_int_max;
 
-    BTM_TRACE_EVENT ("%s mode=0x%0x combined_mode=0x%x", __FUNCTION__, mode, combined_mode);
+    BTM_TRACE_EVENT ("%s mode=0x%0x combined_mode=0x%x", __func__, mode, combined_mode);
 
     /*** Check mode parameter ***/
     if (mode > BTM_BLE_MAX_CONNECTABLE)
@@ -1925,7 +1925,7 @@
 
     if (p_cb->adv_mode == BTM_BLE_ADV_ENABLE)
     {
-        p_cb->fast_adv_on = TRUE;
+        p_cb->fast_adv_on = true;
         /* start initial GAP mode adv timer */
         alarm_set_on_queue(p_cb->fast_adv_timer,
                            BTM_BLE_GAP_FAST_ADV_TIMEOUT_MS,
@@ -1934,8 +1934,8 @@
     }
     else
     {
-#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
     }
     return status;
@@ -1960,7 +1960,7 @@
 **                  BTM_BUSY - if an inquiry is already active
 **
 *******************************************************************************/
-tBTM_STATUS btm_ble_start_inquiry (UINT8 mode, UINT8   duration)
+tBTM_STATUS btm_ble_start_inquiry (uint8_t mode, uint8_t duration)
 {
     tBTM_STATUS status = BTM_CMD_STARTED;
     tBTM_BLE_CB *p_ble_cb = &btm_cb.ble_ctr_cb;
@@ -1983,7 +1983,7 @@
                                         BTM_BLE_LOW_LATENCY_SCAN_WIN,
                                         btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type,
                                         SP_ADV_ALL);
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
         /* enable IRK list */
         btm_ble_enable_resolving_list_for_platform(BTM_BLE_RL_SCAN);
 #endif
@@ -1992,7 +1992,7 @@
     }
     else if ((p_ble_cb->inq_var.scan_interval != BTM_BLE_LOW_LATENCY_SCAN_INT) ||
             (p_ble_cb->inq_var.scan_window != BTM_BLE_LOW_LATENCY_SCAN_WIN)) {
-        BTM_TRACE_DEBUG("%s, restart LE scan with low latency scan params", __FUNCTION__);
+        BTM_TRACE_DEBUG("%s, restart LE scan with low latency scan params", __func__);
         btsnd_hcic_ble_set_scan_enable(BTM_BLE_SCAN_DISABLE, BTM_BLE_DUPLICATE_ENABLE);
         btsnd_hcic_ble_set_scan_params(BTM_BLE_SCAN_MODE_ACTI,
                                         BTM_BLE_LOW_LATENCY_SCAN_INT,
@@ -2031,9 +2031,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_read_remote_name_cmpl(BOOLEAN status, BD_ADDR bda, UINT16 length, char *p_name)
+void btm_ble_read_remote_name_cmpl(bool    status, BD_ADDR bda, uint16_t length, char *p_name)
 {
-    UINT8   hci_status = HCI_SUCCESS;
+    uint8_t hci_status = HCI_SUCCESS;
     BD_NAME bd_name;
 
     memset(bd_name, 0, (BD_NAME_LEN + 1));
@@ -2041,7 +2041,7 @@
     {
         length = BD_NAME_LEN;
     }
-    memcpy((UINT8*)bd_name, p_name, length);
+    memcpy((uint8_t*)bd_name, p_name, length);
 
     if ((!status) || (length==0))
     {
@@ -2049,7 +2049,7 @@
     }
 
     btm_process_remote_name(bda, bd_name, length +1, hci_status);
-    btm_sec_rmt_name_request_complete (bda, (UINT8 *)p_name, hci_status);
+    btm_sec_rmt_name_request_complete (bda, (uint8_t *)p_name, hci_status);
 }
 
 /*******************************************************************************
@@ -2087,7 +2087,7 @@
         return BTM_BUSY;
 
     p_inq->p_remname_cmpl_cb = p_cb;
-    p_inq->remname_active = TRUE;
+    p_inq->remname_active = true;
 
     memcpy(p_inq->remname_bda, remote_bda, BD_ADDR_LEN);
 
@@ -2110,14 +2110,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN btm_ble_cancel_remote_name(BD_ADDR remote_bda)
+bool    btm_ble_cancel_remote_name(BD_ADDR remote_bda)
 {
     tBTM_INQUIRY_VAR_ST      *p_inq = &btm_cb.btm_inq_vars;
-    BOOLEAN     status;
+    bool        status;
 
     status = GAP_BleCancelReadPeerDevName(remote_bda);
 
-    p_inq->remname_active = FALSE;
+    p_inq->remname_active = false;
     memset(p_inq->remname_bda, 0, BD_ADDR_LEN);
     alarm_cancel(p_inq->remote_name_timer);
 
@@ -2136,10 +2136,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btm_ble_update_adv_flag(UINT8 flag)
+static void btm_ble_update_adv_flag(uint8_t flag)
 {
     tBTM_BLE_LOCAL_ADV_DATA *p_adv_data = &btm_cb.ble_ctr_cb.inq_var.adv_data;
-    UINT8   *p;
+    uint8_t *p;
 
     BTM_TRACE_DEBUG ("btm_ble_update_adv_flag new=0x%x", flag);
 
@@ -2166,7 +2166,7 @@
         p_adv_data->p_pad = p;
     }
 
-    if (btsnd_hcic_ble_set_adv_data((UINT8)(p_adv_data->p_pad - p_adv_data->ad_data),
+    if (btsnd_hcic_ble_set_adv_data((uint8_t)(p_adv_data->p_pad - p_adv_data->ad_data),
                                     p_adv_data->ad_data))
         p_adv_data->data_mask |= BTM_BLE_AD_BIT_FLAGS;
 
@@ -2182,11 +2182,11 @@
 ** Returns          pointer to entry, or NULL if not found
 **
 *******************************************************************************/
-static void btm_ble_parse_adv_data(tBTM_INQ_INFO *p_info, UINT8 *p_data,
-                                   UINT8 len, tBTM_BLE_INQ_DATA *p_adv_data, UINT8 *p_buf)
+static void btm_ble_parse_adv_data(tBTM_INQ_INFO *p_info, uint8_t *p_data,
+                                   uint8_t len, tBTM_BLE_INQ_DATA *p_adv_data, uint8_t *p_buf)
 {
-    UINT8   *p_cur = p_data;
-    UINT8   ad_len, ad_type, ad_flag;
+    uint8_t *p_cur = p_data;
+    uint8_t ad_len, ad_type, ad_flag;
 
     BTM_TRACE_EVENT (" btm_ble_parse_adv_data");
 
@@ -2223,7 +2223,7 @@
             case BTM_BLE_AD_TYPE_FLAG:
                 p_adv_data->ad_mask |= BTM_BLE_AD_BIT_FLAGS;
                 ad_flag = *p_cur ++;
-                p_adv_data->flag = (UINT8)(ad_flag & BTM_BLE_ADV_FLAG_MASK) ;
+                p_adv_data->flag = (uint8_t)(ad_flag & BTM_BLE_ADV_FLAG_MASK) ;
                 BTM_TRACE_DEBUG("BTM_BLE_AD_TYPE_FLAG flag = %s | %s | %s",
                                  (p_adv_data->flag & BTM_BLE_LIMIT_DISC_FLAG)? "LE_LIMIT_DISC" : "",
                                  (p_adv_data->flag & BTM_BLE_GEN_DISC_FLAG)? "LE_GENERAL_DISC" : "",
@@ -2232,7 +2232,7 @@
 
             case BTM_BLE_AD_TYPE_TX_PWR:
                 p_adv_data->ad_mask |= BTM_BLE_AD_BIT_TX_PWR;
-                p_adv_data->tx_power_level = (INT8)*p_cur ++;
+                p_adv_data->tx_power_level = (int8_t)*p_cur ++;
                 BTM_TRACE_DEBUG("BTM_BLE_AD_TYPE_TX_PWR tx_level = %d", p_adv_data->tx_power_level);
                 break;
 
@@ -2283,11 +2283,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_cache_adv_data(tBTM_INQ_RESULTS *p_cur, UINT8 data_len, UINT8 *p, UINT8 evt_type)
+void btm_ble_cache_adv_data(tBTM_INQ_RESULTS *p_cur, uint8_t data_len, uint8_t *p, uint8_t evt_type)
 {
     tBTM_BLE_INQ_CB     *p_le_inq_cb = &btm_cb.ble_ctr_cb.inq_var;
-    UINT8 *p_cache;
-    UINT8 length;
+    uint8_t *p_cache;
+    uint8_t length;
     UNUSED(p_cur);
 
     /* cache adv report/scan response data */
@@ -2331,10 +2331,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-UINT8 btm_ble_is_discoverable(BD_ADDR bda, UINT8 evt_type, UINT8 *p)
+uint8_t btm_ble_is_discoverable(BD_ADDR bda, uint8_t evt_type, uint8_t *p)
 {
-    UINT8               *p_flag, flag = 0, rt = 0;
-    UINT8                data_len;
+    uint8_t             *p_flag, flag = 0, rt = 0;
+    uint8_t              data_len;
     tBTM_INQ_PARMS      *p_cond = &btm_cb.btm_inq_vars.inqparms;
     tBTM_BLE_INQ_CB     *p_le_inq_cb = &btm_cb.ble_ctr_cb.inq_var;
 
@@ -2381,7 +2381,7 @@
     return rt;
 }
 
-static void btm_ble_appearance_to_cod(UINT16 appearance, UINT8 *dev_class)
+static void btm_ble_appearance_to_cod(uint16_t appearance, uint8_t *dev_class)
 {
     dev_class[0] = 0;
 
@@ -2519,24 +2519,24 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN btm_ble_update_inq_result(tINQ_DB_ENT *p_i, UINT8 addr_type, UINT8 evt_type, UINT8 *p)
+bool    btm_ble_update_inq_result(tINQ_DB_ENT *p_i, uint8_t addr_type, uint8_t evt_type, uint8_t *p)
 {
-    BOOLEAN             to_report = TRUE;
+    bool                to_report = true;
     tBTM_INQ_RESULTS     *p_cur = &p_i->inq_info.results;
-    UINT8               len;
-    UINT8               *p_flag;
+    uint8_t             len;
+    uint8_t             *p_flag;
     tBTM_INQUIRY_VAR_ST  *p_inq = &btm_cb.btm_inq_vars;
-    UINT8                data_len, rssi;
+    uint8_t              data_len, rssi;
     tBTM_BLE_INQ_CB     *p_le_inq_cb = &btm_cb.ble_ctr_cb.inq_var;
-    UINT8 *p1;
-    UINT8               *p_uuid16;
+    uint8_t *p1;
+    uint8_t             *p_uuid16;
 
     STREAM_TO_UINT8    (data_len, p);
 
     if (data_len > BTM_BLE_ADV_DATA_LEN_MAX)
     {
         BTM_TRACE_WARNING("EIR data too long %d. discard", data_len);
-        return FALSE;
+        return false;
     }
     btm_ble_cache_adv_data(p_cur, data_len, p, evt_type);
 
@@ -2554,11 +2554,11 @@
     {
         BTM_TRACE_DEBUG("btm_ble_update_inq_result scan_rsp=false, to_report=false,\
                               scan_type_active=%d", btm_cb.ble_ctr_cb.inq_var.scan_type);
-        p_i->scan_rsp = FALSE;
-        to_report = FALSE;
+        p_i->scan_rsp = false;
+        to_report = false;
     }
     else
-        p_i->scan_rsp = TRUE;
+        p_i->scan_rsp = true;
 
     if (p_i->inq_count != p_inq->inq_counter)
         p_cur->device_type = BT_DEVICE_TYPE_BLE;
@@ -2585,14 +2585,14 @@
         p_uuid16 = BTM_CheckAdvData(p_le_inq_cb->adv_data_cache, BTM_BLE_AD_TYPE_APPEARANCE, &len);
         if (p_uuid16 && len == 2)
         {
-            btm_ble_appearance_to_cod((UINT16)p_uuid16[0] | (p_uuid16[1] << 8), p_cur->dev_class);
+            btm_ble_appearance_to_cod((uint16_t)p_uuid16[0] | (p_uuid16[1] << 8), p_cur->dev_class);
         }
         else
         {
             if ((p_uuid16 = BTM_CheckAdvData(p_le_inq_cb->adv_data_cache,
                                              BTM_BLE_AD_TYPE_16SRV_CMPL, &len)) != NULL)
             {
-                UINT8 i;
+                uint8_t i;
                 for (i = 0; i + 2 <= len; i = i + 2)
                 {
                     /* if this BLE device support HID over LE, set HID Major in class of device */
@@ -2641,7 +2641,7 @@
 *******************************************************************************/
 void btm_clear_all_pending_le_entry(void)
 {
-    UINT16       xx;
+    uint16_t     xx;
     tINQ_DB_ENT  *p_ent = btm_cb.btm_inq_vars.inq_db;
 
     for (xx = 0; xx < BTM_INQ_DB_SIZE; xx++, p_ent++)
@@ -2650,7 +2650,7 @@
         if ((p_ent->in_use) &&
             (p_ent->inq_info.results.device_type == BT_DEVICE_TYPE_BLE) &&
              !p_ent->scan_rsp)
-            p_ent->in_use = FALSE;
+            p_ent->in_use = false;
     }
 }
 
@@ -2665,10 +2665,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_send_sel_conn_callback(BD_ADDR remote_bda, UINT8 evt_type, UINT8 *p_data, UINT8 addr_type)
+void btm_send_sel_conn_callback(BD_ADDR remote_bda, uint8_t evt_type, uint8_t *p_data, uint8_t addr_type)
 {
-    UINT8   data_len, len;
-    UINT8   *p_dev_name, remname[31] = {0};
+    uint8_t data_len, len;
+    uint8_t *p_dev_name, remname[31] = {0};
     UNUSED(addr_type);
 
     if (btm_cb.ble_ctr_cb.p_select_cback == NULL ||
@@ -2710,15 +2710,15 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_process_adv_pkt (UINT8 *p_data)
+void btm_ble_process_adv_pkt (uint8_t *p_data)
 {
     BD_ADDR             bda;
-    UINT8               evt_type = 0, *p = p_data;
-    UINT8               addr_type = 0;
-    UINT8               num_reports;
-    UINT8               data_len;
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
-    BOOLEAN             match = FALSE;
+    uint8_t             evt_type = 0, *p = p_data;
+    uint8_t             addr_type = 0;
+    uint8_t             num_reports;
+    uint8_t             data_len;
+#if (BLE_PRIVACY_SPT == TRUE)
+    bool                match = false;
 #endif
 
     /* Only process the results if the inquiry is still active */
@@ -2735,9 +2735,9 @@
         STREAM_TO_UINT8    (addr_type, p);
         STREAM_TO_BDADDR   (bda, p);
 
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
         /* map address to security record */
-        match = btm_identity_addr_to_random_pseudo(bda, &addr_type, FALSE);
+        match = btm_identity_addr_to_random_pseudo(bda, &addr_type, false);
 
         BTM_TRACE_DEBUG("btm_ble_process_adv_pkt:bda= %0x:%0x:%0x:%0x:%0x:%0x",
                                      bda[0],bda[1],bda[2],bda[3],bda[4],bda[5]);
@@ -2769,15 +2769,15 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt_type, UINT8 *p)
+static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, uint8_t addr_type, uint8_t evt_type, uint8_t *p)
 {
     tINQ_DB_ENT          *p_i;
     tBTM_INQUIRY_VAR_ST  *p_inq = &btm_cb.btm_inq_vars;
     tBTM_INQ_RESULTS_CB  *p_inq_results_cb = p_inq->p_inq_results_cb;
     tBTM_INQ_RESULTS_CB  *p_obs_results_cb = btm_cb.ble_ctr_cb.p_obs_results_cb;
     tBTM_BLE_INQ_CB      *p_le_inq_cb = &btm_cb.ble_ctr_cb.inq_var;
-    BOOLEAN     update = TRUE;
-    UINT8       result = 0;
+    bool        update = true;
+    uint8_t     result = 0;
 
     p_i = btm_inq_db_find (bda);
 
@@ -2790,11 +2790,11 @@
               /* scan repsonse to be updated */
               (!p_i->scan_rsp)))
         {
-            update = TRUE;
+            update = true;
         }
         else if (BTM_BLE_IS_OBS_ACTIVE(btm_cb.ble_ctr_cb.scan_activity))
         {
-            update = FALSE;
+            update = false;
         }
         else
         {
@@ -2950,7 +2950,7 @@
     else if((p_ble_cb->inq_var.scan_interval != BTM_BLE_LOW_LATENCY_SCAN_INT) ||
             (p_ble_cb->inq_var.scan_window != BTM_BLE_LOW_LATENCY_SCAN_WIN))
     {
-        BTM_TRACE_DEBUG("%s: setting default params for ongoing observe", __FUNCTION__);
+        BTM_TRACE_DEBUG("%s: setting default params for ongoing observe", __func__);
         btm_ble_stop_scan();
         btm_ble_start_scan();
     }
@@ -2959,7 +2959,7 @@
     BTM_TRACE_DEBUG ("BTM Inq Compl Callback: status 0x%02x, num results %d",
                       p_inq->inq_cmpl_info.status, p_inq->inq_cmpl_info.num_resp);
 
-    btm_process_inq_complete(HCI_SUCCESS, (UINT8)(p_inq->inqparms.mode & BTM_BLE_INQUIRY_MASK));
+    btm_process_inq_complete(HCI_SUCCESS, (uint8_t)(p_inq->inqparms.mode & BTM_BLE_INQUIRY_MASK));
 }
 
 /*******************************************************************************
@@ -2995,13 +2995,13 @@
 **
 ** Description      Set or clear adv states in topology mask
 **
-** Returns          operation status. TRUE if sucessful, FALSE otherwise.
+** Returns          operation status. true if sucessful, false otherwise.
 **
 *******************************************************************************/
-typedef BOOLEAN (BTM_TOPOLOGY_FUNC_PTR)(tBTM_BLE_STATE_MASK);
-static BOOLEAN btm_ble_adv_states_operation(BTM_TOPOLOGY_FUNC_PTR *p_handler, UINT8 adv_evt)
+typedef bool    (BTM_TOPOLOGY_FUNC_PTR)(tBTM_BLE_STATE_MASK);
+static bool    btm_ble_adv_states_operation(BTM_TOPOLOGY_FUNC_PTR *p_handler, uint8_t adv_evt)
 {
-    BOOLEAN rt = FALSE;
+    bool    rt = false;
 
     switch (adv_evt)
     {
@@ -3049,7 +3049,7 @@
     if (!btm_ble_adv_states_operation (btm_ble_topology_check, p_cb->evt_type))
         return BTM_WRONG_MODE;
 
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
     /* To relax resolving list,  always have resolving list enabled, unless directed adv */
     if (p_cb->evt_type != BTM_BLE_CONNECT_LO_DUTY_DIR_EVT &&
         p_cb->evt_type != BTM_BLE_CONNECT_DIR_EVT)
@@ -3094,7 +3094,7 @@
     {
         if (btsnd_hcic_ble_set_adv_enable (BTM_BLE_ADV_DISABLE))
         {
-            p_cb->fast_adv_on = FALSE;
+            p_cb->fast_adv_on = false;
             p_cb->adv_mode = BTM_BLE_ADV_DISABLE;
             btm_cb.ble_ctr_cb.wl_state &= ~BTM_BLE_WL_ADV;
 
@@ -3193,11 +3193,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_read_remote_features_complete(UINT8 *p)
+void btm_ble_read_remote_features_complete(uint8_t *p)
 {
     tACL_CONN        *p_acl_cb = &btm_cb.acl_db[0];
-    UINT16            handle;
-    UINT8             status;
+    uint16_t          handle;
+    uint8_t           status;
     int               xx;
 
     BTM_TRACE_EVENT ("btm_ble_read_remote_features_complete ");
@@ -3233,7 +3233,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_write_adv_enable_complete(UINT8 * p)
+void btm_ble_write_adv_enable_complete(uint8_t * p)
 {
     tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
 
@@ -3259,7 +3259,7 @@
     btm_cb.ble_ctr_cb.inq_var.adv_mode = BTM_BLE_ADV_DISABLE;
 
     /* make device fall back into undirected adv mode by default */
-    btm_cb.ble_ctr_cb.inq_var.directed_conn = FALSE;
+    btm_cb.ble_ctr_cb.inq_var.directed_conn = false;
 }
 
 /*******************************************************************************
@@ -3268,14 +3268,14 @@
 **
 ** Description      set BLE topology mask
 **
-** Returns          TRUE is request is allowed, FALSE otherwise.
+** Returns          true is request is allowed, false otherwise.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state_mask)
+bool    btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state_mask)
 {
     request_state_mask &= BTM_BLE_STATE_ALL_MASK;
     btm_cb.ble_ctr_cb.cur_states |= (request_state_mask & BTM_BLE_STATE_ALL_MASK);
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -3284,14 +3284,14 @@
 **
 ** Description      Clear BLE topology bit mask
 **
-** Returns          TRUE is request is allowed, FALSE otherwise.
+** Returns          true is request is allowed, false otherwise.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_clear_topology_mask (tBTM_BLE_STATE_MASK request_state_mask)
+bool    btm_ble_clear_topology_mask (tBTM_BLE_STATE_MASK request_state_mask)
 {
     request_state_mask &= BTM_BLE_STATE_ALL_MASK;
     btm_cb.ble_ctr_cb.cur_states &= ~request_state_mask;
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -3303,7 +3303,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_update_link_topology_mask(UINT8 link_role, BOOLEAN increase)
+void btm_ble_update_link_topology_mask(uint8_t link_role, bool    increase)
 {
     btm_ble_clear_topology_mask (BTM_BLE_STATE_ALL_CONN_MASK);
 
@@ -3338,7 +3338,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, UINT8 status)
+void btm_ble_update_mode_operation(uint8_t link_role, BD_ADDR bd_addr, uint8_t status)
 {
     if (status == HCI_ERR_DIRECTED_ADVERTISING_TIMEOUT)
     {
@@ -3384,7 +3384,7 @@
     alarm_free(p_cb->inq_var.fast_adv_timer);
     memset(p_cb, 0, sizeof(tBTM_BLE_CB));
     memset(&(btm_cb.cmn_ble_vsc_cb), 0 , sizeof(tBTM_BLE_VSC_CB));
-    btm_cb.cmn_ble_vsc_cb.values_read = FALSE;
+    btm_cb.cmn_ble_vsc_cb.values_read = false;
 
     p_cb->observer_timer = alarm_new("btm_ble.observer_timer");
     p_cb->cur_states       = 0;
@@ -3408,7 +3408,7 @@
     p_cb->addr_mgnt_cb.refresh_raddr_timer =
         alarm_new("btm_ble_addr.refresh_raddr_timer");
 
-#if BLE_VND_INCLUDED == FALSE
+#if (BLE_VND_INCLUDED == FALSE)
     btm_ble_adv_filter_init();
 #endif
 }
@@ -3420,17 +3420,17 @@
 ** Description      check to see requested state is supported. One state check at
 **                  a time is supported
 **
-** Returns          TRUE is request is allowed, FALSE otherwise.
+** Returns          true is request is allowed, false otherwise.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request_state_mask)
+bool    btm_ble_topology_check(tBTM_BLE_STATE_MASK request_state_mask)
 {
-    BOOLEAN rt = FALSE;
+    bool    rt = false;
 
-    UINT8   state_offset = 0;
-    UINT16  cur_states = btm_cb.ble_ctr_cb.cur_states;
-    UINT8   mask, offset;
-    UINT8   request_state = 0;
+    uint8_t state_offset = 0;
+    uint16_t cur_states = btm_cb.ble_ctr_cb.cur_states;
+    uint8_t mask, offset;
+    uint8_t request_state = 0;
 
     /* check only one bit is set and within valid range */
     if (request_state_mask == BTM_BLE_STATE_INVALID ||
@@ -3459,7 +3459,7 @@
         return rt;
     }
 
-    rt = TRUE;
+    rt = true;
     /* make sure currently active states are all supported in conjunction with the requested
        state. If the bit in table is not set, the combination is not supported */
     while (cur_states != 0)
@@ -3473,7 +3473,7 @@
             {
                 if (!BTM_LE_STATES_SUPPORTED(ble_supported_states, mask, offset))
                 {
-                    rt = FALSE;
+                    rt = false;
                     break;
                 }
             }
diff --git a/stack/btm/btm_ble_int.h b/stack/btm/btm_ble_int.h
index 30de44f..f63e00f 100644
--- a/stack/btm/btm_ble_int.h
+++ b/stack/btm/btm_ble_int.h
@@ -32,7 +32,7 @@
 #include "btm_ble_api.h"
 #include "btm_int.h"
 
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
 #include "smp_api.h"
 #endif
 
@@ -81,7 +81,7 @@
 #define BTM_BLE_SEC_REQ_ACT_ENCRYPT        1 /* encrypt the link using current key or key refresh */
 #define BTM_BLE_SEC_REQ_ACT_PAIR           2
 #define BTM_BLE_SEC_REQ_ACT_DISCARD        3 /* discard the sec request while encryption is started but not completed */
-typedef UINT8   tBTM_BLE_SEC_REQ_ACT;
+typedef uint8_t tBTM_BLE_SEC_REQ_ACT;
 
 #define BLE_STATIC_PRIVATE_MSB_MASK          0x3f
 #define BLE_RESOLVE_ADDR_MSB                 0x40   /*  most significant bit, bit7, bit6 is 01 to be resolvable random */
@@ -110,19 +110,19 @@
 
 typedef struct
 {
-    UINT16              data_mask;
-    UINT8               *p_flags;
-    UINT8               ad_data[BTM_BLE_AD_DATA_LEN];
-    UINT8               *p_pad;
+    uint16_t            data_mask;
+    uint8_t             *p_flags;
+    uint8_t             ad_data[BTM_BLE_AD_DATA_LEN];
+    uint8_t             *p_pad;
 }tBTM_BLE_LOCAL_ADV_DATA;
 
 typedef struct
 {
-    UINT32          inq_count;          /* Used for determining if a response has already been      */
+    uint32_t        inq_count;          /* Used for determining if a response has already been      */
                                         /* received for the current inquiry operation. (We do not   */
                                         /* want to flood the caller with multiple responses from    */
                                         /* the same device.                                         */
-    BOOLEAN         scan_rsp;
+    bool            scan_rsp;
     tBLE_BD_ADDR    le_bda;
 } tINQ_LE_BDADDR;
 
@@ -136,38 +136,38 @@
 
 typedef struct
 {
-    UINT16 discoverable_mode;
-    UINT16 connectable_mode;
-    UINT32 scan_window;
-    UINT32 scan_interval;
-    UINT8 scan_type; /* current scan type: active or passive */
-    UINT8 scan_duplicate_filter; /* duplicate filter enabled for scan */
-    UINT16 adv_interval_min;
-    UINT16 adv_interval_max;
+    uint16_t discoverable_mode;
+    uint16_t connectable_mode;
+    uint32_t scan_window;
+    uint32_t scan_interval;
+    uint8_t scan_type; /* current scan type: active or passive */
+    uint8_t scan_duplicate_filter; /* duplicate filter enabled for scan */
+    uint16_t adv_interval_min;
+    uint16_t adv_interval_max;
     tBTM_BLE_AFP afp; /* advertising filter policy */
     tBTM_BLE_SFP sfp; /* scanning filter policy */
 
     tBLE_ADDR_TYPE adv_addr_type;
-    UINT8 evt_type;
-    UINT8 adv_mode;
+    uint8_t evt_type;
+    uint8_t adv_mode;
     tBLE_BD_ADDR direct_bda;
     tBTM_BLE_EVT directed_conn;
-    BOOLEAN fast_adv_on;
+    bool    fast_adv_on;
     alarm_t *fast_adv_timer;
 
-    UINT8 adv_len;
-    UINT8 adv_data_cache[BTM_BLE_CACHE_ADV_DATA_MAX];
+    uint8_t adv_len;
+    uint8_t adv_data_cache[BTM_BLE_CACHE_ADV_DATA_MAX];
 
     /* inquiry BD addr database */
-    UINT8 num_bd_entries;
-    UINT8 max_bd_entries;
+    uint8_t num_bd_entries;
+    uint8_t max_bd_entries;
     tBTM_BLE_LOCAL_ADV_DATA adv_data;
     tBTM_BLE_ADV_CHNL_MAP adv_chnl_map;
 
     alarm_t *inquiry_timer;
-    BOOLEAN scan_rsp;
-    UINT8 state; /* Current state that the inquiry process is in */
-    INT8 tx_power;
+    bool    scan_rsp;
+    uint8_t state; /* Current state that the inquiry process is in */
+    int8_t tx_power;
 } tBTM_BLE_INQ_CB;
 
 
@@ -182,7 +182,7 @@
     tBLE_ADDR_TYPE              own_addr_type;         /* local device LE address type */
     BD_ADDR                     private_addr;
     BD_ADDR                     random_bda;
-    BOOLEAN                     busy;
+    bool                        busy;
     tBTM_BLE_ADDR_CBACK         *p_generate_cback;
     void                        *p;
     alarm_t                     *refresh_raddr_timer;
@@ -192,10 +192,10 @@
 
 typedef struct
 {
-    UINT16              min_conn_int;
-    UINT16              max_conn_int;
-    UINT16              slave_latency;
-    UINT16              supervision_tout;
+    uint16_t            min_conn_int;
+    uint16_t            max_conn_int;
+    uint16_t            slave_latency;
+    uint16_t            supervision_tout;
 
 }tBTM_LE_CONN_PRAMS;
 
@@ -203,9 +203,9 @@
 typedef struct
 {
     BD_ADDR     bd_addr;
-    UINT8       attr;
-    BOOLEAN     is_connected;
-    BOOLEAN     in_use;
+    uint8_t     attr;
+    bool        is_connected;
+    bool        in_use;
 }tBTM_LE_BG_CONN_DEV;
 
   /* white list using state as a bit mask */
@@ -213,21 +213,21 @@
 #define BTM_BLE_WL_INIT         1
 #define BTM_BLE_WL_SCAN         2
 #define BTM_BLE_WL_ADV          4
-typedef UINT8 tBTM_BLE_WL_STATE;
+typedef uint8_t tBTM_BLE_WL_STATE;
 
 /* resolving list using state as a bit mask */
 #define BTM_BLE_RL_IDLE         0
 #define BTM_BLE_RL_INIT         1
 #define BTM_BLE_RL_SCAN         2
 #define BTM_BLE_RL_ADV          4
-typedef UINT8 tBTM_BLE_RL_STATE;
+typedef uint8_t tBTM_BLE_RL_STATE;
 
 /* BLE connection state */
 #define BLE_CONN_IDLE    0
 #define BLE_DIR_CONN     1
 #define BLE_BG_CONN      2
 #define BLE_CONN_CANCEL  3
-typedef UINT8 tBTM_BLE_CONN_ST;
+typedef uint8_t tBTM_BLE_CONN_ST;
 
 typedef struct
 {
@@ -247,7 +247,7 @@
 #define BTM_BLE_STATE_ACTIVE_SCAN           9
 #define BTM_BLE_STATE_SCAN_ADV              10
 #define BTM_BLE_STATE_MAX                   11
-typedef UINT8 tBTM_BLE_STATE;
+typedef uint8_t tBTM_BLE_STATE;
 
 #define BTM_BLE_STATE_CONN_ADV_BIT          0x0001
 #define BTM_BLE_STATE_INIT_BIT              0x0002
@@ -259,7 +259,7 @@
 #define BTM_BLE_STATE_PASSIVE_SCAN_BIT      0x0080
 #define BTM_BLE_STATE_ACTIVE_SCAN_BIT       0x0100
 #define BTM_BLE_STATE_SCAN_ADV_BIT          0x0200
-typedef UINT16 tBTM_BLE_STATE_MASK;
+typedef uint16_t tBTM_BLE_STATE_MASK;
 
 #define BTM_BLE_STATE_ALL_MASK              0x03ff
 #define BTM_BLE_STATE_ALL_ADV_MASK          (BTM_BLE_STATE_CONN_ADV_BIT|BTM_BLE_STATE_LO_DUTY_DIR_ADV_BIT|BTM_BLE_STATE_HI_DUTY_DIR_ADV_BIT|BTM_BLE_STATE_SCAN_ADV_BIT)
@@ -273,17 +273,17 @@
 typedef struct
 {
     BD_ADDR         *resolve_q_random_pseudo;
-    UINT8           *resolve_q_action;
-    UINT8           q_next;
-    UINT8           q_pending;
+    uint8_t         *resolve_q_action;
+    uint8_t         q_next;
+    uint8_t         q_pending;
 } tBTM_BLE_RESOLVE_Q;
 
 typedef struct
 {
-    BOOLEAN     in_use;
-    BOOLEAN     to_add;
+    bool        in_use;
+    bool        to_add;
     BD_ADDR     bd_addr;
-    UINT8       attr;
+    uint8_t     attr;
 }tBTM_BLE_WL_OP;
 
 /* BLE privacy mode */
@@ -291,16 +291,16 @@
 #define BTM_PRIVACY_1_1     1              /* BLE privacy 1.1, do not support privacy 1.0 */
 #define BTM_PRIVACY_1_2     2              /* BLE privacy 1.2 */
 #define BTM_PRIVACY_MIXED   3              /* BLE privacy mixed mode, broadcom propietary mode */
-typedef UINT8 tBTM_PRIVACY_MODE;
+typedef uint8_t tBTM_PRIVACY_MODE;
 
 /* data length change event callback */
-typedef void (tBTM_DATA_LENGTH_CHANGE_CBACK) (UINT16 max_tx_length, UINT16 max_rx_length);
+typedef void (tBTM_DATA_LENGTH_CHANGE_CBACK) (uint16_t max_tx_length, uint16_t max_rx_length);
 
 /* Define BLE Device Management control structure
 */
 typedef struct
 {
-    UINT8 scan_activity;         /* LE scan activity mask */
+    uint8_t scan_activity;         /* LE scan activity mask */
 
     /*****************************************************
     **      BLE Inquiry
@@ -314,12 +314,12 @@
 
     /* background connection procedure cb value */
     tBTM_BLE_CONN_TYPE bg_conn_type;
-    UINT32 scan_int;
-    UINT32 scan_win;
+    uint32_t scan_int;
+    uint32_t scan_win;
     tBTM_BLE_SEL_CBACK *p_select_cback;
 
     /* white list information */
-    UINT8 white_list_avail_size;
+    uint8_t white_list_avail_size;
     tBTM_BLE_WL_STATE wl_state;
 
     fixed_queue_t *conn_pending_q;
@@ -328,15 +328,15 @@
     /* random address management control block */
     tBTM_LE_RANDOM_CB addr_mgnt_cb;
 
-    BOOLEAN enabled;
+    bool    enabled;
 
-#if BLE_PRIVACY_SPT == TRUE
-    BOOLEAN mixed_mode; /* privacy 1.2 mixed mode is on or not */
+#if (BLE_PRIVACY_SPT == TRUE)
+    bool    mixed_mode; /* privacy 1.2 mixed mode is on or not */
     tBTM_PRIVACY_MODE privacy_mode; /* privacy mode */
-    UINT8 resolving_list_avail_size; /* resolving list available size */
+    uint8_t resolving_list_avail_size; /* resolving list available size */
     tBTM_BLE_RESOLVE_Q resolving_list_pend_q; /* Resolving list queue */
     tBTM_BLE_RL_STATE suspended_rl_state; /* Suspended resolving list state */
-    UINT8 *irk_list_mask; /* IRK list availability mask, up to max entry bits */
+    uint8_t *irk_list_mask; /* IRK list availability mask, up to max entry bits */
     tBTM_BLE_RL_STATE rl_state; /* Resolving list state */
 #endif
 
@@ -344,93 +344,93 @@
 
     /* current BLE link state */
     tBTM_BLE_STATE_MASK cur_states; /* bit mask of tBTM_BLE_STATE */
-    UINT8 link_count[2]; /* total link count master and slave*/
+    uint8_t link_count[2]; /* total link count master and slave*/
 } tBTM_BLE_CB;
 
 extern void btm_ble_adv_raddr_timer_timeout(void *data);
 extern void btm_ble_refresh_raddr_timer_timeout(void *data);
-extern void btm_ble_process_adv_pkt (UINT8 *p);
-extern void btm_ble_proc_scan_rsp_rpt (UINT8 *p);
+extern void btm_ble_process_adv_pkt (uint8_t *p);
+extern void btm_ble_proc_scan_rsp_rpt (uint8_t *p);
 extern tBTM_STATUS btm_ble_read_remote_name(BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur, tBTM_CMPL_CB *p_cb);
-extern BOOLEAN btm_ble_cancel_remote_name(BD_ADDR remote_bda);
+extern bool    btm_ble_cancel_remote_name(BD_ADDR remote_bda);
 
-extern tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode);
-extern tBTM_STATUS btm_ble_set_connectability(UINT16 combined_mode);
-extern tBTM_STATUS btm_ble_start_inquiry (UINT8 mode, UINT8   duration);
+extern tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode);
+extern tBTM_STATUS btm_ble_set_connectability(uint16_t combined_mode);
+extern tBTM_STATUS btm_ble_start_inquiry (uint8_t mode, uint8_t duration);
 extern void btm_ble_stop_scan(void);
 extern void btm_clear_all_pending_le_entry(void);
 
 extern void btm_ble_stop_scan();
-extern BOOLEAN btm_ble_send_extended_scan_params(UINT8 scan_type, UINT32 scan_int,
-                                                 UINT32 scan_win, UINT8 addr_type_own,
-                                                 UINT8 scan_filter_policy);
+extern bool    btm_ble_send_extended_scan_params(uint8_t scan_type, uint32_t scan_int,
+                                                 uint32_t scan_win, uint8_t addr_type_own,
+                                                 uint8_t scan_filter_policy);
 extern void btm_ble_stop_inquiry(void);
 extern void btm_ble_init (void);
-extern void btm_ble_connected (UINT8 *bda, UINT16 handle, UINT8 enc_mode, UINT8 role, tBLE_ADDR_TYPE addr_type, BOOLEAN addr_matched);
-extern void btm_ble_read_remote_features_complete(UINT8 *p);
-extern void btm_ble_write_adv_enable_complete(UINT8 * p);
-extern void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced);
-extern void btm_read_ble_local_supported_states_complete(UINT8 *p, UINT16 evt_len);
+extern void btm_ble_connected (uint8_t *bda, uint16_t handle, uint8_t enc_mode, uint8_t role, tBLE_ADDR_TYPE addr_type, bool    addr_matched);
+extern void btm_ble_read_remote_features_complete(uint8_t *p);
+extern void btm_ble_write_adv_enable_complete(uint8_t * p);
+extern void btm_ble_conn_complete(uint8_t *p, uint16_t evt_len, bool    enhanced);
+extern void btm_read_ble_local_supported_states_complete(uint8_t *p, uint16_t evt_len);
 extern tBTM_BLE_CONN_ST btm_ble_get_conn_st(void);
 extern void btm_ble_set_conn_st(tBTM_BLE_CONN_ST new_st);
-extern UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst,
+extern uint8_t *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, uint8_t **p_dst,
                                      tBTM_BLE_ADV_DATA *p_data);
 extern tBTM_STATUS btm_ble_start_adv(void);
 extern tBTM_STATUS btm_ble_stop_adv(void);
 extern tBTM_STATUS btm_ble_start_scan(void);
-extern void btm_ble_create_ll_conn_complete (UINT8 status);
+extern void btm_ble_create_ll_conn_complete (uint8_t status);
 
 /* LE security function from btm_sec.c */
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
 extern void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE_SEC_REQ_ACT *p_sec_req_act);
-extern void btm_ble_ltk_request_reply(BD_ADDR bda,  BOOLEAN use_stk, BT_OCTET16 stk);
-extern UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data);
-extern tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, tBTM_BLE_SEC_ACT sec_act, UINT8 link_role);
-extern void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv);
-extern tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk);
-extern void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable);
+extern void btm_ble_ltk_request_reply(BD_ADDR bda,  bool    use_stk, BT_OCTET16 stk);
+extern uint8_t btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data);
+extern tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, tBTM_BLE_SEC_ACT sec_act, uint8_t link_role);
+extern void btm_ble_ltk_request(uint16_t handle, uint8_t rand[8], uint16_t ediv);
+extern tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, bool    use_stk, BT_OCTET16 stk);
+extern void btm_ble_link_encrypted(BD_ADDR bd_addr, uint8_t encr_enable);
 #endif
 
 /* LE device management functions */
 extern void btm_ble_reset_id( void );
 
 /* security related functions */
-extern void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local );
-extern BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div);
-extern BOOLEAN btm_ble_get_enc_key_type(BD_ADDR bd_addr, UINT8 *p_key_types);
+extern void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, bool    is_local );
+extern bool    btm_get_local_div (BD_ADDR bd_addr, uint16_t *p_div);
+extern bool    btm_ble_get_enc_key_type(BD_ADDR bd_addr, uint8_t *p_key_types);
 
-extern void btm_ble_test_command_complete(UINT8 *p);
-extern void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_enc_cplt_cback);
+extern void btm_ble_test_command_complete(uint8_t *p);
+extern void btm_ble_rand_enc_complete (uint8_t *p, uint16_t op_code, tBTM_RAND_ENC_CB *p_enc_cplt_cback);
 
-extern void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY_VALUE *p_keys, BOOLEAN pass_to_application);
-extern void btm_ble_update_sec_key_size(BD_ADDR bd_addr, UINT8 enc_key_size);
-extern UINT8 btm_ble_read_sec_key_size(BD_ADDR bd_addr);
+extern void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY_VALUE *p_keys, bool    pass_to_application);
+extern void btm_ble_update_sec_key_size(BD_ADDR bd_addr, uint8_t enc_key_size);
+extern uint8_t btm_ble_read_sec_key_size(BD_ADDR bd_addr);
 
 /* white list function */
-extern BOOLEAN btm_update_dev_to_white_list(BOOLEAN to_add, BD_ADDR bd_addr);
+extern bool    btm_update_dev_to_white_list(bool    to_add, BD_ADDR bd_addr);
 extern void btm_update_scanner_filter_policy(tBTM_BLE_SFP scan_policy);
 extern void btm_update_adv_filter_policy(tBTM_BLE_AFP adv_policy);
 extern void btm_ble_clear_white_list (void);
-extern void btm_read_white_list_size_complete(UINT8 *p, UINT16 evt_len);
-extern void btm_ble_add_2_white_list_complete(UINT8 status);
-extern void btm_ble_remove_from_white_list_complete(UINT8 *p, UINT16 evt_len);
-extern void btm_ble_clear_white_list_complete(UINT8 *p, UINT16 evt_len);
-extern void btm_ble_white_list_init(UINT8 white_list_size);
+extern void btm_read_white_list_size_complete(uint8_t *p, uint16_t evt_len);
+extern void btm_ble_add_2_white_list_complete(uint8_t status);
+extern void btm_ble_remove_from_white_list_complete(uint8_t *p, uint16_t evt_len);
+extern void btm_ble_clear_white_list_complete(uint8_t *p, uint16_t evt_len);
+extern void btm_ble_white_list_init(uint8_t white_list_size);
 
 /* background connection function */
-extern BOOLEAN btm_ble_suspend_bg_conn(void);
-extern BOOLEAN btm_ble_resume_bg_conn(void);
+extern bool    btm_ble_suspend_bg_conn(void);
+extern bool    btm_ble_resume_bg_conn(void);
 extern void btm_ble_initiate_select_conn(BD_ADDR bda);
-extern BOOLEAN btm_ble_start_auto_conn(BOOLEAN start);
-extern BOOLEAN btm_ble_start_select_conn(BOOLEAN start,tBTM_BLE_SEL_CBACK   *p_select_cback);
-extern BOOLEAN btm_ble_renew_bg_conn_params(BOOLEAN add, BD_ADDR bd_addr);
+extern bool    btm_ble_start_auto_conn(bool    start);
+extern bool    btm_ble_start_select_conn(bool    start,tBTM_BLE_SEL_CBACK   *p_select_cback);
+extern bool    btm_ble_renew_bg_conn_params(bool    add, BD_ADDR bd_addr);
 extern void btm_write_dir_conn_wl(BD_ADDR target_addr);
-extern void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bda, UINT8 status);
-extern BOOLEAN btm_execute_wl_dev_operation(void);
-extern void btm_ble_update_link_topology_mask(UINT8 role, BOOLEAN increase);
+extern void btm_ble_update_mode_operation(uint8_t link_role, BD_ADDR bda, uint8_t status);
+extern bool    btm_execute_wl_dev_operation(void);
+extern void btm_ble_update_link_topology_mask(uint8_t role, bool    increase);
 
 /* direct connection utility */
-extern BOOLEAN btm_send_pending_direct_conn(void);
+extern bool    btm_send_pending_direct_conn(void);
 extern void btm_ble_enqueue_direct_conn_req(void *p_param);
 
 /* BLE address management */
@@ -440,45 +440,45 @@
 extern void btm_gen_resolve_paddr_low(tBTM_RAND_ENC *p);
 
 /*  privacy function */
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
 /* BLE address mapping with CS feature */
-extern BOOLEAN btm_identity_addr_to_random_pseudo(BD_ADDR bd_addr, UINT8 *p_addr_type, BOOLEAN refresh);
-extern BOOLEAN btm_random_pseudo_to_identity_addr(BD_ADDR random_pseudo, UINT8 *p_static_addr_type);
-extern void btm_ble_refresh_peer_resolvable_private_addr(BD_ADDR pseudo_bda, BD_ADDR rra, UINT8 rra_type);
+extern bool    btm_identity_addr_to_random_pseudo(BD_ADDR bd_addr, uint8_t *p_addr_type, bool    refresh);
+extern bool    btm_random_pseudo_to_identity_addr(BD_ADDR random_pseudo, uint8_t *p_static_addr_type);
+extern void btm_ble_refresh_peer_resolvable_private_addr(BD_ADDR pseudo_bda, BD_ADDR rra, uint8_t rra_type);
 extern void btm_ble_refresh_local_resolvable_private_addr(BD_ADDR pseudo_addr, BD_ADDR local_rpa);
-extern void btm_ble_read_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len) ;
-extern void btm_ble_remove_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len);
-extern void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len);
-extern void btm_ble_clear_resolving_list_complete(UINT8 *p, UINT16 evt_len);
-extern void btm_read_ble_resolving_list_size_complete (UINT8 *p, UINT16 evt_len);
-extern void btm_ble_enable_resolving_list(UINT8);
-extern BOOLEAN btm_ble_disable_resolving_list(UINT8 rl_mask, BOOLEAN to_resume);
-extern void btm_ble_enable_resolving_list_for_platform (UINT8 rl_mask);
-extern void btm_ble_resolving_list_init(UINT8 max_irk_list_sz);
+extern void btm_ble_read_resolving_list_entry_complete(uint8_t *p, uint16_t evt_len) ;
+extern void btm_ble_remove_resolving_list_entry_complete(uint8_t *p, uint16_t evt_len);
+extern void btm_ble_add_resolving_list_entry_complete(uint8_t *p, uint16_t evt_len);
+extern void btm_ble_clear_resolving_list_complete(uint8_t *p, uint16_t evt_len);
+extern void btm_read_ble_resolving_list_size_complete (uint8_t *p, uint16_t evt_len);
+extern void btm_ble_enable_resolving_list(uint8_t);
+extern bool    btm_ble_disable_resolving_list(uint8_t rl_mask, bool    to_resume);
+extern void btm_ble_enable_resolving_list_for_platform (uint8_t rl_mask);
+extern void btm_ble_resolving_list_init(uint8_t max_irk_list_sz);
 extern void btm_ble_resolving_list_cleanup(void);
 #endif
 
 extern void btm_ble_multi_adv_configure_rpa (tBTM_BLE_MULTI_ADV_INST *p_inst);
 extern void btm_ble_multi_adv_init(void);
-extern void* btm_ble_multi_adv_get_ref(UINT8 inst_id);
+extern void* btm_ble_multi_adv_get_ref(uint8_t inst_id);
 extern void btm_ble_multi_adv_cleanup(void);
-extern void btm_ble_multi_adv_reenable(UINT8 inst_id);
-extern void btm_ble_multi_adv_enb_privacy(BOOLEAN enable);
+extern void btm_ble_multi_adv_reenable(uint8_t inst_id);
+extern void btm_ble_multi_adv_enb_privacy(bool    enable);
 extern char btm_ble_map_adv_tx_power(int tx_power_index);
 extern void btm_ble_batchscan_init(void);
 extern void btm_ble_batchscan_cleanup(void);
 extern void btm_ble_adv_filter_init(void);
 extern void btm_ble_adv_filter_cleanup(void);
-extern BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request);
-extern BOOLEAN btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state);
-extern BOOLEAN btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state);
+extern bool    btm_ble_topology_check(tBTM_BLE_STATE_MASK request);
+extern bool    btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state);
+extern bool    btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state);
 
-#if BTM_BLE_CONFORMANCE_TESTING == TRUE
-extern void btm_ble_set_no_disc_if_pair_fail (BOOLEAN disble_disc);
-extern void btm_ble_set_test_mac_value (BOOLEAN enable, UINT8 *p_test_mac_val);
-extern void btm_ble_set_test_local_sign_cntr_value(BOOLEAN enable, UINT32 test_local_sign_cntr);
+#if (BTM_BLE_CONFORMANCE_TESTING == TRUE)
+extern void btm_ble_set_no_disc_if_pair_fail (bool    disble_disc);
+extern void btm_ble_set_test_mac_value (bool    enable, uint8_t *p_test_mac_val);
+extern void btm_ble_set_test_local_sign_cntr_value(bool    enable, uint32_t test_local_sign_cntr);
 extern void btm_set_random_address(BD_ADDR random_bda);
-extern void btm_ble_set_keep_rfu_in_auth_req(BOOLEAN keep_rfu);
+extern void btm_ble_set_keep_rfu_in_auth_req(bool    keep_rfu);
 #endif
 
 
diff --git a/stack/btm/btm_ble_multi_adv.c b/stack/btm/btm_ble_multi_adv.c
index 5efe752..50336be 100644
--- a/stack/btm/btm_ble_multi_adv.c
+++ b/stack/btm/btm_ble_multi_adv.c
@@ -52,8 +52,8 @@
 **  Externs
 ************************************************************************************/
 extern fixed_queue_t *btu_general_alarm_queue;
-extern void btm_ble_update_dmt_flag_bits(UINT8 *flag_value,
-                                               const UINT16 connect_mode, const UINT16 disc_mode);
+extern void btm_ble_update_dmt_flag_bits(uint8_t *flag_value,
+                                               const uint16_t connect_mode, const uint16_t disc_mode);
 
 /*******************************************************************************
 **
@@ -65,7 +65,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_multi_adv_enq_op_q(UINT8 opcode, UINT8 inst_id, UINT8 cb_evt)
+void btm_ble_multi_adv_enq_op_q(uint8_t opcode, uint8_t inst_id, uint8_t cb_evt)
 {
     tBTM_BLE_MULTI_ADV_OPQ  *p_op_q = &btm_multi_adv_cb.op_q;
 
@@ -86,7 +86,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_multi_adv_deq_op_q(UINT8 *p_opcode, UINT8 *p_inst_id, UINT8 *p_cb_evt)
+void btm_ble_multi_adv_deq_op_q(uint8_t *p_opcode, uint8_t *p_inst_id, uint8_t *p_cb_evt)
 {
     tBTM_BLE_MULTI_ADV_OPQ  *p_op_q = &btm_multi_adv_cb.op_q;
 
@@ -110,11 +110,11 @@
 *******************************************************************************/
 void btm_ble_multi_adv_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params)
 {
-    UINT8  status, subcode;
-    UINT8  *p = p_params->p_param_buf, inst_id;
-    UINT16  len = p_params->param_len;
+    uint8_t status, subcode;
+    uint8_t *p = p_params->p_param_buf, inst_id;
+    uint16_t len = p_params->param_len;
     tBTM_BLE_MULTI_ADV_INST *p_inst ;
-    UINT8   cb_evt = 0, opcode;
+    uint8_t cb_evt = 0, opcode;
 
     if (len  < 2)
     {
@@ -145,7 +145,7 @@
 
             /* Mark as not in use here, if instance cannot be enabled */
             if (HCI_SUCCESS != status && BTM_BLE_MULTI_ADV_ENB_EVT == cb_evt)
-                btm_multi_adv_cb.p_adv_inst[inst_id-1].in_use = FALSE;
+                btm_multi_adv_cb.p_adv_inst[inst_id-1].in_use = false;
             break;
         }
 
@@ -196,10 +196,10 @@
 ** Returns          status
 **
 *******************************************************************************/
-tBTM_STATUS btm_ble_enable_multi_adv (BOOLEAN enable, UINT8 inst_id, UINT8 cb_evt)
+tBTM_STATUS btm_ble_enable_multi_adv (bool    enable, uint8_t inst_id, uint8_t cb_evt)
 {
-    UINT8           param[BTM_BLE_MULTI_ADV_ENB_LEN], *pp;
-    UINT8           enb = enable ? 1: 0;
+    uint8_t         param[BTM_BLE_MULTI_ADV_ENB_LEN], *pp;
+    uint8_t         enb = enable ? 1: 0;
     tBTM_STATUS     rt;
 
     pp = param;
@@ -252,9 +252,9 @@
 *******************************************************************************/
 tBTM_STATUS btm_ble_multi_adv_set_params (tBTM_BLE_MULTI_ADV_INST *p_inst,
                                           tBTM_BLE_ADV_PARAMS *p_params,
-                                          UINT8 cb_evt)
+                                          uint8_t cb_evt)
 {
-    UINT8           param[BTM_BLE_MULTI_ADV_SET_PARAM_LEN], *pp;
+    uint8_t         param[BTM_BLE_MULTI_ADV_SET_PARAM_LEN], *pp;
     tBTM_STATUS     rt;
     BD_ADDR         dummy ={0,0,0,0,0,0};
 
@@ -267,7 +267,7 @@
     UINT16_TO_STREAM (pp, p_params->adv_int_max);
     UINT8_TO_STREAM  (pp, p_params->adv_type);
 
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
     if (btm_cb.ble_ctr_cb.privacy_mode != BTM_PRIVACY_NONE)
     {
         UINT8_TO_STREAM  (pp, BLE_ADDR_RANDOM);
@@ -311,7 +311,7 @@
     {
         p_inst->adv_evt = p_params->adv_type;
 
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
         if (btm_cb.ble_ctr_cb.privacy_mode != BTM_PRIVACY_NONE) {
             alarm_set_on_queue(p_inst->adv_raddr_timer,
                                BTM_BLE_PRIVATE_ADDR_INT_MS,
@@ -338,11 +338,11 @@
 *******************************************************************************/
 tBTM_STATUS btm_ble_multi_adv_write_rpa (tBTM_BLE_MULTI_ADV_INST *p_inst, BD_ADDR random_addr)
 {
-    UINT8           param[BTM_BLE_MULTI_ADV_SET_RANDOM_ADDR_LEN], *pp = param;
+    uint8_t         param[BTM_BLE_MULTI_ADV_SET_RANDOM_ADDR_LEN], *pp = param;
     tBTM_STATUS     rt;
 
     BTM_TRACE_EVENT ("%s-BD_ADDR:%02x-%02x-%02x-%02x-%02x-%02x,inst_id:%d",
-                      __FUNCTION__, random_addr[5], random_addr[4], random_addr[3], random_addr[2],
+                      __func__, random_addr[5], random_addr[4], random_addr[3], random_addr[2],
                       random_addr[1], random_addr[0], p_inst->inst_id);
 
     memset(param, 0, BTM_BLE_MULTI_ADV_SET_RANDOM_ADDR_LEN);
@@ -382,13 +382,13 @@
 {
 #if (SMP_INCLUDED == TRUE)
     tSMP_ENC    output;
-    UINT8 index = 0;
+    uint8_t index = 0;
     tBTM_BLE_MULTI_ADV_INST *p_inst = NULL;
 
      /* Retrieve the index of adv instance from stored Q */
     if (btm_multi_adv_idx_q.front == -1)
     {
-        BTM_TRACE_ERROR(" %s can't locate advertise instance", __FUNCTION__);
+        BTM_TRACE_ERROR(" %s can't locate advertise instance", __func__);
         return;
     }
     else
@@ -484,19 +484,19 @@
 ** Returns          none.
 **
 *******************************************************************************/
-void btm_ble_multi_adv_reenable(UINT8 inst_id)
+void btm_ble_multi_adv_reenable(uint8_t inst_id)
 {
     tBTM_BLE_MULTI_ADV_INST *p_inst = &btm_multi_adv_cb.p_adv_inst[inst_id - 1];
 
-    if (TRUE == p_inst->in_use)
+    if (true == p_inst->in_use)
     {
         if (p_inst->adv_evt != BTM_BLE_CONNECT_DIR_EVT)
-            btm_ble_enable_multi_adv (TRUE, p_inst->inst_id, 0);
+            btm_ble_enable_multi_adv (true, p_inst->inst_id, 0);
         else
           /* mark directed adv as disabled if adv has been stopped */
         {
             (p_inst->p_cback)(BTM_BLE_MULTI_ADV_DISABLE_EVT,p_inst->inst_id,p_inst->p_ref,0);
-             p_inst->in_use = FALSE;
+             p_inst->in_use = false;
         }
      }
 }
@@ -512,14 +512,14 @@
 ** Returns          none.
 **
 *******************************************************************************/
-void btm_ble_multi_adv_enb_privacy(BOOLEAN enable)
+void btm_ble_multi_adv_enb_privacy(bool    enable)
 {
-    UINT8 i;
+    uint8_t i;
     tBTM_BLE_MULTI_ADV_INST *p_inst = &btm_multi_adv_cb.p_adv_inst[0];
 
     for (i = 0; i <  BTM_BleMaxMultiAdvInstanceCount() - 1; i ++, p_inst++)
     {
-        p_inst->in_use = FALSE;
+        p_inst->in_use = false;
         if (enable)
             btm_ble_multi_adv_configure_rpa(p_inst);
         else
@@ -545,7 +545,7 @@
 tBTM_STATUS BTM_BleEnableAdvInstance (tBTM_BLE_ADV_PARAMS *p_params,
                                       tBTM_BLE_MULTI_ADV_CBACK *p_cback,void *p_ref)
 {
-    UINT8 i;
+    uint8_t i;
     tBTM_STATUS rt = BTM_NO_RESOURCES;
     tBTM_BLE_MULTI_ADV_INST *p_inst = &btm_multi_adv_cb.p_adv_inst[0];
 
@@ -565,9 +565,9 @@
 
     for (i = 0; i <  BTM_BleMaxMultiAdvInstanceCount() - 1; i ++, p_inst++)
     {
-        if (FALSE == p_inst->in_use)
+        if (false == p_inst->in_use)
         {
-            p_inst->in_use = TRUE;
+            p_inst->in_use = true;
             /* configure adv parameter */
             if (p_params)
                 rt = btm_ble_multi_adv_set_params(p_inst, p_params, 0);
@@ -580,7 +580,7 @@
 
             if (BTM_CMD_STARTED == rt)
             {
-                if ((rt = btm_ble_enable_multi_adv (TRUE, p_inst->inst_id,
+                if ((rt = btm_ble_enable_multi_adv (true, p_inst->inst_id,
                           BTM_BLE_MULTI_ADV_ENB_EVT)) == BTM_CMD_STARTED)
                 {
                     p_inst->p_cback = p_cback;
@@ -590,7 +590,7 @@
 
             if (BTM_CMD_STARTED != rt)
             {
-                p_inst->in_use = FALSE;
+                p_inst->in_use = false;
                 BTM_TRACE_ERROR("BTM_BleEnableAdvInstance failed");
             }
             break;
@@ -612,7 +612,7 @@
 ** Returns          status
 **
 *******************************************************************************/
-tBTM_STATUS BTM_BleUpdateAdvInstParam (UINT8 inst_id, tBTM_BLE_ADV_PARAMS *p_params)
+tBTM_STATUS BTM_BleUpdateAdvInstParam (uint8_t inst_id, tBTM_BLE_ADV_PARAMS *p_params)
 {
     tBTM_STATUS rt = BTM_ILLEGAL_VALUE;
     tBTM_BLE_MULTI_ADV_INST *p_inst = &btm_multi_adv_cb.p_adv_inst[inst_id - 1];
@@ -629,16 +629,16 @@
         inst_id != BTM_BLE_MULTI_ADV_DEFAULT_STD &&
         p_params != NULL)
     {
-        if (FALSE == p_inst->in_use)
+        if (false == p_inst->in_use)
         {
             BTM_TRACE_DEBUG("adv instance %d is not active", inst_id);
             return BTM_WRONG_MODE;
         }
         else
-            btm_ble_enable_multi_adv(FALSE, inst_id, 0);
+            btm_ble_enable_multi_adv(false, inst_id, 0);
 
         if (BTM_CMD_STARTED == btm_ble_multi_adv_set_params(p_inst, p_params, 0))
-            rt = btm_ble_enable_multi_adv(TRUE, inst_id, BTM_BLE_MULTI_ADV_PARAM_EVT);
+            rt = btm_ble_enable_multi_adv(true, inst_id, BTM_BLE_MULTI_ADV_PARAM_EVT);
     }
     return rt;
 }
@@ -658,16 +658,16 @@
 ** Returns          status
 **
 *******************************************************************************/
-tBTM_STATUS BTM_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
+tBTM_STATUS BTM_BleCfgAdvInstData (uint8_t inst_id, bool    is_scan_rsp,
                                     tBTM_BLE_AD_MASK data_mask,
                                     tBTM_BLE_ADV_DATA *p_data)
 {
-    UINT8       param[BTM_BLE_MULTI_ADV_WRITE_DATA_LEN], *pp = param;
-    UINT8       sub_code = (is_scan_rsp) ?
+    uint8_t     param[BTM_BLE_MULTI_ADV_WRITE_DATA_LEN], *pp = param;
+    uint8_t     sub_code = (is_scan_rsp) ?
                            BTM_BLE_MULTI_ADV_WRITE_SCAN_RSP_DATA : BTM_BLE_MULTI_ADV_WRITE_ADV_DATA;
-    UINT8       *p_len;
+    uint8_t     *p_len;
     tBTM_STATUS rt;
-    UINT8 *pp_temp = (UINT8*)(param + BTM_BLE_MULTI_ADV_WRITE_DATA_LEN -1);
+    uint8_t *pp_temp = (uint8_t*)(param + BTM_BLE_MULTI_ADV_WRITE_DATA_LEN -1);
     tBTM_BLE_VSC_CB cmn_ble_vsc_cb;
 
     BTM_BleGetVendorCapabilities(&cmn_ble_vsc_cb);
@@ -689,11 +689,11 @@
     UINT8_TO_STREAM(pp, sub_code);
     p_len = pp ++;
     btm_ble_build_adv_data(&data_mask, &pp, p_data);
-    *p_len = (UINT8)(pp - param - 2);
+    *p_len = (uint8_t)(pp - param - 2);
     UINT8_TO_STREAM(pp_temp, inst_id);
 
     if ((rt = BTM_VendorSpecificCommand (HCI_BLE_MULTI_ADV_OCF,
-                                    (UINT8)BTM_BLE_MULTI_ADV_WRITE_DATA_LEN,
+                                    (uint8_t)BTM_BLE_MULTI_ADV_WRITE_DATA_LEN,
                                     param,
                                     btm_ble_multi_adv_vsc_cmpl_cback))
                                      == BTM_CMD_STARTED)
@@ -714,7 +714,7 @@
 ** Returns          status
 **
 *******************************************************************************/
-tBTM_STATUS BTM_BleDisableAdvInstance (UINT8 inst_id)
+tBTM_STATUS BTM_BleDisableAdvInstance (uint8_t inst_id)
 {
      tBTM_STATUS rt = BTM_ILLEGAL_VALUE;
      tBTM_BLE_VSC_CB cmn_ble_vsc_cb;
@@ -732,12 +732,12 @@
      if (inst_id < BTM_BleMaxMultiAdvInstanceCount() &&
          inst_id != BTM_BLE_MULTI_ADV_DEFAULT_STD)
      {
-         if ((rt = btm_ble_enable_multi_adv(FALSE, inst_id, BTM_BLE_MULTI_ADV_DISABLE_EVT))
+         if ((rt = btm_ble_enable_multi_adv(false, inst_id, BTM_BLE_MULTI_ADV_DISABLE_EVT))
             == BTM_CMD_STARTED)
          {
             btm_ble_multi_adv_configure_rpa(&btm_multi_adv_cb.p_adv_inst[inst_id - 1]);
             alarm_cancel(btm_multi_adv_cb.p_adv_inst[inst_id - 1].adv_raddr_timer);
-            btm_multi_adv_cb.p_adv_inst[inst_id - 1].in_use = FALSE;
+            btm_multi_adv_cb.p_adv_inst[inst_id - 1].in_use = false;
          }
      }
     return rt;
@@ -751,11 +751,11 @@
 ** Returns
 **
 *******************************************************************************/
-void btm_ble_multi_adv_vse_cback(UINT8 len, UINT8 *p)
+void btm_ble_multi_adv_vse_cback(uint8_t len, uint8_t *p)
 {
-    UINT8   sub_event;
-    UINT8   adv_inst, idx;
-    UINT16  conn_handle;
+    uint8_t sub_event;
+    uint8_t adv_inst, idx;
+    uint16_t conn_handle;
 
     /* Check if this is a BLE RSSI vendor specific event */
     STREAM_TO_UINT8(sub_event, p);
@@ -770,7 +770,7 @@
 
         if ((idx = btm_handle_to_acl_index(conn_handle)) != MAX_L2CAP_LINKS)
         {
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
             if (btm_cb.ble_ctr_cb.privacy_mode != BTM_PRIVACY_NONE &&
                 adv_inst <= BTM_BLE_MULTI_ADV_MAX && adv_inst !=  BTM_BLE_MULTI_ADV_DEFAULT_STD)
             {
@@ -811,7 +811,7 @@
 *******************************************************************************/
 void btm_ble_multi_adv_init()
 {
-    UINT8 i = 0;
+    uint8_t i = 0;
     memset(&btm_multi_adv_cb, 0, sizeof(tBTM_BLE_MULTI_ADV_CB));
     memset (&btm_multi_adv_idx_q,0, sizeof (tBTM_BLE_MULTI_ADV_INST_IDX_Q));
     btm_multi_adv_idx_q.front = -1;
@@ -821,10 +821,10 @@
         btm_multi_adv_cb.p_adv_inst = osi_calloc(sizeof(tBTM_BLE_MULTI_ADV_INST) *
                                                  (btm_cb.cmn_ble_vsc_cb.adv_inst_max));
 
-        btm_multi_adv_cb.op_q.p_sub_code = osi_calloc(sizeof(UINT8) *
+        btm_multi_adv_cb.op_q.p_sub_code = osi_calloc(sizeof(uint8_t) *
                                                       (btm_cb.cmn_ble_vsc_cb.adv_inst_max));
 
-        btm_multi_adv_cb.op_q.p_inst_id = osi_calloc(sizeof(UINT8) *
+        btm_multi_adv_cb.op_q.p_inst_id = osi_calloc(sizeof(uint8_t) *
                                                      (btm_cb.cmn_ble_vsc_cb.adv_inst_max));
     }
 
@@ -836,7 +836,7 @@
             alarm_new("btm_ble.adv_raddr_timer");
     }
 
-    BTM_RegisterForVSEvents(btm_ble_multi_adv_vse_cback, TRUE);
+    BTM_RegisterForVSEvents(btm_ble_multi_adv_vse_cback, true);
 }
 
 /*******************************************************************************
@@ -873,7 +873,7 @@
 ** Returns          void*
 **
 *******************************************************************************/
-void* btm_ble_multi_adv_get_ref(UINT8 inst_id)
+void* btm_ble_multi_adv_get_ref(uint8_t inst_id)
 {
     tBTM_BLE_MULTI_ADV_INST *p_inst = NULL;
 
diff --git a/stack/btm/btm_ble_privacy.c b/stack/btm/btm_ble_privacy.c
index c8fe541..4d900a8 100644
--- a/stack/btm/btm_ble_privacy.c
+++ b/stack/btm/btm_ble_privacy.c
@@ -57,12 +57,12 @@
 ** Description      add target address into resolving pending operation queue
 **
 ** Parameters       target_bda: target device address
-**                  add_entry: TRUE for add entry, FALSE for remove entry
+**                  add_entry: true for add entry, false for remove entry
 **
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_enq_resolving_list_pending(BD_ADDR pseudo_bda, UINT8 op_code)
+void btm_ble_enq_resolving_list_pending(BD_ADDR pseudo_bda, uint8_t op_code)
 {
     tBTM_BLE_RESOLVE_Q *p_q = &btm_cb.ble_ctr_cb.resolving_list_pend_q;
 
@@ -78,26 +78,26 @@
 **
 ** Description      check to see if the action is in pending list
 **
-** Parameters       TRUE: action pending;
-**                  FALSE: new action
+** Parameters       true: action pending;
+**                  false: new action
 **
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN btm_ble_brcm_find_resolving_pending_entry(BD_ADDR pseudo_addr, UINT8 action)
+bool    btm_ble_brcm_find_resolving_pending_entry(BD_ADDR pseudo_addr, uint8_t action)
 {
     tBTM_BLE_RESOLVE_Q *p_q = &btm_cb.ble_ctr_cb.resolving_list_pend_q;
 
-    for (UINT8 i = p_q->q_pending; i != p_q->q_next;)
+    for (uint8_t i = p_q->q_pending; i != p_q->q_next;)
     {
         if (memcmp(p_q->resolve_q_random_pseudo[i], pseudo_addr, BD_ADDR_LEN) == 0 &&
             action == p_q->resolve_q_action[i])
-            return TRUE;
+            return true;
 
         i ++;
         i %= controller_get_interface()->get_ble_resolving_list_max_size();
     }
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -111,7 +111,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN btm_ble_deq_resolving_pending(BD_ADDR pseudo_addr)
+bool    btm_ble_deq_resolving_pending(BD_ADDR pseudo_addr)
 {
     tBTM_BLE_RESOLVE_Q *p_q = &btm_cb.ble_ctr_cb.resolving_list_pend_q;
 
@@ -121,10 +121,10 @@
         memset(p_q->resolve_q_random_pseudo[p_q->q_pending], 0, BD_ADDR_LEN);
         p_q->q_pending ++;
         p_q->q_pending %= controller_get_interface()->get_ble_resolving_list_max_size();
-        return TRUE;
+        return true;
     }
 
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -136,10 +136,10 @@
 ** Returns          none
 **
 *******************************************************************************/
-void btm_ble_clear_irk_index(UINT8 index)
+void btm_ble_clear_irk_index(uint8_t index)
 {
-    UINT8 byte;
-    UINT8 bit;
+    uint8_t byte;
+    uint8_t bit;
 
     if (index < controller_get_interface()->get_ble_resolving_list_max_size())
     {
@@ -158,11 +158,11 @@
 ** Returns          index from 0 ~ max (127 default)
 **
 *******************************************************************************/
-UINT8 btm_ble_find_irk_index(void)
+uint8_t btm_ble_find_irk_index(void)
 {
-    UINT8 i = 0;
-    UINT8 byte;
-    UINT8 bit;
+    uint8_t i = 0;
+    uint8_t byte;
+    uint8_t bit;
 
     while (i < controller_get_interface()->get_ble_resolving_list_max_size())
     {
@@ -190,7 +190,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_update_resolving_list(BD_ADDR pseudo_bda, BOOLEAN add)
+void btm_ble_update_resolving_list(BD_ADDR pseudo_bda, bool    add)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(pseudo_bda);
     if (p_dev_rec == NULL)
@@ -231,9 +231,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_clear_resolving_list_complete(UINT8 *p, UINT16 evt_len)
+void btm_ble_clear_resolving_list_complete(uint8_t *p, uint16_t evt_len)
 {
-    UINT8 status = 0;
+    uint8_t status = 0;
     STREAM_TO_UINT8(status, p);
 
     BTM_TRACE_DEBUG("%s status=%d", __func__, status);
@@ -277,9 +277,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len)
+void btm_ble_add_resolving_list_entry_complete(uint8_t *p, uint16_t evt_len)
 {
-    UINT8 status;
+    uint8_t status;
     STREAM_TO_UINT8(status, p);
 
     BTM_TRACE_DEBUG("%s status = %d", __func__, status);
@@ -320,10 +320,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_remove_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len)
+void btm_ble_remove_resolving_list_entry_complete(uint8_t *p, uint16_t evt_len)
 {
     BD_ADDR pseudo_bda;
-    UINT8 status;
+    uint8_t status;
 
     STREAM_TO_UINT8(status, p);
 
@@ -358,9 +358,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_read_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len)
+void btm_ble_read_resolving_list_entry_complete(uint8_t *p, uint16_t evt_len)
 {
-    UINT8           status, rra_type = BTM_BLE_ADDR_PSEUDO;
+    uint8_t         status, rra_type = BTM_BLE_ADDR_PSEUDO;
     BD_ADDR         rra, pseudo_bda;
 
     STREAM_TO_UINT8  (status, p);
@@ -407,8 +407,8 @@
 *******************************************************************************/
 void btm_ble_resolving_list_vsc_op_cmpl (tBTM_VSC_CMPL *p_params)
 {
-    UINT8  *p = p_params->p_param_buf, op_subcode;
-    UINT16  evt_len = p_params->param_len;
+    uint8_t *p = p_params->p_param_buf, op_subcode;
+    uint16_t evt_len = p_params->param_len;
 
     op_subcode   = *(p + 1);
 
@@ -463,8 +463,8 @@
     }
     else
     {
-        UINT8 param[20]= {0};
-        UINT8 *p = param;
+        uint8_t param[20]= {0};
+        uint8_t *p = param;
 
         UINT8_TO_STREAM(p, BTM_BLE_META_REMOVE_IRK_ENTRY);
         UINT8_TO_STREAM(p, p_dev_rec->ble.static_addr_type);
@@ -504,8 +504,8 @@
     }
     else
     {
-        UINT8 param[20] = {0};
-        UINT8 *p = param;
+        uint8_t param[20] = {0};
+        uint8_t *p = param;
 
         UINT8_TO_STREAM(p, BTM_BLE_META_CLEAR_IRK_LIST);
         st = BTM_VendorSpecificCommand (HCI_VENDOR_BLE_RPA_VSC,
@@ -543,8 +543,8 @@
     }
     else
     {
-        UINT8 param[20] = {0};
-        UINT8 *p = param;
+        uint8_t param[20] = {0};
+        uint8_t *p = param;
 
         UINT8_TO_STREAM(p, BTM_BLE_META_READ_IRK_ENTRY);
         UINT8_TO_STREAM(p, p_dev_rec->ble.resolving_list_index);
@@ -573,10 +573,10 @@
 **
 ** Parameters
 **
-** Returns          TRUE if suspended; FALSE otherwise
+** Returns          true if suspended; false otherwise
 **
 *******************************************************************************/
-BOOLEAN btm_ble_suspend_resolving_list_activity(void)
+bool    btm_ble_suspend_resolving_list_activity(void)
 {
     tBTM_BLE_CB *p_ble_cb = &btm_cb.ble_ctr_cb;
 
@@ -584,13 +584,13 @@
     /* if asking for stop all activity */
     /* if already suspended */
     if (p_ble_cb->suspended_rl_state != BTM_BLE_RL_IDLE)
-        return TRUE;
+        return true;
 
     /* direct connection active, wait until it completed */
     if (btm_ble_get_conn_st() == BLE_DIR_CONN)
     {
         BTM_TRACE_ERROR("resolving list can not be edited, EnQ now");
-        return FALSE;
+        return false;
     }
 
     p_ble_cb->suspended_rl_state = BTM_BLE_RL_IDLE;
@@ -610,7 +610,7 @@
     if (btm_ble_suspend_bg_conn())
         p_ble_cb->suspended_rl_state |= BTM_BLE_RL_INIT;
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -652,9 +652,9 @@
 ** Returns          BTM_SUCCESS if successful
 **
 *******************************************************************************/
-tBTM_STATUS btm_ble_vendor_enable_irk_feature(BOOLEAN enable)
+tBTM_STATUS btm_ble_vendor_enable_irk_feature(bool    enable)
 {
-    UINT8           param[20], *p;
+    uint8_t         param[20], *p;
     tBTM_STATUS     st = BTM_MODE_UNSUPPORTED;
 
     p = param;
@@ -679,17 +679,17 @@
 ** Returns          none
 **
 *******************************************************************************/
-BOOLEAN btm_ble_exe_disable_resolving_list(void)
+bool    btm_ble_exe_disable_resolving_list(void)
 {
     if (!btm_ble_suspend_resolving_list_activity())
-        return FALSE;
+        return false;
 
     if (!controller_get_interface()->supports_ble_privacy())
-        btm_ble_vendor_enable_irk_feature(FALSE);
+        btm_ble_vendor_enable_irk_feature(false);
     else
-        btsnd_hcic_ble_set_addr_resolution_enable(FALSE);
+        btsnd_hcic_ble_set_addr_resolution_enable(false);
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -707,9 +707,9 @@
         return;
 
     if (!controller_get_interface()->supports_ble_privacy())
-        btm_ble_vendor_enable_irk_feature(TRUE);
+        btm_ble_vendor_enable_irk_feature(true);
     else
-        btsnd_hcic_ble_set_addr_resolution_enable(TRUE);
+        btsnd_hcic_ble_set_addr_resolution_enable(true);
 }
 
 /*******************************************************************************
@@ -721,13 +721,13 @@
 ** Returns          none
 **
 *******************************************************************************/
-BOOLEAN btm_ble_disable_resolving_list(UINT8 rl_mask, BOOLEAN to_resume )
+bool    btm_ble_disable_resolving_list(uint8_t rl_mask, bool    to_resume )
 {
-    UINT8 rl_state = btm_cb.ble_ctr_cb.rl_state;
+    uint8_t rl_state = btm_cb.ble_ctr_cb.rl_state;
 
     /* if controller does not support RPA offloading or privacy 1.2, skip */
     if (controller_get_interface()->get_ble_resolving_list_max_size()== 0)
-        return FALSE;
+        return false;
 
     btm_cb.ble_ctr_cb.rl_state &= ~rl_mask;
 
@@ -738,13 +738,13 @@
             if (to_resume)
                 btm_ble_resume_resolving_list_activity();
 
-            return TRUE;
+            return true;
         }
         else
-            return FALSE;
+            return false;
     }
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -755,20 +755,20 @@
 **
 ** Parameters       pointer to device security record
 **
-** Returns          TRUE if device added, otherwise falase.
+** Returns          true if device added, otherwise falase.
 **
 *******************************************************************************/
-BOOLEAN btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec)
+bool    btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec)
 {
-    BOOLEAN rt = FALSE;
-    UINT8 rl_mask = btm_cb.ble_ctr_cb.rl_state;
+    bool    rt = false;
+    uint8_t rl_mask = btm_cb.ble_ctr_cb.rl_state;
 
     BTM_TRACE_DEBUG("%s btm_cb.ble_ctr_cb.privacy_mode = %d", __func__,
                                 btm_cb.ble_ctr_cb.privacy_mode);
 
     /* if controller does not support RPA offloading or privacy 1.2, skip */
     if (controller_get_interface()->get_ble_resolving_list_max_size() == 0)
-        return FALSE;
+        return false;
 
     BTM_TRACE_DEBUG("%s btm_cb.ble_ctr_cb.privacy_mode = %d",
                     __func__, btm_cb.ble_ctr_cb.privacy_mode);
@@ -780,22 +780,22 @@
     {
         if (!(p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT) &&
             btm_ble_brcm_find_resolving_pending_entry(p_dev_rec->bd_addr,
-                                                      BTM_BLE_META_ADD_IRK_ENTRY) == FALSE)
+                                                      BTM_BLE_META_ADD_IRK_ENTRY) == false)
         {
             if (btm_cb.ble_ctr_cb.resolving_list_avail_size > 0)
             {
                 if (rl_mask)
                 {
-                    if (!btm_ble_disable_resolving_list (rl_mask, FALSE))
-                        return FALSE;
+                    if (!btm_ble_disable_resolving_list (rl_mask, false))
+                        return false;
                 }
 
-                btm_ble_update_resolving_list(p_dev_rec->bd_addr, TRUE);
+                btm_ble_update_resolving_list(p_dev_rec->bd_addr, true);
                 if (controller_get_interface()->supports_ble_privacy())
                 {
                     BD_ADDR dummy_bda = {0};
-                    UINT8 *peer_irk = p_dev_rec->ble.keys.irk;
-                    UINT8 *local_irk = btm_cb.devcb.id_keys.irk;
+                    uint8_t *peer_irk = p_dev_rec->ble.keys.irk;
+                    uint8_t *local_irk = btm_cb.devcb.id_keys.irk;
 
                     if (memcmp(p_dev_rec->ble.static_addr, dummy_bda, BD_ADDR_LEN) == 0)
                     {
@@ -810,8 +810,8 @@
                 }
                 else
                 {
-                    UINT8 param[40] = {0};
-                    UINT8 *p = param;
+                    uint8_t param[40] = {0};
+                    uint8_t *p = param;
 
                     UINT8_TO_STREAM(p, BTM_BLE_META_ADD_IRK_ENTRY);
                     ARRAY_TO_STREAM(p, p_dev_rec->ble.keys.irk, BT_OCTET16_LEN);
@@ -823,7 +823,7 @@
                                                    param,
                                                    btm_ble_resolving_list_vsc_op_cmpl)
                                                    == BTM_CMD_STARTED)
-                        rt = TRUE;
+                        rt = true;
                 }
 
                if (rt)
@@ -840,7 +840,7 @@
         else
         {
             BTM_TRACE_ERROR("Device already in Resolving list");
-            rt = TRUE;
+            rt = true;
         }
     }
     else
@@ -863,20 +863,20 @@
 *******************************************************************************/
 void btm_ble_resolving_list_remove_dev(tBTM_SEC_DEV_REC *p_dev_rec)
 {
-    UINT8 rl_mask = btm_cb.ble_ctr_cb.rl_state;
+    uint8_t rl_mask = btm_cb.ble_ctr_cb.rl_state;
 
     BTM_TRACE_EVENT ("%s", __func__);
     if (rl_mask)
     {
-        if (!btm_ble_disable_resolving_list (rl_mask, FALSE))
+        if (!btm_ble_disable_resolving_list (rl_mask, false))
              return;
     }
 
     if ((p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT) &&
         btm_ble_brcm_find_resolving_pending_entry(p_dev_rec->bd_addr,
-                                                  BTM_BLE_META_REMOVE_IRK_ENTRY) == FALSE)
+                                                  BTM_BLE_META_REMOVE_IRK_ENTRY) == false)
     {
-        btm_ble_update_resolving_list( p_dev_rec->bd_addr, FALSE);
+        btm_ble_update_resolving_list( p_dev_rec->bd_addr, false);
         btm_ble_remove_resolving_list_entry(p_dev_rec);
     }
     else
@@ -898,9 +898,9 @@
 ** Returns          none
 **
 *******************************************************************************/
-void btm_ble_enable_resolving_list(UINT8 rl_mask)
+void btm_ble_enable_resolving_list(uint8_t rl_mask)
 {
-    UINT8 rl_state = btm_cb.ble_ctr_cb.rl_state;
+    uint8_t rl_state = btm_cb.ble_ctr_cb.rl_state;
 
     btm_cb.ble_ctr_cb.rl_state |= rl_mask;
     if (rl_state == BTM_BLE_RL_IDLE &&
@@ -918,10 +918,10 @@
 **
 ** Description      check to see if resoving list is empty or not
 **
-** Returns          TRUE: empty; FALSE non-empty
+** Returns          true: empty; false non-empty
 **
 *******************************************************************************/
-BOOLEAN btm_ble_resolving_list_empty(void)
+bool    btm_ble_resolving_list_empty(void)
 {
     return (controller_get_interface()->get_ble_resolving_list_max_size() ==
             btm_cb.ble_ctr_cb.resolving_list_avail_size);
@@ -950,7 +950,7 @@
 ** Returns          none
 **
 *******************************************************************************/
-void btm_ble_enable_resolving_list_for_platform (UINT8 rl_mask)
+void btm_ble_enable_resolving_list_for_platform (uint8_t rl_mask)
 {
     /* if controller does not support, skip */
     if (controller_get_interface()->get_ble_resolving_list_max_size() == 0)
@@ -962,7 +962,7 @@
                                         btm_cb.ble_ctr_cb.resolving_list_avail_size)
             btm_ble_enable_resolving_list(rl_mask);
         else
-            btm_ble_disable_resolving_list(rl_mask, TRUE);
+            btm_ble_disable_resolving_list(rl_mask, true);
         return;
     }
 
@@ -970,7 +970,7 @@
     if (n)
         btm_ble_enable_resolving_list(rl_mask);
     else
-        btm_ble_disable_resolving_list(rl_mask, TRUE);
+        btm_ble_disable_resolving_list(rl_mask, true);
 }
 
 /*******************************************************************************
@@ -984,20 +984,20 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_ble_resolving_list_init(UINT8 max_irk_list_sz)
+void btm_ble_resolving_list_init(uint8_t max_irk_list_sz)
 {
     tBTM_BLE_RESOLVE_Q *p_q = &btm_cb.ble_ctr_cb.resolving_list_pend_q;
-    UINT8 irk_mask_size =  (max_irk_list_sz % 8) ?
+    uint8_t irk_mask_size =  (max_irk_list_sz % 8) ?
                            (max_irk_list_sz/8 + 1) : (max_irk_list_sz/8);
 
     if (max_irk_list_sz > 0)
     {
         p_q->resolve_q_random_pseudo = (BD_ADDR *)osi_malloc(sizeof(BD_ADDR) * max_irk_list_sz);
-        p_q->resolve_q_action = (UINT8 *)osi_malloc(max_irk_list_sz);
+        p_q->resolve_q_action = (uint8_t *)osi_malloc(max_irk_list_sz);
 
         /* RPA offloading feature */
         if (btm_cb.ble_ctr_cb.irk_list_mask == NULL)
-            btm_cb.ble_ctr_cb.irk_list_mask = (UINT8 *)osi_malloc(irk_mask_size);
+            btm_cb.ble_ctr_cb.irk_list_mask = (uint8_t *)osi_malloc(irk_mask_size);
 
         BTM_TRACE_DEBUG ("%s max_irk_list_sz = %d", __func__, max_irk_list_sz);
     }
diff --git a/stack/btm/btm_dev.c b/stack/btm/btm_dev.c
index c5718c6..042151d 100644
--- a/stack/btm/btm_dev.c
+++ b/stack/btm/btm_dev.c
@@ -52,20 +52,20 @@
 **                  bd_name          - Name of the peer device.  NULL if unknown.
 **                  features         - Remote device's features (up to 3 pages). NULL if not known
 **                  trusted_mask     - Bitwise OR of services that do not
-**                                     require authorization. (array of UINT32)
+**                                     require authorization. (array of uint32_t)
 **                  link_key         - Connection link key. NULL if unknown.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name,
-                          UINT8 *features, UINT32 trusted_mask[],
-                          LINK_KEY link_key, UINT8 key_type, tBTM_IO_CAP io_cap,
-                          UINT8 pin_length)
+bool    BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name,
+                          uint8_t *features, uint32_t trusted_mask[],
+                          LINK_KEY link_key, uint8_t key_type, tBTM_IO_CAP io_cap,
+                          uint8_t pin_length)
 {
     tBTM_SEC_DEV_REC  *p_dev_rec;
     int               i, j;
-    BOOLEAN           found = FALSE;
+    bool              found = false;
 
     BTM_TRACE_API("%s: link key type:%x", __func__, key_type);
     p_dev_rec = btm_find_dev (bd_addr);
@@ -73,7 +73,7 @@
     {
         if (list_length(btm_cb.sec_dev_rec) > BTM_SEC_MAX_DEVICE_RECORDS) {
             BTM_TRACE_DEBUG("%s: Max devices reached!", __func__);
-            return FALSE;
+            return false;
         }
 
         BTM_TRACE_DEBUG ("%s: allocate a new dev rec", __func__);
@@ -83,7 +83,7 @@
         memcpy (p_dev_rec->bd_addr, bd_addr, BD_ADDR_LEN);
         p_dev_rec->hci_handle = BTM_GetHCIConnHandle (bd_addr, BT_TRANSPORT_BR_EDR);
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         /* use default value for background connection params */
         /* update conn params, use default value for background connection params */
         memset(&p_dev_rec->conn_params, 0xff, sizeof(tBTM_LE_CONN_PRAMS));
@@ -115,7 +115,7 @@
             {
                 if (p_dev_rec->features[i][j] != 0)
                 {
-                    found = TRUE;
+                    found = true;
                     break;
                 }
             }
@@ -150,7 +150,7 @@
         }
     }
 
-#if defined(BTIF_MIXED_MODE_INCLUDED) && (BTIF_MIXED_MODE_INCLUDED == TRUE)
+#if (BTIF_MIXED_MODE_INCLUDED == TRUE)
     if (key_type  < BTM_MAX_PRE_SM4_LKEY_TYPE)
         p_dev_rec->sm4 = BTM_SM4_KNOWN;
     else
@@ -160,7 +160,7 @@
     p_dev_rec->rmt_io_caps = io_cap;
     p_dev_rec->device_type |= BT_DEVICE_TYPE_BREDR;
 
-    return(TRUE);
+    return true;
 }
 
 
@@ -172,10 +172,10 @@
 **
 ** Parameters:      bd_addr          - BD address of the peer
 **
-** Returns          TRUE if removed OK, FALSE if not found or ACL link is active
+** Returns          true if removed OK, false if not found or ACL link is active
 **
 *******************************************************************************/
-BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr)
+bool    BTM_SecDeleteDevice (BD_ADDR bd_addr)
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
 
@@ -183,7 +183,7 @@
         BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_BR_EDR))
     {
         BTM_TRACE_WARNING("%s FAILED: Cannot Delete when connection is active", __func__);
-        return FALSE;
+        return false;
     }
 
     if ((p_dev_rec = btm_find_dev(bd_addr)) != NULL)
@@ -193,7 +193,7 @@
         BTM_DeleteStoredLinkKey (p_dev_rec->bd_addr, NULL);
     }
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -261,7 +261,7 @@
     {
         memcpy (p_dev_rec->dev_class, p_inq_info->results.dev_class, DEV_CLASS_LEN);
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         p_dev_rec->device_type = p_inq_info->results.device_type;
         p_dev_rec->ble.ble_addr_type = p_inq_info->results.ble_addr_type;
 #endif
@@ -269,14 +269,14 @@
     else if (!memcmp (bd_addr, btm_cb.connecting_bda, BD_ADDR_LEN))
             memcpy (p_dev_rec->dev_class, btm_cb.connecting_dc, DEV_CLASS_LEN);
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     /* update conn params, use default value for background connection params */
     memset(&p_dev_rec->conn_params, 0xff, sizeof(tBTM_LE_CONN_PRAMS));
 #endif
 
     memcpy (p_dev_rec->bd_addr, bd_addr, BD_ADDR_LEN);
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     p_dev_rec->ble_hci_handle = BTM_GetHCIConnHandle (bd_addr, BT_TRANSPORT_LE);
 #endif
     p_dev_rec->hci_handle = BTM_GetHCIConnHandle (bd_addr, BT_TRANSPORT_BR_EDR);
@@ -298,7 +298,7 @@
     p_dev_rec->bond_type = BOND_TYPE_UNKNOWN;
     p_dev_rec->sec_flags = 0;
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     /* Clear out any saved BLE keys */
     btm_sec_clear_ble_keys (p_dev_rec);
     /* clear the ble block */
@@ -317,27 +317,27 @@
 **
 ** Parameters:      bd_addr       - Address of the peer device
 **
-** Returns          TRUE if device is known and role switch is supported
+** Returns          true if device is known and role switch is supported
 **
 *******************************************************************************/
-BOOLEAN btm_dev_support_switch (BD_ADDR bd_addr)
+bool    btm_dev_support_switch (BD_ADDR bd_addr)
 {
     tBTM_SEC_DEV_REC  *p_dev_rec;
-    UINT8   xx;
-    BOOLEAN feature_empty = TRUE;
+    uint8_t xx;
+    bool    feature_empty = true;
 
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
     /* Role switch is not allowed if a SCO is up */
     if (btm_is_sco_active_by_bdaddr(bd_addr))
-        return(FALSE);
+        return(false);
 #endif
     p_dev_rec = btm_find_dev (bd_addr);
     if (p_dev_rec && controller_get_interface()->supports_master_slave_role_switch())
     {
         if (HCI_SWITCH_SUPPORTED(p_dev_rec->features[HCI_EXT_FEATURES_PAGE_0]))
         {
-            BTM_TRACE_DEBUG("btm_dev_support_switch return TRUE (feature found)");
-            return (TRUE);
+            BTM_TRACE_DEBUG("btm_dev_support_switch return true (feature found)");
+            return (true);
         }
 
         /* If the feature field is all zero, we never received them */
@@ -345,7 +345,7 @@
         {
             if (p_dev_rec->features[HCI_EXT_FEATURES_PAGE_0][xx] != 0x00)
             {
-                feature_empty = FALSE; /* at least one is != 0 */
+                feature_empty = false; /* at least one is != 0 */
                 break;
             }
         }
@@ -353,22 +353,22 @@
         /* If we don't know peer's capabilities, assume it supports Role-switch */
         if (feature_empty)
         {
-            BTM_TRACE_DEBUG("btm_dev_support_switch return TRUE (feature empty)");
-            return (TRUE);
+            BTM_TRACE_DEBUG("btm_dev_support_switch return true (feature empty)");
+            return (true);
         }
     }
 
-    BTM_TRACE_DEBUG("btm_dev_support_switch return FALSE");
-    return(FALSE);
+    BTM_TRACE_DEBUG("btm_dev_support_switch return false");
+    return(false);
 }
 
 bool is_handle_equal(void *data, void *context)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = data;
-    UINT16 *handle = context;
+    uint16_t *handle = context;
 
     if (p_dev_rec->hci_handle == *handle
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
      || p_dev_rec->ble_hci_handle == *handle
 #endif
      )
@@ -387,7 +387,7 @@
 ** Returns          Pointer to the record or NULL
 **
 *******************************************************************************/
-tBTM_SEC_DEV_REC *btm_find_dev_by_handle (UINT16 handle)
+tBTM_SEC_DEV_REC *btm_find_dev_by_handle (uint16_t handle)
 {
     list_node_t *n = list_foreach(btm_cb.sec_dev_rec, is_handle_equal, &handle);
     if (n)
@@ -403,7 +403,7 @@
 
     if (!memcmp (p_dev_rec->bd_addr, *bd_addr, BD_ADDR_LEN))
         return false;
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     // If a LE random address is looking for device record
     if (!memcmp(p_dev_rec->ble.pseudo_addr, *bd_addr, BD_ADDR_LEN))
         return false;
@@ -447,7 +447,7 @@
 *******************************************************************************/
 void btm_consolidate_dev(tBTM_SEC_DEV_REC *p_target_rec)
 {
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     tBTM_SEC_DEV_REC temp_rec = *p_target_rec;
 
     BTM_TRACE_DEBUG("%s", __func__);
@@ -536,9 +536,9 @@
 tBTM_SEC_DEV_REC *btm_find_oldest_dev (void)
 {
     tBTM_SEC_DEV_REC *p_oldest = NULL;
-    UINT32       ot = 0xFFFFFFFF;
+    uint32_t     ot = 0xFFFFFFFF;
     tBTM_SEC_DEV_REC *p_oldest_paired = NULL;
-    UINT32       ot_paired = 0xFFFFFFFF;
+    uint32_t     ot_paired = 0xFFFFFFFF;
 
     /* First look for the non-paired devices for the oldest entry */
     list_node_t *end = list_end(btm_cb.sec_dev_rec);
@@ -595,16 +595,16 @@
 ** Description      Set the bond type for a device in the device database
 **                  with specified BD address
 **
-** Returns          TRUE on success, otherwise FALSE
+** Returns          true on success, otherwise false
 **
 *******************************************************************************/
-BOOLEAN btm_set_bond_type_dev(BD_ADDR bd_addr, tBTM_BOND_TYPE bond_type)
+bool    btm_set_bond_type_dev(BD_ADDR bd_addr, tBTM_BOND_TYPE bond_type)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(bd_addr);
 
     if (p_dev_rec == NULL)
-        return FALSE;
+        return false;
 
     p_dev_rec->bond_type = bond_type;
-    return TRUE;
+    return true;
 }
diff --git a/stack/btm/btm_devctl.c b/stack/btm/btm_devctl.c
index 18e20b5..3296d82 100644
--- a/stack/btm/btm_devctl.c
+++ b/stack/btm/btm_devctl.c
@@ -40,7 +40,7 @@
 #include "btcore/include/module.h"
 #include "osi/include/thread.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 #include "gatt_int.h"
 #endif /* BLE_INCLUDED */
 
@@ -64,7 +64,7 @@
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
 
-static void btm_decode_ext_features_page (UINT8 page_number, const BD_FEATURES p_features);
+static void btm_decode_ext_features_page (uint8_t page_number, const BD_FEATURES p_features);
 
 /*******************************************************************************
 **
@@ -186,7 +186,7 @@
   l2c_link_processs_num_bufs(controller->get_acl_buffer_count_classic());
 #if (BLE_INCLUDED == TRUE)
 
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
   /* Set up the BLE privacy settings */
   if (controller->supports_ble() && controller->supports_ble_privacy() &&
       controller->get_ble_resolving_list_max_size() > 0) {
@@ -232,10 +232,10 @@
 **
 ** Description      This function is called to check if the device is up.
 **
-** Returns          TRUE if device is up, else FALSE
+** Returns          true if device is up, else false
 **
 *******************************************************************************/
-BOOLEAN BTM_IsDeviceUp (void)
+bool    BTM_IsDeviceUp (void)
 {
     return controller_get_interface()->get_is_ready();
 }
@@ -266,7 +266,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btm_decode_ext_features_page (UINT8 page_number, const UINT8 *p_features)
+static void btm_decode_ext_features_page (uint8_t page_number, const uint8_t *p_features)
 {
     BTM_TRACE_DEBUG ("btm_decode_ext_features_page page: %d", page_number);
     switch (page_number)
@@ -319,8 +319,8 @@
 
         /* Create (e)SCO supported packet types mask */
         btm_cb.btm_sco_pkt_types_supported = 0;
-#if BTM_SCO_INCLUDED == TRUE
-        btm_cb.sco_cb.esco_supported = FALSE;
+#if (BTM_SCO_INCLUDED == TRUE)
+        btm_cb.sco_cb.esco_supported = false;
 #endif
         if (HCI_SCO_LINK_SUPPORTED(p_features))
         {
@@ -341,10 +341,10 @@
 
         if (HCI_ESCO_EV5_SUPPORTED(p_features))
             btm_cb.btm_sco_pkt_types_supported |= BTM_SCO_PKT_TYPES_MASK_EV5;
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
         if (btm_cb.btm_sco_pkt_types_supported & BTM_ESCO_LINK_ONLY_MASK)
         {
-            btm_cb.sco_cb.esco_supported = TRUE;
+            btm_cb.sco_cb.esco_supported = true;
 
             /* Add in EDR related eSCO types */
             if (HCI_EDR_ESCO_2MPS_SUPPORTED(p_features))
@@ -405,11 +405,11 @@
                 BTM_SetInquiryMode (BTM_INQ_RESULT_WITH_RSSI);
         }
 
-#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
+#if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
         if( HCI_NON_FLUSHABLE_PB_SUPPORTED(p_features))
-            l2cu_set_non_flushable_pbf(TRUE);
+            l2cu_set_non_flushable_pbf(true);
         else
-            l2cu_set_non_flushable_pbf(FALSE);
+            l2cu_set_non_flushable_pbf(false);
 #endif
         BTM_SetPageScanType (BTM_DEFAULT_SCAN_TYPE);
         BTM_SetInquiryScanType (BTM_DEFAULT_SCAN_TYPE);
@@ -443,7 +443,7 @@
 *******************************************************************************/
 tBTM_STATUS BTM_SetLocalDeviceName (char *p_name)
 {
-    UINT8    *p;
+    uint8_t  *p;
 
     if (!p_name || !p_name[0] || (strlen ((char *)p_name) > BD_NAME_LEN))
         return (BTM_ILLEGAL_VALUE);
@@ -453,11 +453,11 @@
 
 #if BTM_MAX_LOC_BD_NAME_LEN > 0
     /* Save the device name if local storage is enabled */
-    p = (UINT8 *)btm_cb.cfg.bd_name;
-    if (p != (UINT8 *)p_name)
+    p = (uint8_t *)btm_cb.cfg.bd_name;
+    if (p != (uint8_t *)p_name)
         strlcpy(btm_cb.cfg.bd_name, p_name, BTM_MAX_LOC_BD_NAME_LEN);
 #else
-    p = (UINT8 *)p_name;
+    p = (uint8_t *)p_name;
 #endif
 
     if (btsnd_hcic_change_name(p))
@@ -531,10 +531,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_local_name_complete (UINT8 *p, UINT16 evt_len)
+void btm_read_local_name_complete (uint8_t *p, uint16_t evt_len)
 {
     tBTM_CMPL_CB   *p_cb = btm_cb.devcb.p_rln_cmpl_cb;
-    UINT8           status;
+    uint8_t         status;
     UNUSED(evt_len);
 
     alarm_cancel(btm_cb.devcb.read_local_name_timer);
@@ -588,9 +588,9 @@
 ** Returns          pointer to the device class
 **
 *******************************************************************************/
-UINT8 *BTM_ReadDeviceClass (void)
+uint8_t *BTM_ReadDeviceClass (void)
 {
-    return ((UINT8 *)btm_cb.devcb.dev_class);
+    return ((uint8_t *)btm_cb.devcb.dev_class);
 }
 
 
@@ -604,10 +604,10 @@
 **
 *******************************************************************************/
 // TODO(zachoverflow): get rid of this function
-UINT8 *BTM_ReadLocalFeatures (void)
+uint8_t *BTM_ReadLocalFeatures (void)
 {
     // Discarding const modifier for now, until this function dies
-    return (UINT8 *)controller_get_interface()->get_features_classic(0)->as_array;
+    return (uint8_t *)controller_get_interface()->get_features_classic(0)->as_array;
 }
 
 /*******************************************************************************
@@ -647,8 +647,8 @@
 **      Opcode will be OR'd with HCI_GRP_VENDOR_SPECIFIC.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_VendorSpecificCommand(UINT16 opcode, UINT8 param_len,
-                                      UINT8 *p_param_buf, tBTM_VSC_CMPL_CB *p_cb)
+tBTM_STATUS BTM_VendorSpecificCommand(uint16_t opcode, uint8_t param_len,
+                                      uint8_t *p_param_buf, tBTM_VSC_CMPL_CB *p_cb)
 {
     /* Allocate a buffer to hold HCI command plus the callback function */
     void *p_buf = osi_malloc(sizeof(BT_HDR) + sizeof(tBTM_CMPL_CB *) +
@@ -678,7 +678,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_vsc_complete (UINT8 *p, UINT16 opcode, UINT16 evt_len,
+void btm_vsc_complete (uint8_t *p, uint16_t opcode, uint16_t evt_len,
                        tBTM_CMPL_CB *p_vsc_cplt_cback)
 {
     tBTM_VSC_CMPL   vcs_cplt_params;
@@ -701,18 +701,18 @@
 ** Description      This function is called to register/deregister for vendor
 **                  specific HCI events.
 **
-**                  If is_register=TRUE, then the function will be registered;
-**                  if is_register=FALSE, then the function will be deregistered.
+**                  If is_register=true, then the function will be registered;
+**                  if is_register=false, then the function will be deregistered.
 **
 ** Returns          BTM_SUCCESS if successful,
 **                  BTM_BUSY if maximum number of callbacks have already been
 **                           registered.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_RegisterForVSEvents (tBTM_VS_EVT_CB *p_cb, BOOLEAN is_register)
+tBTM_STATUS BTM_RegisterForVSEvents (tBTM_VS_EVT_CB *p_cb, bool    is_register)
 {
     tBTM_STATUS retval = BTM_SUCCESS;
-    UINT8 i, free_idx = BTM_MAX_VSE_CALLBACKS;
+    uint8_t i, free_idx = BTM_MAX_VSE_CALLBACKS;
 
     /* See if callback is already registered */
     for (i=0; i<BTM_MAX_VSE_CALLBACKS; i++)
@@ -725,7 +725,7 @@
         else if (btm_cb.devcb.p_vend_spec_cb[i] == p_cb)
         {
             /* Found callback in lookup table. If deregistering, clear the entry. */
-            if (is_register == FALSE)
+            if (is_register == false)
             {
                 btm_cb.devcb.p_vend_spec_cb[i] = NULL;
                 BTM_TRACE_EVENT("BTM Deregister For VSEvents is successfully");
@@ -766,9 +766,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_vendor_specific_evt (UINT8 *p, UINT8 evt_len)
+void btm_vendor_specific_evt (uint8_t *p, uint8_t evt_len)
 {
-    UINT8 i;
+    uint8_t i;
 
     BTM_TRACE_DEBUG ("BTM Event: Vendor Specific event from controller");
 
@@ -792,7 +792,7 @@
 **
 **
 *******************************************************************************/
-tBTM_STATUS BTM_WritePageTimeout(UINT16 timeout)
+tBTM_STATUS BTM_WritePageTimeout(uint16_t timeout)
 {
     BTM_TRACE_EVENT ("BTM: BTM_WritePageTimeout: Timeout: %d.", timeout);
 
@@ -816,12 +816,12 @@
 **
 **
 *******************************************************************************/
-tBTM_STATUS BTM_WriteVoiceSettings(UINT16 settings)
+tBTM_STATUS BTM_WriteVoiceSettings(uint16_t settings)
 {
     BTM_TRACE_EVENT ("BTM: BTM_WriteVoiceSettings: Settings: 0x%04x.", settings);
 
     /* Send the HCI command */
-    if (btsnd_hcic_write_voice_settings ((UINT16)(settings & 0x03ff)))
+    if (btsnd_hcic_write_voice_settings ((uint16_t)(settings & 0x03ff)))
         return (BTM_SUCCESS);
 
     return (BTM_NO_RESOURCES);
@@ -844,7 +844,7 @@
 *******************************************************************************/
 tBTM_STATUS BTM_EnableTestMode(void)
 {
-    UINT8   cond;
+    uint8_t cond;
 
     BTM_TRACE_EVENT ("BTM: BTM_EnableTestMode");
 
@@ -901,7 +901,7 @@
 tBTM_STATUS BTM_DeleteStoredLinkKey(BD_ADDR bd_addr, tBTM_CMPL_CB *p_cb)
 {
     BD_ADDR local_bd_addr;
-    BOOLEAN delete_all_flag = FALSE;
+    bool    delete_all_flag = false;
 
     /* Check if the previous command is completed */
     if (btm_cb.devcb.p_stored_link_key_cmpl_cb)
@@ -910,14 +910,14 @@
     if (!bd_addr)
     {
         /* This is to delete all link keys */
-        delete_all_flag = TRUE;
+        delete_all_flag = true;
 
         /* We don't care the BD address. Just pass a non zero pointer */
         bd_addr = local_bd_addr;
     }
 
     BTM_TRACE_EVENT ("BTM: BTM_DeleteStoredLinkKey: delete_all_flag: %s",
-                        delete_all_flag ? "TRUE" : "FALSE");
+                        delete_all_flag ? "true" : "false");
 
     /* Send the HCI command */
     btm_cb.devcb.p_stored_link_key_cmpl_cb = p_cb;
@@ -939,7 +939,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_delete_stored_link_key_complete (UINT8 *p)
+void btm_delete_stored_link_key_complete (uint8_t *p)
 {
     tBTM_CMPL_CB         *p_cb = btm_cb.devcb.p_stored_link_key_cmpl_cb;
     tBTM_DELETE_STORED_LINK_KEY_COMPLETE  result;
diff --git a/stack/btm/btm_inq.c b/stack/btm/btm_inq.c
index d315c11..c7552df 100644
--- a/stack/btm/btm_inq.c
+++ b/stack/btm/btm_inq.c
@@ -46,7 +46,7 @@
 
 /* TRUE to enable DEBUG traces for btm_inq */
 #ifndef BTM_INQ_DEBUG
-#define BTM_INQ_DEBUG   FALSE
+#define BTM_INQ_DEBUG FALSE
 #endif
 
 extern fixed_queue_t *btu_general_alarm_queue;
@@ -57,7 +57,7 @@
 static const LAP general_inq_lap = {0x9e,0x8b,0x33};
 static const LAP limited_inq_lap = {0x9e,0x8b,0x00};
 
-const UINT16 BTM_EIR_UUID_LKUP_TBL[BTM_EIR_MAX_SERVICES] =
+const uint16_t BTM_EIR_UUID_LKUP_TBL[BTM_EIR_MAX_SERVICES] =
 {
     UUID_SERVCLASS_SERVICE_DISCOVERY_SERVER,
 /*    UUID_SERVCLASS_BROWSE_GROUP_DESCRIPTOR,   */
@@ -134,14 +134,14 @@
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
 static void         btm_initiate_inquiry (tBTM_INQUIRY_VAR_ST *p_inq);
-static tBTM_STATUS  btm_set_inq_event_filter (UINT8 filter_cond_type, tBTM_INQ_FILT_COND *p_filt_cond);
+static tBTM_STATUS  btm_set_inq_event_filter (uint8_t filter_cond_type, tBTM_INQ_FILT_COND *p_filt_cond);
 static void         btm_clr_inq_result_flt (void);
 
-static UINT8        btm_convert_uuid_to_eir_service( UINT16 uuid16 );
-static void         btm_set_eir_uuid( UINT8 *p_eir, tBTM_INQ_RESULTS *p_results );
-static UINT8       *btm_eir_get_uuid_list( UINT8 *p_eir, UINT8 uuid_size,
-                                           UINT8 *p_num_uuid, UINT8 *p_uuid_list_type );
-static UINT16       btm_convert_uuid_to_uuid16( UINT8 *p_uuid, UINT8 uuid_size );
+static uint8_t      btm_convert_uuid_to_eir_service( uint16_t uuid16 );
+static void         btm_set_eir_uuid( uint8_t *p_eir, tBTM_INQ_RESULTS *p_results );
+static uint8_t     *btm_eir_get_uuid_list( uint8_t *p_eir, uint8_t uuid_size,
+                                           uint8_t *p_num_uuid, uint8_t *p_uuid_list_type );
+static uint16_t     btm_convert_uuid_to_uuid16( uint8_t *p_uuid, uint8_t uuid_size );
 
 /*******************************************************************************
 **
@@ -159,22 +159,22 @@
 **                  BTM_WRONG_MODE if the device is not up.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetDiscoverability (UINT16 inq_mode, UINT16 window, UINT16 interval)
+tBTM_STATUS BTM_SetDiscoverability (uint16_t inq_mode, uint16_t window, uint16_t interval)
 {
-    UINT8        scan_mode = 0;
-    UINT16       service_class;
-    UINT8       *p_cod;
-    UINT8        major, minor;
+    uint8_t      scan_mode = 0;
+    uint16_t     service_class;
+    uint8_t     *p_cod;
+    uint8_t      major, minor;
     DEV_CLASS    cod;
     LAP          temp_lap[2];
-    BOOLEAN      is_limited;
-    BOOLEAN      cod_limited;
+    bool         is_limited;
+    bool         cod_limited;
 
     BTM_TRACE_API ("BTM_SetDiscoverability");
 #if (BLE_INCLUDED == TRUE && BLE_INCLUDED == TRUE)
     if (controller_get_interface()->supports_ble())
     {
-        if (btm_ble_set_discoverability((UINT16)(inq_mode))
+        if (btm_ble_set_discoverability((uint16_t)(inq_mode))
                             == BTM_SUCCESS)
         {
             btm_cb.btm_inq_vars.discoverable_mode &= (~BTM_BLE_DISCOVERABLE_MASK);
@@ -265,8 +265,8 @@
     /* Change the service class bit if mode has changed */
     p_cod = BTM_ReadDeviceClass();
     BTM_COD_SERVICE_CLASS(service_class, p_cod);
-    is_limited = (inq_mode & BTM_LIMITED_DISCOVERABLE) ? TRUE : FALSE;
-    cod_limited = (service_class & BTM_COD_SERVICE_LMTD_DISCOVER) ? TRUE : FALSE;
+    is_limited = (inq_mode & BTM_LIMITED_DISCOVERABLE) ? true : false;
+    cod_limited = (service_class & BTM_COD_SERVICE_LMTD_DISCOVER) ? true : false;
     if (is_limited ^ cod_limited)
     {
         BTM_COD_MINOR_CLASS(minor, p_cod );
@@ -295,7 +295,7 @@
 **                  BTM_WRONG_MODE if the device is not up.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetInquiryScanType (UINT16 scan_type)
+tBTM_STATUS BTM_SetInquiryScanType (uint16_t scan_type)
 {
 
     BTM_TRACE_API ("BTM_SetInquiryScanType");
@@ -311,7 +311,7 @@
     {
         if (BTM_IsDeviceUp())
         {
-            if (btsnd_hcic_write_inqscan_type ((UINT8)scan_type))
+            if (btsnd_hcic_write_inqscan_type ((uint8_t)scan_type))
                 btm_cb.btm_inq_vars.inq_scan_type = scan_type;
             else
                 return (BTM_NO_RESOURCES);
@@ -333,7 +333,7 @@
 **                  BTM_WRONG_MODE if the device is not up.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetPageScanType (UINT16 scan_type)
+tBTM_STATUS BTM_SetPageScanType (uint16_t scan_type)
 {
     BTM_TRACE_API ("BTM_SetPageScanType");
     if (scan_type != BTM_SCAN_TYPE_STANDARD && scan_type != BTM_SCAN_TYPE_INTERLACED)
@@ -348,7 +348,7 @@
     {
         if (BTM_IsDeviceUp())
         {
-            if (btsnd_hcic_write_pagescan_type ((UINT8)scan_type))
+            if (btsnd_hcic_write_pagescan_type ((uint8_t)scan_type))
                 btm_cb.btm_inq_vars.page_scan_type  = scan_type;
             else
                 return (BTM_NO_RESOURCES);
@@ -374,7 +374,7 @@
 **                  BTM_WRONG_MODE if the device is not up.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetInquiryMode (UINT8 mode)
+tBTM_STATUS BTM_SetInquiryMode (uint8_t mode)
 {
     const controller_t *controller = controller_get_interface();
     BTM_TRACE_API ("BTM_SetInquiryMode");
@@ -418,7 +418,7 @@
 **                  BTM_GENERAL_DISCOVERABLE
 **
 *******************************************************************************/
-UINT16 BTM_ReadDiscoverability (UINT16 *p_window, UINT16 *p_interval)
+uint16_t BTM_ReadDiscoverability (uint16_t *p_window, uint16_t *p_interval)
 {
     BTM_TRACE_API ("BTM_ReadDiscoverability");
     if (p_window)
@@ -460,8 +460,8 @@
 **                  BTM_WRONG_MODE if the device is not up.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetPeriodicInquiryMode (tBTM_INQ_PARMS *p_inqparms, UINT16 max_delay,
-                                        UINT16 min_delay, tBTM_INQ_RESULTS_CB *p_results_cb)
+tBTM_STATUS BTM_SetPeriodicInquiryMode (tBTM_INQ_PARMS *p_inqparms, uint16_t max_delay,
+                                        uint16_t min_delay, tBTM_INQ_RESULTS_CB *p_results_cb)
 {
     tBTM_STATUS  status;
     tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
@@ -479,7 +479,7 @@
     if (p_inq->inq_active || p_inq->inqfilt_active)
         return (BTM_BUSY);
 
-    /* If illegal parameters return FALSE */
+    /* If illegal parameters return false */
     if (p_inqparms->mode != BTM_GENERAL_INQUIRY &&
         p_inqparms->mode != BTM_LIMITED_INQUIRY)
         return (BTM_ILLEGAL_VALUE);
@@ -505,7 +505,7 @@
     p_inq->inq_cmpl_info.num_resp = 0;         /* Clear the results counter */
     p_inq->p_inq_results_cb = p_results_cb;
 
-    p_inq->inq_active = (UINT8)((p_inqparms->mode == BTM_LIMITED_INQUIRY) ?
+    p_inq->inq_active = (uint8_t)((p_inqparms->mode == BTM_LIMITED_INQUIRY) ?
                             (BTM_LIMITED_INQUIRY_ACTIVE | BTM_PERIODIC_INQUIRY_ACTIVE) :
                             (BTM_GENERAL_INQUIRY_ACTIVE | BTM_PERIODIC_INQUIRY_ACTIVE));
 
@@ -570,7 +570,7 @@
         if(p_inq->inqfilt_active)
             p_inq->pending_filt_complete_event++;
 
-        p_inq->inqfilt_active = FALSE;
+        p_inq->inqfilt_active = false;
         p_inq->inq_counter++;
     }
 
@@ -591,9 +591,9 @@
 **                  BTM_WRONG_MODE if the device is not up.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetConnectability (UINT16 page_mode, UINT16 window, UINT16 interval)
+tBTM_STATUS BTM_SetConnectability (uint16_t page_mode, uint16_t window, uint16_t interval)
 {
-    UINT8    scan_mode = 0;
+    uint8_t  scan_mode = 0;
     tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
 
     BTM_TRACE_API ("BTM_SetConnectability");
@@ -683,7 +683,7 @@
 ** Returns          BTM_NON_CONNECTABLE or BTM_CONNECTABLE
 **
 *******************************************************************************/
-UINT16 BTM_ReadConnectability (UINT16 *p_window, UINT16 *p_interval)
+uint16_t BTM_ReadConnectability (uint16_t *p_window, uint16_t *p_interval)
 {
     BTM_TRACE_API ("BTM_ReadConnectability");
     if (p_window)
@@ -709,7 +709,7 @@
 **                  BTM_PERIODIC_INQUIRY_ACTIVE if a periodic inquiry is active
 **
 *******************************************************************************/
-UINT16 BTM_IsInquiryActive (void)
+uint16_t BTM_IsInquiryActive (void)
 {
     BTM_TRACE_API ("BTM_IsInquiryActive");
 
@@ -733,8 +733,8 @@
 {
     tBTM_STATUS           status = BTM_SUCCESS;
     tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
-    UINT8 active_mode=p_inq->inq_active;
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+    uint8_t active_mode=p_inq->inq_active;
 #endif
     BTM_TRACE_API ("BTM_CancelInquiry called");
 
@@ -755,14 +755,14 @@
             event will be ignored */
         if (p_inq->inqfilt_active)
         {
-            p_inq->inqfilt_active = FALSE;
+            p_inq->inqfilt_active = false;
             p_inq->pending_filt_complete_event++;
         }
          /* Initiate the cancel inquiry */
         else
         {
             if (((p_inq->inqparms.mode & BTM_BR_INQUIRY_MASK) != 0)
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
             &&(active_mode & BTM_BR_INQUIRY_MASK)
 #endif
             )
@@ -770,9 +770,9 @@
                 if (!btsnd_hcic_inq_cancel())
                     status = BTM_NO_RESOURCES;
             }
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             if (((p_inq->inqparms.mode & BTM_BLE_INQUIRY_MASK) != 0)
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
             &&(active_mode & BTM_BLE_INQ_ACTIVE_MASK)
 #endif
             )
@@ -836,7 +836,7 @@
        Also do not allow an inquiry if the inquiry filter is being updated */
     if (p_inq->inq_active || p_inq->inqfilt_active)
     {
-#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
+#if (BLE_INCLUDED == TRUE)
         /*check if LE observe is already running*/
         if(p_inq->scan_type==INQ_LE_OBSERVE && p_inq->p_inq_ble_results_cb!=NULL)
         {
@@ -869,7 +869,7 @@
         )
         return (BTM_ILLEGAL_VALUE);
 
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
         if(p_inq->next_state==BTM_FINISH)
             return BTM_ILLEGAL_VALUE;
 #endif
@@ -888,7 +888,7 @@
     BTM_TRACE_DEBUG("BTM_StartInquiry: p_inq->inq_active = 0x%02x", p_inq->inq_active);
 
 /* interleave scan minimal conditions */
-#if (BLE_INCLUDED==TRUE && (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE))
+#if (BLE_INCLUDED == TRUE && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
 
     /* check if both modes are present */
     if((p_inqparms->mode & BTM_BLE_INQUIRY_MASK) && (p_inqparms->mode & BTM_BR_INQUIRY_MASK))
@@ -907,16 +907,16 @@
 
 
 /* start LE inquiry here if requested */
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     if ((p_inqparms->mode & BTM_BLE_INQUIRY_MASK)
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
         &&(p_inq->next_state==BTM_BLE_ONE || p_inq->next_state==BTM_BLE_TWO ||
            p_inq->next_state==BTM_NO_INTERLEAVING)
 #endif
         )
 
     {
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
         p_inq->inq_active = (p_inqparms->mode & BTM_BLE_INQUIRY_MASK);
         BTM_TRACE_API("BTM:Starting LE Scan with duration %d and activeMode:0x%02x",
                        p_inqparms->duration, (p_inqparms->mode & BTM_BLE_INQUIRY_MASK));
@@ -927,17 +927,17 @@
             status = BTM_ILLEGAL_VALUE;
         }
         /* BLE for now does not support filter condition for inquiry */
-        else if ((status = btm_ble_start_inquiry((UINT8)(p_inqparms->mode & BTM_BLE_INQUIRY_MASK),
+        else if ((status = btm_ble_start_inquiry((uint8_t)(p_inqparms->mode & BTM_BLE_INQUIRY_MASK),
                                             p_inqparms->duration)) != BTM_CMD_STARTED)
         {
             BTM_TRACE_ERROR("Err Starting LE Inquiry.");
             p_inq->inqparms.mode &= ~ BTM_BLE_INQUIRY_MASK;
         }
-#if (!defined(BTA_HOST_INTERLEAVE_SEARCH) || BTA_HOST_INTERLEAVE_SEARCH == FALSE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == FALSE)
         p_inqparms->mode &= ~BTM_BLE_INQUIRY_MASK;
 #endif
 
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
         if(p_inq->next_state==BTM_NO_INTERLEAVING)
         {
             p_inq->next_state=BTM_FINISH;
@@ -966,7 +966,7 @@
         return status;
 
     /* BR/EDR inquiry portion */
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
     if((p_inq->next_state==BTM_BR_ONE || p_inq->next_state==BTM_BR_TWO ||
         p_inq->next_state==BTM_NO_INTERLEAVING ))
     {
@@ -1000,7 +1000,7 @@
                                             &p_inqparms->filter_cond)) != BTM_CMD_STARTED)
         p_inq->state = BTM_INQ_INACTIVE_STATE;
 
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
         if (p_inq->next_state==BTM_NO_INTERLEAVING)
             p_inq->next_state=BTM_FINISH;
         else
@@ -1101,7 +1101,7 @@
     /* Make sure there is not already one in progress */
     if (p_inq->remname_active)
     {
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         if (BTM_UseLeLink(p_inq->remname_bda))
         {
             if (btm_ble_cancel_remote_name(p_inq->remname_bda))
@@ -1158,7 +1158,7 @@
 *******************************************************************************/
 tBTM_INQ_INFO *BTM_InqDbFirst (void)
 {
-    UINT16       xx;
+    uint16_t     xx;
     tINQ_DB_ENT  *p_ent = btm_cb.btm_inq_vars.inq_db;
 
     for (xx = 0; xx < BTM_INQ_DB_SIZE; xx++, p_ent++)
@@ -1186,12 +1186,12 @@
 tBTM_INQ_INFO *BTM_InqDbNext (tBTM_INQ_INFO *p_cur)
 {
     tINQ_DB_ENT  *p_ent;
-    UINT16        inx;
+    uint16_t      inx;
 
     if (p_cur)
     {
-        p_ent = (tINQ_DB_ENT *) ((UINT8 *)p_cur - offsetof (tINQ_DB_ENT, inq_info));
-        inx = (UINT16)((p_ent - btm_cb.btm_inq_vars.inq_db) + 1);
+        p_ent = (tINQ_DB_ENT *) ((uint8_t *)p_cur - offsetof (tINQ_DB_ENT, inq_info));
+        inx = (uint16_t)((p_ent - btm_cb.btm_inq_vars.inq_db) + 1);
 
         for (p_ent = &btm_cb.btm_inq_vars.inq_db[inx]; inx < BTM_INQ_DB_SIZE; inx++, p_ent++)
         {
@@ -1288,8 +1288,8 @@
 {
     tBTM_REMOTE_DEV_NAME     rem_name;
     tBTM_INQUIRY_VAR_ST     *p_inq = &btm_cb.btm_inq_vars;
-    UINT8                    num_responses;
-    UINT8                    temp_inq_active;
+    uint8_t                  num_responses;
+    uint8_t                  temp_inq_active;
     tBTM_STATUS              status;
 
     /* If an inquiry or periodic inquiry is active, reset the mode to inactive */
@@ -1315,7 +1315,7 @@
     if (p_inq->remname_active )
     {
         alarm_cancel(p_inq->remote_name_timer);
-        p_inq->remname_active = FALSE;
+        p_inq->remname_active = false;
         memset(p_inq->remname_bda, 0, BD_ADDR_LEN);
 
         if (p_inq->p_remname_cmpl_cb)
@@ -1330,7 +1330,7 @@
     /* Cancel an inquiry filter request if active, and notify the caller (if waiting) */
     if (p_inq->inqfilt_active)
     {
-        p_inq->inqfilt_active = FALSE;
+        p_inq->inqfilt_active = false;
 
         if (p_inq->p_inqfilter_cmpl_cb)
         {
@@ -1350,7 +1350,7 @@
     p_inq->page_scan_type    = BTM_SCAN_TYPE_STANDARD;
     p_inq->inq_scan_type     = BTM_SCAN_TYPE_STANDARD;
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     p_inq->discoverable_mode |= BTM_BLE_NON_DISCOVERABLE;
     p_inq->connectable_mode  |= BTM_BLE_NON_CONNECTABLE;
 #endif
@@ -1390,7 +1390,7 @@
 *******************************************************************************/
 void btm_inq_stop_on_ssp(void)
 {
-    UINT8 normal_active = (BTM_GENERAL_INQUIRY_ACTIVE|BTM_LIMITED_INQUIRY_ACTIVE);
+    uint8_t normal_active = (BTM_GENERAL_INQUIRY_ACTIVE|BTM_LIMITED_INQUIRY_ACTIVE);
 
 #if (BTM_INQ_DEBUG == TRUE)
     BTM_TRACE_DEBUG ("btm_inq_stop_on_ssp: no_inc_ssp=%d inq_active:0x%x state:%d inqfilt_active:%d",
@@ -1446,7 +1446,7 @@
 {
     tBTM_INQUIRY_VAR_ST     *p_inq = &btm_cb.btm_inq_vars;
     tINQ_DB_ENT             *p_ent = p_inq->inq_db;
-    UINT16                   xx;
+    uint16_t                 xx;
 
 #if (BTM_INQ_DEBUG == TRUE)
     BTM_TRACE_DEBUG ("btm_clr_inq_db: inq_active:0x%x state:%d",
@@ -1460,7 +1460,7 @@
             if (p_bda == NULL ||
                 (!memcmp (p_ent->inq_info.results.remote_bd_addr, p_bda, BD_ADDR_LEN)))
             {
-                p_ent->in_use = FALSE;
+                p_ent->in_use = false;
             }
         }
     }
@@ -1478,7 +1478,7 @@
 ** Description      This function looks through the bdaddr database for a match
 **                  based on Bluetooth Device Address
 **
-** Returns          TRUE if found, else FALSE (new entry)
+** Returns          true if found, else false (new entry)
 **
 *******************************************************************************/
 static void btm_clr_inq_result_flt (void)
@@ -1497,24 +1497,24 @@
 ** Description      This function looks through the bdaddr database for a match
 **                  based on Bluetooth Device Address
 **
-** Returns          TRUE if found, else FALSE (new entry)
+** Returns          true if found, else false (new entry)
 **
 *******************************************************************************/
-BOOLEAN btm_inq_find_bdaddr (BD_ADDR p_bda)
+bool    btm_inq_find_bdaddr (BD_ADDR p_bda)
 {
     tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
     tINQ_BDADDR         *p_db = &p_inq->p_bd_db[0];
-    UINT16       xx;
+    uint16_t     xx;
 
     /* Don't bother searching, database doesn't exist or periodic mode */
     if ((p_inq->inq_active & BTM_PERIODIC_INQUIRY_ACTIVE) || !p_db)
-        return (FALSE);
+        return (false);
 
     for (xx = 0; xx < p_inq->num_bd_entries; xx++, p_db++)
     {
         if (!memcmp(p_db->bd_addr, p_bda, BD_ADDR_LEN)
             && p_db->inq_count == p_inq->inq_counter)
-            return (TRUE);
+            return (true);
     }
 
     if (xx < p_inq->max_bd_entries)
@@ -1525,7 +1525,7 @@
     }
 
     /* If here, New Entry */
-    return (FALSE);
+    return (false);
 }
 
 /*******************************************************************************
@@ -1540,7 +1540,7 @@
 *******************************************************************************/
 tINQ_DB_ENT *btm_inq_db_find (const BD_ADDR p_bda)
 {
-    UINT16       xx;
+    uint16_t     xx;
     tINQ_DB_ENT  *p_ent = btm_cb.btm_inq_vars.inq_db;
 
     for (xx = 0; xx < BTM_INQ_DB_SIZE; xx++, p_ent++)
@@ -1566,10 +1566,10 @@
 *******************************************************************************/
 tINQ_DB_ENT *btm_inq_db_new (BD_ADDR p_bda)
 {
-    UINT16       xx;
+    uint16_t     xx;
     tINQ_DB_ENT  *p_ent = btm_cb.btm_inq_vars.inq_db;
     tINQ_DB_ENT  *p_old = btm_cb.btm_inq_vars.inq_db;
-    UINT32       ot = 0xFFFFFFFF;
+    uint32_t     ot = 0xFFFFFFFF;
 
     for (xx = 0; xx < BTM_INQ_DB_SIZE; xx++, p_ent++)
     {
@@ -1577,7 +1577,7 @@
         {
             memset (p_ent, 0, sizeof (tINQ_DB_ENT));
             memcpy (p_ent->inq_info.results.remote_bd_addr, p_bda, BD_ADDR_LEN);
-            p_ent->in_use = TRUE;
+            p_ent->in_use = true;
 
             return (p_ent);
         }
@@ -1593,7 +1593,7 @@
 
     memset (p_old, 0, sizeof (tINQ_DB_ENT));
     memcpy (p_old->inq_info.results.remote_bd_addr, p_bda, BD_ADDR_LEN);
-    p_old->in_use = TRUE;
+    p_old->in_use = true;
 
     return (p_old);
 }
@@ -1622,12 +1622,12 @@
 **                  BTM_ILLEGAL_VALUE if a bad parameter was detected
 **
 *******************************************************************************/
-static tBTM_STATUS btm_set_inq_event_filter (UINT8 filter_cond_type,
+static tBTM_STATUS btm_set_inq_event_filter (uint8_t filter_cond_type,
                                              tBTM_INQ_FILT_COND *p_filt_cond)
 {
-    UINT8    condition_length = DEV_CLASS_LEN * 2;
-    UINT8    condition_buf[DEV_CLASS_LEN * 2];
-    UINT8   *p_cond = condition_buf;                    /* points to the condition to pass to HCI */
+    uint8_t  condition_length = DEV_CLASS_LEN * 2;
+    uint8_t  condition_buf[DEV_CLASS_LEN * 2];
+    uint8_t *p_cond = condition_buf;                    /* points to the condition to pass to HCI */
 
 #if (BTM_INQ_DEBUG == TRUE)
     BTM_TRACE_DEBUG ("btm_set_inq_event_filter: filter type %d [Clear-0, COD-1, BDADDR-2]",
@@ -1663,7 +1663,7 @@
         return (BTM_ILLEGAL_VALUE);     /* Bad parameter was passed in */
     }
 
-    btm_cb.btm_inq_vars.inqfilt_active = TRUE;
+    btm_cb.btm_inq_vars.inqfilt_active = true;
 
     /* Filter the inquiry results for the specified condition type and value */
     if (btsnd_hcic_set_event_filter(HCI_FILTER_INQUIRY_RESULT, filter_cond_type,
@@ -1686,9 +1686,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_event_filter_complete (UINT8 *p)
+void btm_event_filter_complete (uint8_t *p)
 {
-    UINT8            hci_status;
+    uint8_t          hci_status;
     tBTM_STATUS      status;
     tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
     tBTM_CMPL_CB   *p_cb = p_inq->p_inqfilter_cmpl_cb;
@@ -1706,7 +1706,7 @@
 
     /* Only process the inquiry filter; Ignore the connection filter until it
        is used by the upper layers */
-    if (p_inq->inqfilt_active == TRUE )
+    if (p_inq->inqfilt_active == true )
     {
         /* Extract the returned status from the buffer */
         STREAM_TO_UINT8 (hci_status, p);
@@ -1723,7 +1723,7 @@
            callback function to notify the initiator that it has completed */
         if (p_inq->state == BTM_INQ_INACTIVE_STATE)
         {
-            p_inq->inqfilt_active = FALSE;
+            p_inq->inqfilt_active = false;
             if (p_cb)
                 (*p_cb) (&status);
         }
@@ -1733,10 +1733,10 @@
             if(status != BTM_SUCCESS)
             {
                 /* Process the inquiry complete (Error Status) */
-                btm_process_inq_complete (BTM_ERR_PROCESSING, (UINT8)(p_inq->inqparms.mode & BTM_BR_INQUIRY_MASK));
+                btm_process_inq_complete (BTM_ERR_PROCESSING, (uint8_t)(p_inq->inqparms.mode & BTM_BR_INQUIRY_MASK));
 
                 /* btm_process_inq_complete() does not restore the following settings on periodic inquiry */
-                p_inq->inqfilt_active = FALSE;
+                p_inq->inqfilt_active = false;
                 p_inq->inq_active = BTM_INQUIRY_INACTIVE;
                 p_inq->state = BTM_INQ_INACTIVE_STATE;
 
@@ -1752,16 +1752,16 @@
                 }
                 else    /* Error setting the filter: Call the initiator's callback function to indicate a failure */
                 {
-                    p_inq->inqfilt_active = FALSE;
+                    p_inq->inqfilt_active = false;
 
                     /* Process the inquiry complete (Error Status) */
-                    btm_process_inq_complete (BTM_ERR_PROCESSING, (UINT8)(p_inq->inqparms.mode & BTM_BR_INQUIRY_MASK));
+                    btm_process_inq_complete (BTM_ERR_PROCESSING, (uint8_t)(p_inq->inqparms.mode & BTM_BR_INQUIRY_MASK));
                 }
             }
             else    /* Initiate the Inquiry or Periodic Inquiry */
             {
                 p_inq->state = BTM_INQ_ACTIVE_STATE;
-                p_inq->inqfilt_active = FALSE;
+                p_inq->inqfilt_active = false;
                 btm_initiate_inquiry (p_inq);
             }
         }
@@ -1800,12 +1800,12 @@
 
     if (p_inq->inq_active & BTM_SSP_INQUIRY_ACTIVE)
     {
-        btm_process_inq_complete (BTM_NO_RESOURCES, (UINT8)(p_inqparms->mode & BTM_BR_INQUIRY_MASK));
+        btm_process_inq_complete (BTM_NO_RESOURCES, (uint8_t)(p_inqparms->mode & BTM_BR_INQUIRY_MASK));
         return;
     }
 
     /* Make sure the number of responses doesn't overflow the database configuration */
-    p_inqparms->max_resps = (UINT8)((p_inqparms->max_resps <= BTM_INQ_DB_SIZE) ? p_inqparms->max_resps : BTM_INQ_DB_SIZE);
+    p_inqparms->max_resps = (uint8_t)((p_inqparms->max_resps <= BTM_INQ_DB_SIZE) ? p_inqparms->max_resps : BTM_INQ_DB_SIZE);
 
     lap = (p_inq->inq_active & BTM_LIMITED_INQUIRY_ACTIVE) ? &limited_inq_lap : &general_inq_lap;
 
@@ -1815,7 +1815,7 @@
                                       p_inq->per_min_delay,
                                       *lap, p_inqparms->duration,
                                       p_inqparms->max_resps))
-            btm_process_inq_complete (BTM_NO_RESOURCES, (UINT8)(p_inqparms->mode & BTM_BR_INQUIRY_MASK));
+            btm_process_inq_complete (BTM_NO_RESOURCES, (uint8_t)(p_inqparms->mode & BTM_BR_INQUIRY_MASK));
     }
     else
     {
@@ -1823,10 +1823,10 @@
 
         /* Allocate memory to hold bd_addrs responding */
         p_inq->p_bd_db = (tINQ_BDADDR *)osi_calloc(BT_DEFAULT_BUFFER_SIZE);
-        p_inq->max_bd_entries = (UINT16)(BT_DEFAULT_BUFFER_SIZE / sizeof(tINQ_BDADDR));
+        p_inq->max_bd_entries = (uint16_t)(BT_DEFAULT_BUFFER_SIZE / sizeof(tINQ_BDADDR));
 
         if (!btsnd_hcic_inquiry(*lap, p_inqparms->duration, 0))
-            btm_process_inq_complete (BTM_NO_RESOURCES, (UINT8)(p_inqparms->mode & BTM_BR_INQUIRY_MASK));
+            btm_process_inq_complete (BTM_NO_RESOURCES, (uint8_t)(p_inqparms->mode & BTM_BR_INQUIRY_MASK));
     }
 }
 
@@ -1845,24 +1845,24 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_process_inq_results (UINT8 *p, UINT8 inq_res_mode)
+void btm_process_inq_results (uint8_t *p, uint8_t inq_res_mode)
 {
-    UINT8            num_resp, xx;
+    uint8_t          num_resp, xx;
     BD_ADDR          bda;
     tINQ_DB_ENT     *p_i;
     tBTM_INQ_RESULTS *p_cur=NULL;
-    BOOLEAN          is_new = TRUE;
-    BOOLEAN          update = FALSE;
-    INT8             i_rssi;
+    bool             is_new = true;
+    bool             update = false;
+    int8_t           i_rssi;
     tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
     tBTM_INQ_RESULTS_CB *p_inq_results_cb = p_inq->p_inq_results_cb;
-    UINT8            page_scan_rep_mode = 0;
-    UINT8            page_scan_per_mode = 0;
-    UINT8            page_scan_mode = 0;
-    UINT8            rssi = 0;
+    uint8_t          page_scan_rep_mode = 0;
+    uint8_t          page_scan_per_mode = 0;
+    uint8_t          page_scan_mode = 0;
+    uint8_t          rssi = 0;
     DEV_CLASS        dc;
-    UINT16           clock_offset;
-    UINT8            *p_eir_data = NULL;
+    uint16_t         clock_offset;
+    uint8_t          *p_eir_data = NULL;
 
 #if (BTM_INQ_DEBUG == TRUE)
     BTM_TRACE_DEBUG ("btm_process_inq_results inq_active:0x%x state:%d inqfilt_active:%d",
@@ -1882,7 +1882,7 @@
 
     for (xx = 0; xx < num_resp; xx++)
     {
-        update = FALSE;
+        update = false;
         /* Extract inquiry results */
         STREAM_TO_BDADDR   (bda, p);
         STREAM_TO_UINT8    (page_scan_rep_mode, p);
@@ -1909,7 +1909,7 @@
         */
         if (p_inq->inqparms.max_resps &&
             p_inq->inq_cmpl_info.num_resp >= p_inq->inqparms.max_resps
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             /* new device response */
             && ( p_i == NULL ||
                 /* exisiting device with BR/EDR info */
@@ -1929,12 +1929,12 @@
 /*             BTM_TRACE_DEBUG("BDA seen before [%02x%02x %02x%02x %02x%02x]",
                              bda[0], bda[1], bda[2], bda[3], bda[4], bda[5]);*/
              /* By default suppose no update needed */
-            i_rssi = (INT8)rssi;
+            i_rssi = (int8_t)rssi;
 
             /* If this new RSSI is higher than the last one */
             if(p_inq->inqparms.report_dup && (rssi != 0) &&
                p_i && (i_rssi > p_i->inq_info.results.rssi || p_i->inq_info.results.rssi == 0
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
                /* BR/EDR inquiry information update */
                        || (p_i->inq_info.results.device_type & BT_DEVICE_TYPE_BREDR) != 0
 #endif
@@ -1943,14 +1943,14 @@
                 p_cur = &p_i->inq_info.results;
                 BTM_TRACE_DEBUG("update RSSI new:%d, old:%d", i_rssi, p_cur->rssi);
                 p_cur->rssi = i_rssi;
-                update = TRUE;
+                update = true;
             }
             /* If we received a second Extended Inq Event for an already */
             /* discovered device, this is because for the first one EIR was not received */
             else if ((inq_res_mode == BTM_INQ_RESULT_EXTENDED) && (p_i))
             {
                 p_cur = &p_i->inq_info.results;
-                update = TRUE;
+                update = true;
             }
             /* If no update needed continue with next response (if any) */
             else
@@ -1961,7 +1961,7 @@
         if (p_i == NULL)
         {
             p_i = btm_inq_db_new (bda);
-            is_new = TRUE;
+            is_new = true;
         }
 
         /* If an entry for the device already exists, overwrite it ONLY if it is from
@@ -1969,19 +1969,19 @@
            inquiry.
         */
         else if (p_i->inq_count == p_inq->inq_counter
-#if (BLE_INCLUDED == TRUE )
+#if (BLE_INCLUDED == TRUE)
             && (p_i->inq_info.results.device_type == BT_DEVICE_TYPE_BREDR)
 #endif
             )
-            is_new = FALSE;
+            is_new = false;
 
         /* keep updating RSSI to have latest value */
         if( inq_res_mode != BTM_INQ_RESULT_STANDARD )
-            p_i->inq_info.results.rssi = (INT8)rssi;
+            p_i->inq_info.results.rssi = (int8_t)rssi;
         else
             p_i->inq_info.results.rssi = BTM_INQ_RES_IGNORE_RSSI;
 
-        if (is_new == TRUE)
+        if (is_new == true)
         {
             /* Save the info */
             p_cur = &p_i->inq_info.results;
@@ -1998,12 +1998,12 @@
             if (p_i->inq_count != p_inq->inq_counter)
                 p_inq->inq_cmpl_info.num_resp++;       /* A new response was found */
 
-#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
+#if (BLE_INCLUDED == TRUE)
             p_cur->inq_result_type    = BTM_INQ_RESULT_BR;
             if (p_i->inq_count != p_inq->inq_counter)
             {
                 p_cur->device_type  = BT_DEVICE_TYPE_BREDR;
-                p_i->scan_rsp       = FALSE;
+                p_i->scan_rsp       = false;
             }
             else
                 p_cur->device_type    |= BT_DEVICE_TYPE_BREDR;
@@ -2014,7 +2014,7 @@
             if (!(p_inq->inq_active & BTM_PERIODIC_INQUIRY_ACTIVE) &&
                 p_inq->inqparms.max_resps &&
                 p_inq->inq_cmpl_info.num_resp == p_inq->inqparms.max_resps
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
                 /* BLE scanning is active and received adv */
                 && ((((p_inq->inqparms.mode & BTM_BLE_INQUIRY_MASK) != 0) &&
                      p_cur->device_type == BT_DEVICE_TYPE_DUMO && p_i->scan_rsp) ||
@@ -2025,14 +2025,14 @@
 /*                BTM_TRACE_DEBUG("BTMINQ: Found devices, cancelling inquiry..."); */
                 btsnd_hcic_inq_cancel();
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
                 if ((p_inq->inqparms.mode & BTM_BLE_INQUIRY_MASK) != 0)
                     btm_ble_stop_inquiry();
 #endif
                 btm_acl_update_busy_level (BTM_BLI_INQ_DONE_EVT);
             }
-            /* Initialize flag to FALSE. This flag is set/used by application */
-            p_i->inq_info.appl_knows_rem_name = FALSE;
+            /* Initialize flag to false. This flag is set/used by application */
+            p_i->inq_info.appl_knows_rem_name = false;
         }
 
         if (is_new || update)
@@ -2067,7 +2067,7 @@
 *******************************************************************************/
 void btm_sort_inq_result(void)
 {
-    UINT8 xx, yy, num_resp;
+    uint8_t xx, yy, num_resp;
     tINQ_DB_ENT *p_ent  = btm_cb.btm_inq_vars.inq_db;
     tINQ_DB_ENT *p_next = btm_cb.btm_inq_vars.inq_db+1;
     int size;
@@ -2103,12 +2103,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_process_inq_complete (UINT8 status, UINT8 mode)
+void btm_process_inq_complete (uint8_t status, uint8_t mode)
 {
     tBTM_CMPL_CB        *p_inq_cb = btm_cb.btm_inq_vars.p_inq_cmpl_cb;
     tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
 
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
     /* inquiry inactive case happens when inquiry is cancelled.
        Make mode 0 for no further inquiries from the current inquiry process
     */
@@ -2122,7 +2122,7 @@
     }
 #endif
 
-#if (!defined(BTA_HOST_INTERLEAVE_SEARCH) || BTA_HOST_INTERLEAVE_SEARCH == FALSE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == FALSE)
     p_inq->inqparms.mode &= ~(mode);
 #endif
 
@@ -2148,7 +2148,7 @@
         /* Notify caller that the inquiry has completed; (periodic inquiries do not send completion events */
         if (!(p_inq->inq_active & BTM_PERIODIC_INQUIRY_ACTIVE) && p_inq->inqparms.mode == 0)
         {
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             btm_clear_all_pending_le_entry();
 #endif
             p_inq->state = BTM_INQ_INACTIVE_STATE;
@@ -2176,7 +2176,7 @@
             if (p_inq_cb)
                 (p_inq_cb)((tBTM_INQUIRY_CMPL *) &p_inq->inq_cmpl_info);
         }
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
         if(p_inq->inqparms.mode != 0 && !(p_inq->inq_active & BTM_PERIODIC_INQUIRY_ACTIVE))
         {
             /* make inquiry inactive for next iteration */
@@ -2189,7 +2189,7 @@
     if(p_inq->inqparms.mode == 0 && p_inq->scan_type == INQ_GENERAL)//this inquiry is complete
     {
         p_inq->scan_type = INQ_NONE;
-#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
+#if (BLE_INCLUDED == TRUE)
         /* check if the LE observe is pending */
         if(p_inq->p_inq_ble_results_cb != NULL)
         {
@@ -2216,7 +2216,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_process_cancel_complete(UINT8 status, UINT8 mode)
+void btm_process_cancel_complete(uint8_t status, uint8_t mode)
 {
      btm_acl_update_busy_level (BTM_BLI_INQ_CANCEL_EVT);
      btm_process_inq_complete(status, mode);
@@ -2242,11 +2242,11 @@
 **
 *******************************************************************************/
 tBTM_STATUS  btm_initiate_rem_name (BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur,
-                                    UINT8 origin, period_ms_t timeout_ms,
+                                    uint8_t origin, period_ms_t timeout_ms,
                                     tBTM_CMPL_CB *p_cb)
 {
     tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
-    BOOLEAN              cmd_ok;
+    bool                 cmd_ok;
 
 
     /*** Make sure the device is ready ***/
@@ -2286,7 +2286,7 @@
                 cmd_ok = btsnd_hcic_rmt_name_req (remote_bda,
                                          p_cur->results.page_scan_rep_mode,
                                          p_cur->results.page_scan_mode,
-                                         (UINT16)(p_cur->results.clock_offset |
+                                         (uint16_t)(p_cur->results.clock_offset |
                                                   BTM_CLOCK_OFFSET_VALID));
             }
             else /* Otherwise use defaults and mark the clock offset as invalid */
@@ -2296,7 +2296,7 @@
             }
             if (cmd_ok)
             {
-                p_inq->remname_active = TRUE;
+                p_inq->remname_active = true;
                 return BTM_CMD_STARTED;
             }
             else
@@ -2320,14 +2320,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_process_remote_name (BD_ADDR bda, BD_NAME bdn, UINT16 evt_len, UINT8 hci_status)
+void btm_process_remote_name (BD_ADDR bda, BD_NAME bdn, uint16_t evt_len, uint8_t hci_status)
 {
     tBTM_REMOTE_DEV_NAME    rem_name;
     tBTM_INQUIRY_VAR_ST    *p_inq = &btm_cb.btm_inq_vars;
     tBTM_CMPL_CB           *p_cb = p_inq->p_remname_cmpl_cb;
-    UINT8                  *p_n1;
+    uint8_t                *p_n1;
 
-    UINT16                 temp_evt_len;
+    uint16_t               temp_evt_len;
 
     if (bda != NULL)
     {
@@ -2343,12 +2343,12 @@
 
 
     /* If the inquire BDA and remote DBA are the same, then stop the timer and set the active to false */
-    if ((p_inq->remname_active ==TRUE)&&
+    if ((p_inq->remname_active ==true)&&
         (((bda != NULL) &&
         (memcmp(bda, p_inq->remname_bda,BD_ADDR_LEN)==0)) || bda == NULL))
 
     {
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         if (BTM_UseLeLink(p_inq->remname_bda))
         {
             if (hci_status == HCI_ERR_UNSPECIFIED)
@@ -2356,7 +2356,7 @@
         }
 #endif
         alarm_cancel(p_inq->remote_name_timer);
-        p_inq->remname_active = FALSE;
+        p_inq->remname_active = false;
          /* Clean up and return the status if the command was not successful */
          /* Note: If part of the inquiry, the name is not stored, and the    */
          /*       inquiry complete callback is called.                       */
@@ -2366,7 +2366,7 @@
             /* Copy the name from the data stream into the return structure */
             /* Note that even if it is not being returned, it is used as a  */
             /*      temporary buffer.                                       */
-            p_n1 = (UINT8 *)rem_name.remote_bd_name;
+            p_n1 = (uint8_t *)rem_name.remote_bd_name;
             rem_name.length = (evt_len < BD_NAME_LEN) ? evt_len : BD_NAME_LEN;
             rem_name.remote_bd_name[rem_name.length] = 0;
             rem_name.status = BTM_SUCCESS;
@@ -2451,7 +2451,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_inq_tx_power_complete(UINT8 *p)
+void btm_read_inq_tx_power_complete(uint8_t *p)
 {
     tBTM_CMPL_CB                *p_cb = btm_cb.devcb.p_inq_tx_power_cmpl_cb;
     tBTM_INQ_TXPWR_RESULTS        results;
@@ -2521,11 +2521,11 @@
 ** Returns          pointer of EIR data
 **
 *******************************************************************************/
-UINT8 *BTM_CheckEirData( UINT8 *p_eir, UINT8 type, UINT8 *p_length )
+uint8_t *BTM_CheckEirData( uint8_t *p_eir, uint8_t type, uint8_t *p_length )
 {
-    UINT8 *p = p_eir;
-    UINT8 length;
-    UINT8 eir_type;
+    uint8_t *p = p_eir;
+    uint8_t length;
+    uint8_t eir_type;
     BTM_TRACE_API("BTM_CheckEirData type=0x%02X", type);
 
     STREAM_TO_UINT8(length, p);
@@ -2558,9 +2558,9 @@
 **                  BTM_EIR_MAX_SERVICES - if not found
 **
 *******************************************************************************/
-static UINT8 btm_convert_uuid_to_eir_service( UINT16 uuid16 )
+static uint8_t btm_convert_uuid_to_eir_service( uint16_t uuid16 )
 {
-    UINT8 xx;
+    uint8_t xx;
 
     for( xx = 0; xx < BTM_EIR_MAX_SERVICES; xx++ )
     {
@@ -2581,19 +2581,19 @@
 ** Parameters       p_eir_uuid - bit map of UUID list
 **                  uuid16 - UUID 16-bit
 **
-** Returns          TRUE - if found
-**                  FALSE - if not found
+** Returns          true - if found
+**                  false - if not found
 **
 *******************************************************************************/
-BOOLEAN BTM_HasEirService( UINT32 *p_eir_uuid, UINT16 uuid16 )
+bool    BTM_HasEirService( uint32_t *p_eir_uuid, uint16_t uuid16 )
 {
-    UINT8 service_id;
+    uint8_t service_id;
 
     service_id = btm_convert_uuid_to_eir_service(uuid16);
     if( service_id < BTM_EIR_MAX_SERVICES )
         return( BTM_EIR_HAS_SERVICE( p_eir_uuid, service_id ));
     else
-        return( FALSE );
+        return( false );
 }
 
 /*******************************************************************************
@@ -2610,7 +2610,7 @@
 **                  BTM_EIR_UNKNOWN - if not found and it is not complete list
 **
 *******************************************************************************/
-tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService( tBTM_INQ_RESULTS *p_results, UINT16 uuid16 )
+tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService( tBTM_INQ_RESULTS *p_results, uint16_t uuid16 )
 {
     if( BTM_HasEirService( p_results->eir_uuid, uuid16 ))
     {
@@ -2636,9 +2636,9 @@
 ** Returns          None
 **
 *******************************************************************************/
-void BTM_AddEirService( UINT32 *p_eir_uuid, UINT16 uuid16 )
+void BTM_AddEirService( uint32_t *p_eir_uuid, uint16_t uuid16 )
 {
-    UINT8 service_id;
+    uint8_t service_id;
 
     service_id = btm_convert_uuid_to_eir_service(uuid16);
     if( service_id < BTM_EIR_MAX_SERVICES )
@@ -2657,9 +2657,9 @@
 ** Returns          None
 **
 *******************************************************************************/
-void BTM_RemoveEirService( UINT32 *p_eir_uuid, UINT16 uuid16 )
+void BTM_RemoveEirService( uint32_t *p_eir_uuid, uint16_t uuid16 )
 {
-    UINT8 service_id;
+    uint8_t service_id;
 
     service_id = btm_convert_uuid_to_eir_service(uuid16);
     if( service_id < BTM_EIR_MAX_SERVICES )
@@ -2681,10 +2681,10 @@
 **                  BTM_EIR_COMPLETE_16BITS_UUID_TYPE, otherwise
 **
 *******************************************************************************/
-UINT8 BTM_GetEirSupportedServices( UINT32 *p_eir_uuid,    UINT8 **p,
-                                   UINT8  max_num_uuid16, UINT8 *p_num_uuid16)
+uint8_t BTM_GetEirSupportedServices( uint32_t *p_eir_uuid,    uint8_t **p,
+                                   uint8_t max_num_uuid16, uint8_t *p_num_uuid16)
 {
-    UINT8 service_index;
+    uint8_t service_index;
 
     *p_num_uuid16 = 0;
 
@@ -2728,14 +2728,14 @@
 **                  BTM_EIR_MORE_128BITS_UUID_TYPE
 **
 *******************************************************************************/
-UINT8 BTM_GetEirUuidList( UINT8 *p_eir, UINT8 uuid_size, UINT8 *p_num_uuid,
-                            UINT8 *p_uuid_list, UINT8 max_num_uuid)
+uint8_t BTM_GetEirUuidList( uint8_t *p_eir, uint8_t uuid_size, uint8_t *p_num_uuid,
+                            uint8_t *p_uuid_list, uint8_t max_num_uuid)
 {
-    UINT8   *p_uuid_data;
-    UINT8   type;
-    UINT8   yy, xx;
-    UINT16  *p_uuid16 = (UINT16 *)p_uuid_list;
-    UINT32  *p_uuid32 = (UINT32 *)p_uuid_list;
+    uint8_t *p_uuid_data;
+    uint8_t type;
+    uint8_t yy, xx;
+    uint16_t *p_uuid16 = (uint16_t *)p_uuid_list;
+    uint32_t *p_uuid32 = (uint32_t *)p_uuid_list;
     char    buff[LEN_UUID_128 * 2 + 1];
 
     p_uuid_data = btm_eir_get_uuid_list( p_eir, uuid_size, p_num_uuid, &type );
@@ -2799,12 +2799,12 @@
 **                  beginning of UUID list in EIR - otherwise
 **
 *******************************************************************************/
-static UINT8 *btm_eir_get_uuid_list( UINT8 *p_eir, UINT8 uuid_size,
-                                     UINT8 *p_num_uuid, UINT8 *p_uuid_list_type )
+static uint8_t *btm_eir_get_uuid_list( uint8_t *p_eir, uint8_t uuid_size,
+                                     uint8_t *p_num_uuid, uint8_t *p_uuid_list_type )
 {
-    UINT8   *p_uuid_data;
-    UINT8   complete_type, more_type;
-    UINT8   uuid_len;
+    uint8_t *p_uuid_data;
+    uint8_t complete_type, more_type;
+    uint8_t uuid_len;
 
     switch( uuid_size )
     {
@@ -2854,14 +2854,14 @@
 **                  UUID 16-bit - otherwise
 **
 *******************************************************************************/
-static UINT16 btm_convert_uuid_to_uuid16( UINT8 *p_uuid, UINT8 uuid_size )
+static uint16_t btm_convert_uuid_to_uuid16( uint8_t *p_uuid, uint8_t uuid_size )
 {
-    static const UINT8  base_uuid[LEN_UUID_128] = {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
+    static const uint8_t base_uuid[LEN_UUID_128] = {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
                                                    0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-    UINT16 uuid16 = 0;
-    UINT32 uuid32;
-    BOOLEAN is_base_uuid;
-    UINT8  xx;
+    uint16_t uuid16 = 0;
+    uint32_t uuid32;
+    bool    is_base_uuid;
+    uint8_t xx;
 
     switch (uuid_size)
     {
@@ -2871,16 +2871,16 @@
     case LEN_UUID_32:
         STREAM_TO_UINT32 (uuid32, p_uuid);
         if (uuid32 < 0x10000)
-            uuid16 = (UINT16) uuid32;
+            uuid16 = (uint16_t) uuid32;
         break;
     case LEN_UUID_128:
         /* See if we can compress his UUID down to 16 or 32bit UUIDs */
-        is_base_uuid = TRUE;
+        is_base_uuid = true;
         for (xx = 0; xx < LEN_UUID_128 - 4; xx++)
         {
             if (p_uuid[xx] != base_uuid[xx])
             {
-                is_base_uuid = FALSE;
+                is_base_uuid = false;
                 break;
             }
         }
@@ -2913,23 +2913,23 @@
 ** Returns          None
 **
 *******************************************************************************/
-void btm_set_eir_uuid( UINT8 *p_eir, tBTM_INQ_RESULTS *p_results )
+void btm_set_eir_uuid( uint8_t *p_eir, tBTM_INQ_RESULTS *p_results )
 {
-    UINT8   *p_uuid_data;
-    UINT8   num_uuid;
-    UINT16  uuid16;
-    UINT8   yy;
-    UINT8   type = BTM_EIR_MORE_16BITS_UUID_TYPE;
+    uint8_t *p_uuid_data;
+    uint8_t num_uuid;
+    uint16_t uuid16;
+    uint8_t yy;
+    uint8_t type = BTM_EIR_MORE_16BITS_UUID_TYPE;
 
     p_uuid_data = btm_eir_get_uuid_list( p_eir, LEN_UUID_16, &num_uuid, &type );
 
     if(type == BTM_EIR_COMPLETE_16BITS_UUID_TYPE)
     {
-        p_results->eir_complete_list = TRUE;
+        p_results->eir_complete_list = true;
     }
     else
     {
-        p_results->eir_complete_list = FALSE;
+        p_results->eir_complete_list = false;
     }
 
     BTM_TRACE_API("btm_set_eir_uuid eir_complete_list=0x%02X", p_results->eir_complete_list);
diff --git a/stack/btm/btm_int.h b/stack/btm/btm_int.h
index d0b2cd5..f81656f 100644
--- a/stack/btm/btm_int.h
+++ b/stack/btm/btm_int.h
@@ -75,7 +75,7 @@
 
 #define BTM_EPR_AVAILABLE(p) ((HCI_ATOMIC_ENCRYPT_SUPPORTED((p)->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0]) && \
                                HCI_ATOMIC_ENCRYPT_SUPPORTED(controller_get_interface()->get_features_classic(0)->as_array)) \
-                               ? TRUE : FALSE)
+                               ? true : false)
 
 #define BTM_IS_BRCM_CONTROLLER() (controller_get_interface()->get_bt_version()->manufacturer == LMP_COMPID_BROADCOM)
 
@@ -83,23 +83,23 @@
 */
 typedef struct
 {
-    UINT16          hci_handle;
-    UINT16          pkt_types_mask;
-    UINT16          clock_offset;
+    uint16_t        hci_handle;
+    uint16_t        pkt_types_mask;
+    uint16_t        clock_offset;
     BD_ADDR         remote_addr;
     DEV_CLASS       remote_dc;
     BD_NAME         remote_name;
 
-    UINT16          manufacturer;
-    UINT16          lmp_subversion;
-    UINT16          link_super_tout;
+    uint16_t        manufacturer;
+    uint16_t        lmp_subversion;
+    uint16_t        link_super_tout;
     BD_FEATURES     peer_lmp_features[HCI_EXT_FEATURES_PAGE_MAX + 1];    /* Peer LMP Extended features mask table for the device */
-    UINT8           num_read_pages;
-    UINT8           lmp_version;
+    uint8_t         num_read_pages;
+    uint8_t         lmp_version;
 
-    BOOLEAN         in_use;
-    UINT8           link_role;
-    BOOLEAN         link_up_issued;     /* True if busy_level link up has been issued */
+    bool            in_use;
+    uint8_t         link_role;
+    bool            link_up_issued;     /* True if busy_level link up has been issued */
 
 #define BTM_ACL_SWKEY_STATE_IDLE                0
 #define BTM_ACL_SWKEY_STATE_MODE_CHANGE         1
@@ -107,20 +107,20 @@
 #define BTM_ACL_SWKEY_STATE_SWITCHING           3
 #define BTM_ACL_SWKEY_STATE_ENCRYPTION_ON       4
 #define BTM_ACL_SWKEY_STATE_IN_PROGRESS         5
-    UINT8           switch_role_state;
+    uint8_t         switch_role_state;
 
 #define BTM_ACL_ENCRYPT_STATE_IDLE              0
 #define BTM_ACL_ENCRYPT_STATE_ENCRYPT_OFF       1   /* encryption turning off */
 #define BTM_ACL_ENCRYPT_STATE_TEMP_FUNC         2   /* temporarily off for change link key or role switch */
 #define BTM_ACL_ENCRYPT_STATE_ENCRYPT_ON        3   /* encryption turning on */
-    UINT8           encrypt_state;                  /* overall BTM encryption state */
+    uint8_t         encrypt_state;                  /* overall BTM encryption state */
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     tBT_TRANSPORT   transport;
     BD_ADDR         conn_addr;              /* local device address used for this connection */
-    UINT8           conn_addr_type;         /* local device address type for this connection */
+    uint8_t         conn_addr_type;         /* local device address type for this connection */
     BD_ADDR         active_remote_addr;     /* remote address used on this connection */
-    UINT8           active_remote_addr_type;         /* local device address type for this connection */
+    uint8_t         active_remote_addr_type;         /* local device address type for this connection */
     BD_FEATURES     peer_le_features;       /* Peer LE Used features mask for the device */
 
 #endif
@@ -163,7 +163,7 @@
 
     DEV_CLASS            dev_class;         /* Local device class                   */
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
     tBTM_CMPL_CB        *p_le_test_cmd_cmpl_cb;   /* Callback function to be called when
                                                   LE test mode command has been sent successfully */
@@ -171,24 +171,24 @@
     BD_ADDR                 read_tx_pwr_addr;   /* read TX power target address     */
 
 #define BTM_LE_SUPPORT_STATE_SIZE   8
-UINT8                   le_supported_states[BTM_LE_SUPPORT_STATE_SIZE];
+uint8_t                 le_supported_states[BTM_LE_SUPPORT_STATE_SIZE];
 
 tBTM_BLE_LOCAL_ID_KEYS id_keys; /* local BLE ID keys */
 BT_OCTET16 ble_encryption_key_value; /* BLE encryption key */
 
-#if BTM_BLE_CONFORMANCE_TESTING == TRUE
-    BOOLEAN                 no_disc_if_pair_fail;
-    BOOLEAN                 enable_test_mac_val;
+#if (BTM_BLE_CONFORMANCE_TESTING == TRUE)
+    bool                    no_disc_if_pair_fail;
+    bool                    enable_test_mac_val;
     BT_OCTET8               test_mac;
-    BOOLEAN                 enable_test_local_sign_cntr;
-    UINT32                  test_local_sign_cntr;
+    bool                    enable_test_local_sign_cntr;
+    uint32_t                test_local_sign_cntr;
 #endif
 
 #endif  /* BLE_INCLUDED */
 
     tBTM_IO_CAP          loc_io_caps;       /* IO capability of the local device */
     tBTM_AUTH_REQ        loc_auth_req;      /* the auth_req flag  */
-    BOOLEAN              secure_connections_only;    /* Rejects service level 0 connections if */
+    bool                 secure_connections_only;    /* Rejects service level 0 connections if */
                                                      /* itself or peer device doesn't support */
                                                      /* secure connections */
 } tBTM_DEVCB;
@@ -210,7 +210,7 @@
 
 typedef struct
 {
-    UINT32          inq_count;          /* Used for determining if a response has already been      */
+    uint32_t        inq_count;          /* Used for determining if a response has already been      */
                                         /* received for the current inquiry operation. (We do not   */
                                         /* want to flood the caller with multiple responses from    */
                                         /* the same device.                                         */
@@ -219,17 +219,17 @@
 
 typedef struct
 {
-    UINT32          time_of_resp;
-    UINT32          inq_count;          /* "timestamps" the entry with a particular inquiry count   */
+    uint32_t        time_of_resp;
+    uint32_t        inq_count;          /* "timestamps" the entry with a particular inquiry count   */
                                         /* Used for determining if a response has already been      */
                                         /* received for the current inquiry operation. (We do not   */
                                         /* want to flood the caller with multiple responses from    */
                                         /* the same device.                                         */
     tBTM_INQ_INFO   inq_info;
-    BOOLEAN         in_use;
+    bool            in_use;
 
 #if (BLE_INCLUDED == TRUE)
-    BOOLEAN         scan_rsp;
+    bool            scan_rsp;
 #endif
 } tINQ_DB_ENT;
 
@@ -240,7 +240,7 @@
     INQ_LE_OBSERVE,
     INQ_GENERAL
 };
-typedef UINT8 tBTM_INQ_TYPE;
+typedef uint8_t tBTM_INQ_TYPE;
 
 typedef struct
 {
@@ -251,14 +251,14 @@
 
     alarm_t         *remote_name_timer;
 
-    UINT16           discoverable_mode;
-    UINT16           connectable_mode;
-    UINT16           page_scan_window;
-    UINT16           page_scan_period;
-    UINT16           inq_scan_window;
-    UINT16           inq_scan_period;
-    UINT16           inq_scan_type;
-    UINT16           page_scan_type;        /* current page scan type */
+    uint16_t         discoverable_mode;
+    uint16_t         connectable_mode;
+    uint16_t         page_scan_window;
+    uint16_t         page_scan_period;
+    uint16_t         inq_scan_window;
+    uint16_t         inq_scan_period;
+    uint16_t         inq_scan_type;
+    uint16_t         page_scan_type;        /* current page scan type */
     tBTM_INQ_TYPE    scan_type;
 
     BD_ADDR          remname_bda;           /* Name of bd addr for active remote name request */
@@ -266,29 +266,29 @@
 #define BTM_RMT_NAME_EXT            0x1     /* Initiated through API */
 #define BTM_RMT_NAME_SEC            0x2     /* Initiated internally by security manager */
 #define BTM_RMT_NAME_INQ            0x4     /* Remote name initiated internally by inquiry */
-    BOOLEAN          remname_active;        /* State of a remote name request by external API */
+    bool             remname_active;        /* State of a remote name request by external API */
 
     tBTM_CMPL_CB    *p_inq_cmpl_cb;
     tBTM_INQ_RESULTS_CB *p_inq_results_cb;
     tBTM_CMPL_CB    *p_inq_ble_cmpl_cb;     /*completion callback exclusively for LE Observe*/
     tBTM_INQ_RESULTS_CB *p_inq_ble_results_cb;/*results callback exclusively for LE observe*/
     tBTM_CMPL_CB    *p_inqfilter_cmpl_cb;   /* Called (if not NULL) after inquiry filter completed */
-    UINT32           inq_counter;           /* Counter incremented each time an inquiry completes */
+    uint32_t         inq_counter;           /* Counter incremented each time an inquiry completes */
                                             /* Used for determining whether or not duplicate devices */
                                             /* have responded to the same inquiry */
     tINQ_BDADDR     *p_bd_db;               /* Pointer to memory that holds bdaddrs */
-    UINT16           num_bd_entries;        /* Number of entries in database */
-    UINT16           max_bd_entries;        /* Maximum number of entries that can be stored */
+    uint16_t         num_bd_entries;        /* Number of entries in database */
+    uint16_t         max_bd_entries;        /* Maximum number of entries that can be stored */
     tINQ_DB_ENT      inq_db[BTM_INQ_DB_SIZE];
     tBTM_INQ_PARMS   inqparms;              /* Contains the parameters for the current inquiry */
     tBTM_INQUIRY_CMPL inq_cmpl_info;        /* Status and number of responses from the last inquiry */
 
-    UINT16           per_min_delay;         /* Current periodic minimum delay */
-    UINT16           per_max_delay;         /* Current periodic maximum delay */
-    BOOLEAN          inqfilt_active;
-    UINT8            pending_filt_complete_event; /* to take care of btm_event_filter_complete corresponding to */
+    uint16_t         per_min_delay;         /* Current periodic minimum delay */
+    uint16_t         per_max_delay;         /* Current periodic maximum delay */
+    bool             inqfilt_active;
+    uint8_t          pending_filt_complete_event; /* to take care of btm_event_filter_complete corresponding to */
                                                   /* inquiry that has been cancelled*/
-    UINT8            inqfilt_type;          /* Contains the inquiry filter type (BD ADDR, COD, or Clear) */
+    uint8_t          inqfilt_type;          /* Contains the inquiry filter type (BD ADDR, COD, or Clear) */
 
 #define BTM_INQ_INACTIVE_STATE      0
 #define BTM_INQ_CLR_FILT_STATE      1   /* Currently clearing the inquiry filter preceeding the inquiry request */
@@ -297,15 +297,15 @@
 #define BTM_INQ_ACTIVE_STATE        3   /* Actual inquiry or periodic inquiry is in progress */
 #define BTM_INQ_REMNAME_STATE       4   /* Remote name requests are active  */
 
-    UINT8            state;             /* Current state that the inquiry process is in */
-    UINT8            inq_active;        /* Bit Mask indicating type of inquiry is active */
-    BOOLEAN          no_inc_ssp;        /* TRUE, to stop inquiry on incoming SSP */
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+    uint8_t          state;             /* Current state that the inquiry process is in */
+    uint8_t          inq_active;        /* Bit Mask indicating type of inquiry is active */
+    bool             no_inc_ssp;        /* true, to stop inquiry on incoming SSP */
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
     btm_inq_state    next_state;        /*interleaving state to determine next mode to be inquired*/
 #endif
 } tBTM_INQUIRY_VAR_ST;
 
-/* The MSB of the clock offset field indicates that the offset is valid if TRUE */
+/* The MSB of the clock offset field indicates that the offset is valid if true */
 #define BTM_CLOCK_OFFSET_VALID      0x8000
 
 /* Define the structures needed by security management
@@ -313,7 +313,7 @@
 
 #define BTM_SEC_INVALID_HANDLE  0xFFFF
 
-typedef UINT8 *BTM_BD_NAME_PTR;                        /* Pointer to Device name */
+typedef uint8_t *BTM_BD_NAME_PTR;                        /* Pointer to Device name */
 
 /* Security callback is called by this unit when security
 **   procedures are completed.  Parameters are
@@ -322,7 +322,7 @@
 */
 typedef tBTM_SEC_CBACK tBTM_SEC_CALLBACK;
 
-typedef void (tBTM_SCO_IND_CBACK) (UINT16 sco_inx) ;
+typedef void (tBTM_SCO_IND_CBACK) (uint16_t sco_inx) ;
 
 /* MACROs to convert from SCO packet types mask to ESCO and back */
 #define BTM_SCO_PKT_TYPE_MASK   (   HCI_PKT_TYPES_MASK_HV1      \
@@ -334,8 +334,8 @@
                                  |  HCI_ESCO_PKT_TYPES_MASK_HV2 \
                                  |  HCI_ESCO_PKT_TYPES_MASK_HV3)
 
-#define BTM_SCO_2_ESCO(scotype)  ((UINT16)(((scotype) & BTM_SCO_PKT_TYPE_MASK) >> 5))
-#define BTM_ESCO_2_SCO(escotype) ((UINT16)(((escotype) & BTM_ESCO_PKT_TYPE_MASK) << 5))
+#define BTM_SCO_2_ESCO(scotype)  ((uint16_t)(((scotype) & BTM_SCO_PKT_TYPE_MASK) >> 5))
+#define BTM_ESCO_2_SCO(escotype) ((uint16_t)(((escotype) & BTM_ESCO_PKT_TYPE_MASK) << 5))
 
 /* Define masks for supported and exception 2.0 SCO packet types
 */
@@ -360,7 +360,7 @@
     tBTM_ESCO_CBACK    *p_esco_cback;   /* Callback for eSCO events     */
     tBTM_ESCO_PARAMS    setup;
     tBTM_ESCO_DATA      data;           /* Connection complete information */
-    UINT8               hci_status;
+    uint8_t             hci_status;
 } tBTM_ESCO_INFO;
 
 /* Define the structure used for SCO Management
@@ -368,15 +368,15 @@
 typedef struct
 {
     tBTM_ESCO_INFO   esco;              /* Current settings             */
-#if BTM_SCO_HCI_INCLUDED == TRUE
+#if (BTM_SCO_HCI_INCLUDED == TRUE)
     fixed_queue_t   *xmit_data_q;       /* SCO data transmitting queue  */
 #endif
     tBTM_SCO_CB     *p_conn_cb;         /* Callback for when connected  */
     tBTM_SCO_CB     *p_disc_cb;         /* Callback for when disconnect */
-    UINT16           state;             /* The state of the SCO link    */
-    UINT16           hci_handle;        /* HCI Handle                   */
-    BOOLEAN          is_orig;           /* TRUE if the originator       */
-    BOOLEAN          rem_bd_known;      /* TRUE if remote BD addr known */
+    uint16_t         state;             /* The state of the SCO link    */
+    uint16_t         hci_handle;        /* HCI Handle                   */
+    bool             is_orig;           /* true if the originator       */
+    bool             rem_bd_known;      /* true if remote BD addr known */
 
 } tSCO_CONN;
 
@@ -384,33 +384,33 @@
 typedef struct
 {
     tBTM_SCO_IND_CBACK  *app_sco_ind_cb;
-#if BTM_SCO_HCI_INCLUDED == TRUE
+#if (BTM_SCO_HCI_INCLUDED == TRUE)
     tBTM_SCO_DATA_CB     *p_data_cb;        /* Callback for SCO data over HCI */
-    UINT32               xmit_window_size; /* Total SCO window in bytes  */
+    uint32_t             xmit_window_size; /* Total SCO window in bytes  */
 #endif
     tSCO_CONN            sco_db[BTM_MAX_SCO_LINKS];
     tBTM_ESCO_PARAMS     def_esco_parms;
     BD_ADDR              xfer_addr;
-    UINT16               sco_disc_reason;
-    BOOLEAN              esco_supported;    /* TRUE if 1.2 cntlr AND supports eSCO links */
+    uint16_t             sco_disc_reason;
+    bool                 esco_supported;    /* true if 1.2 cntlr AND supports eSCO links */
     tBTM_SCO_TYPE        desired_sco_mode;
     tBTM_SCO_TYPE        xfer_sco_type;
     tBTM_SCO_PCM_PARAM   sco_pcm_param;
     tBTM_SCO_CODEC_TYPE  codec_in_use;      /* None, CVSD, MSBC, etc. */
-#if BTM_SCO_HCI_INCLUDED == TRUE
+#if (BTM_SCO_HCI_INCLUDED == TRUE)
     tBTM_SCO_ROUTE_TYPE  sco_path;
 #endif
 
 } tSCO_CB;
 
 
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
 extern void     btm_set_sco_ind_cback( tBTM_SCO_IND_CBACK *sco_ind_cb );
-extern void     btm_accept_sco_link(UINT16 sco_inx, tBTM_ESCO_PARAMS *p_setup,
+extern void     btm_accept_sco_link(uint16_t sco_inx, tBTM_ESCO_PARAMS *p_setup,
                                     tBTM_SCO_CB *p_conn_cb, tBTM_SCO_CB *p_disc_cb);
-extern void     btm_reject_sco_link(UINT16 sco_inx );
-extern void btm_sco_chk_pend_rolechange (UINT16 hci_handle);
-extern void btm_sco_disc_chk_pend_for_modechange (UINT16 hci_handle);
+extern void     btm_reject_sco_link(uint16_t sco_inx );
+extern void btm_sco_chk_pend_rolechange (uint16_t hci_handle);
+extern void btm_sco_disc_chk_pend_for_modechange (uint16_t hci_handle);
 
 #else
 #define btm_accept_sco_link(sco_inx, p_setup, p_conn_cb, p_disc_cb)
@@ -433,22 +433,22 @@
                                     BTM_SEC_IN_MITM | BTM_SEC_MODE4_LEVEL4)
 typedef struct
 {
-    UINT32          mx_proto_id;        /* Service runs over this multiplexer protocol */
-    UINT32          orig_mx_chan_id;    /* Channel on the multiplexer protocol    */
-    UINT32          term_mx_chan_id;    /* Channel on the multiplexer protocol    */
-    UINT16          psm;                /* L2CAP PSM value */
-    UINT16          security_flags;     /* Bitmap of required security features */
-    UINT8           service_id;         /* Passed in authorization callback */
+    uint32_t        mx_proto_id;        /* Service runs over this multiplexer protocol */
+    uint32_t        orig_mx_chan_id;    /* Channel on the multiplexer protocol    */
+    uint32_t        term_mx_chan_id;    /* Channel on the multiplexer protocol    */
+    uint16_t        psm;                /* L2CAP PSM value */
+    uint16_t        security_flags;     /* Bitmap of required security features */
+    uint8_t         service_id;         /* Passed in authorization callback */
 #if (L2CAP_UCD_INCLUDED == TRUE)
-    UINT16          ucd_security_flags; /* Bitmap of required security features for UCD */
+    uint16_t        ucd_security_flags; /* Bitmap of required security features for UCD */
 #endif
 #if BTM_SEC_SERVICE_NAME_LEN > 0
-    UINT8           orig_service_name[BTM_SEC_SERVICE_NAME_LEN + 1];
-    UINT8           term_service_name[BTM_SEC_SERVICE_NAME_LEN + 1];
+    uint8_t         orig_service_name[BTM_SEC_SERVICE_NAME_LEN + 1];
+    uint8_t         term_service_name[BTM_SEC_SERVICE_NAME_LEN + 1];
 #endif
 } tBTM_SEC_SERV_REC;
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 /* LE Security information of device in Slave Role */
 typedef struct
 {
@@ -460,15 +460,15 @@
     BT_OCTET16          lcsrk;          /* local SRK peer device used to secured sign local data  */
 
     BT_OCTET8           rand;           /* random vector for LTK generation */
-    UINT16              ediv;           /* LTK diversifier of this slave device */
-    UINT16              div;            /* local DIV  to generate local LTK=d1(ER,DIV,0) and CSRK=d1(ER,DIV,1)  */
-    UINT8               sec_level;      /* local pairing security level */
-    UINT8               key_size;       /* key size of the LTK delivered to peer device */
-    UINT8               srk_sec_level;  /* security property of peer SRK for this device */
-    UINT8               local_csrk_sec_level;  /* security property of local CSRK for this device */
+    uint16_t            ediv;           /* LTK diversifier of this slave device */
+    uint16_t            div;            /* local DIV  to generate local LTK=d1(ER,DIV,0) and CSRK=d1(ER,DIV,1)  */
+    uint8_t             sec_level;      /* local pairing security level */
+    uint8_t             key_size;       /* key size of the LTK delivered to peer device */
+    uint8_t             srk_sec_level;  /* security property of peer SRK for this device */
+    uint8_t             local_csrk_sec_level;  /* security property of local CSRK for this device */
 
-    UINT32              counter;        /* peer sign counter for verifying rcv signed cmd */
-    UINT32              local_counter;  /* local sign counter for sending signed write cmd*/
+    uint32_t            counter;        /* peer sign counter for verifying rcv signed cmd */
+    uint32_t            local_counter;  /* local sign counter for sending signed write cmd*/
 }tBTM_SEC_BLE_KEYS;
 
 typedef struct
@@ -480,18 +480,18 @@
 
 #define BTM_WHITE_LIST_BIT          0x01
 #define BTM_RESOLVING_LIST_BIT      0x02
-    UINT8               in_controller_list;   /* in controller resolving list or not */
-    UINT8               resolving_list_index;
-#if BLE_PRIVACY_SPT == TRUE
+    uint8_t             in_controller_list;   /* in controller resolving list or not */
+    uint8_t             resolving_list_index;
+#if (BLE_PRIVACY_SPT == TRUE)
     BD_ADDR             cur_rand_addr;  /* current random address */
 
 #define BTM_BLE_ADDR_PSEUDO         0   /* address index device record */
 #define BTM_BLE_ADDR_RRA            1   /* cur_rand_addr */
 #define BTM_BLE_ADDR_STATIC         2   /* static_addr  */
-    UINT8               active_addr_type;
+    uint8_t             active_addr_type;
 #endif
 
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
     tBTM_LE_KEY_TYPE    key_type;       /* bit mask of valid key types in record */
     tBTM_SEC_BLE_KEYS   keys;           /* LE device security info in slave rode */
 #endif
@@ -507,7 +507,7 @@
     BOND_TYPE_PERSISTENT,
     BOND_TYPE_TEMPORARY
 };
-typedef UINT8 tBTM_BOND_TYPE;
+typedef uint8_t tBTM_BOND_TYPE;
 
 /*
 ** Define structure for Security Device Record.
@@ -518,14 +518,14 @@
     tBTM_SEC_SERV_REC   *p_cur_service;
     tBTM_SEC_CALLBACK   *p_callback;
     void                *p_ref_data;
-    UINT32               timestamp;         /* Timestamp of the last connection   */
-    UINT32               trusted_mask[BTM_SEC_SERVICE_ARRAY_SIZE];  /* Bitwise OR of trusted services     */
-    UINT16               hci_handle;        /* Handle to connection when exists   */
-    UINT16               clock_offset;      /* Latest known clock offset          */
+    uint32_t             timestamp;         /* Timestamp of the last connection   */
+    uint32_t             trusted_mask[BTM_SEC_SERVICE_ARRAY_SIZE];  /* Bitwise OR of trusted services     */
+    uint16_t             hci_handle;        /* Handle to connection when exists   */
+    uint16_t             clock_offset;      /* Latest known clock offset          */
     BD_ADDR              bd_addr;           /* BD_ADDR of the device              */
     DEV_CLASS            dev_class;         /* DEV_CLASS of the device            */
     LINK_KEY             link_key;          /* Device link key                    */
-    UINT8                pin_code_length;   /* Length of the pin_code used for paring */
+    uint8_t              pin_code_length;   /* Length of the pin_code used for paring */
 
 #define BTM_SEC_AUTHORIZED      BTM_SEC_FLAG_AUTHORIZED     /* 0x01 */
 #define BTM_SEC_AUTHENTICATED   BTM_SEC_FLAG_AUTHENTICATED  /* 0x02 */
@@ -543,11 +543,11 @@
 #define BTM_SEC_LE_LINK_KEY_AUTHED 0x2000   /* pairing is done with MITM */
 #define BTM_SEC_16_DIGIT_PIN_AUTHED 0x4000   /* pairing is done with 16 digit pin */
 
-    UINT16           sec_flags;          /* Current device security state      */
+    uint16_t         sec_flags;          /* Current device security state      */
 
     tBTM_BD_NAME    sec_bd_name;        /* User friendly name of the device. (may be truncated to save space in dev_rec table) */
     BD_FEATURES     features[HCI_EXT_FEATURES_PAGE_MAX + 1];           /* Features supported by the device */
-    UINT8           num_read_pages;
+    uint8_t         num_read_pages;
 
 #define BTM_SEC_STATE_IDLE               0
 #define BTM_SEC_STATE_AUTHENTICATING     1
@@ -561,17 +561,17 @@
 #define BTM_SEC_STATE_DISCONNECTING_BLE  8 /* disconnecting BLE */
 #define BTM_SEC_STATE_DISCONNECTING_BOTH 9 /* disconnecting BR/EDR and BLE */
 
-    UINT8       sec_state;              /* Operating state                    */
-    BOOLEAN     is_originator;          /* TRUE if device is originating connection */
+    uint8_t     sec_state;              /* Operating state                    */
+    bool        is_originator;          /* true if device is originating connection */
 #if (L2CAP_UCD_INCLUDED == TRUE)
-    BOOLEAN     is_ucd;                 /* TRUE if device is sending or receiving UCD */
+    bool        is_ucd;                 /* true if device is sending or receiving UCD */
                                         /* if incoming security failed, received UCD will be discarded */
 #endif
-    BOOLEAN     role_master;            /* TRUE if current mode is master     */
-    UINT16      security_required;      /* Security required for connection   */
-    BOOLEAN     link_key_not_sent;      /* link key notification has not been sent waiting for name */
-    UINT8       link_key_type;          /* Type of key used in pairing   */
-    BOOLEAN     link_key_changed;       /* Changed link key during current connection */
+    bool        role_master;            /* true if current mode is master     */
+    uint16_t    security_required;      /* Security required for connection   */
+    bool        link_key_not_sent;      /* link key notification has not been sent waiting for name */
+    uint8_t     link_key_type;          /* Type of key used in pairing   */
+    bool        link_key_changed;       /* Changed link key during current connection */
 
 #define BTM_MAX_PRE_SM4_LKEY_TYPE   BTM_LKEY_TYPE_REMOTE_UNIT /* the link key type used by legacy pairing */
 
@@ -583,47 +583,47 @@
 #define BTM_SM4_RETRY       0x02        /* set this bit to retry on HCI_ERR_KEY_MISSING or HCI_ERR_LMP_ERR_TRANS_COLLISION */
 #define BTM_SM4_DD_ACP      0x20        /* set this bit to indicate peer initiated dedicated bonding */
 #define BTM_SM4_CONN_PEND   0x40        /* set this bit to indicate accepting acl conn; to be cleared on btm_acl_created */
-    UINT8       sm4;                    /* BTM_SM4_TRUE, if the peer supports SM4 */
+    uint8_t     sm4;                    /* BTM_SM4_TRUE, if the peer supports SM4 */
     tBTM_IO_CAP rmt_io_caps;            /* IO capability of the peer device */
     tBTM_AUTH_REQ rmt_auth_req;         /* the auth_req flag as in the IO caps rsp evt */
-    BOOLEAN     remote_supports_secure_connections;
-    BOOLEAN     remote_features_needed; /* set to true if the local device is in */
+    bool        remote_supports_secure_connections;
+    bool        remote_features_needed; /* set to true if the local device is in */
                                         /* "Secure Connections Only" mode and it receives */
                                         /* HCI_IO_CAPABILITY_REQUEST_EVT from the peer before */
                                         /* it knows peer's support for Secure Connections */
 
-    UINT16              ble_hci_handle;         /* use in DUMO connection */
-    UINT8               enc_key_size;           /* current link encryption key size */
+    uint16_t            ble_hci_handle;         /* use in DUMO connection */
+    uint8_t             enc_key_size;           /* current link encryption key size */
     tBT_DEVICE_TYPE     device_type;
-    BOOLEAN             new_encryption_key_is_p256; /* Set to TRUE when the newly generated LK
+    bool                new_encryption_key_is_p256; /* Set to true when the newly generated LK
                                                     ** is generated from P-256.
                                                     ** Link encrypted with such LK can be used
                                                     ** for SM over BR/EDR.
                                                     */
-    BOOLEAN no_smp_on_br;       /* if set to TRUE then SMP on BR/EDR doesn't */
+    bool    no_smp_on_br;       /* if set to true then SMP on BR/EDR doesn't */
                                 /* work, i.e. link keys crosspairing */
                                 /* SC BR/EDR->SC LE doesn't happen */
     tBTM_BOND_TYPE bond_type;   /* peering bond type */
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     tBTM_SEC_BLE        ble;
     tBTM_LE_CONN_PRAMS  conn_params;
 #endif
 
-#if BTM_DISC_DURING_RS == TRUE
+#if (BTM_DISC_DURING_RS == TRUE)
 #define BTM_SEC_RS_NOT_PENDING          0           /* Role Switch not in progress */
 #define BTM_SEC_RS_PENDING              1           /* Role Switch in progress */
 #define BTM_SEC_DISC_PENDING            2           /* Disconnect is pending */
-    UINT8           rs_disc_pending;
+    uint8_t         rs_disc_pending;
 #endif
 #define BTM_SEC_NO_LAST_SERVICE_ID      0
-    UINT8           last_author_service_id;         /* ID of last serviced authorized: Reset after each l2cap connection */
+    uint8_t         last_author_service_id;         /* ID of last serviced authorized: Reset after each l2cap connection */
 
 } tBTM_SEC_DEV_REC;
 
-#define BTM_SEC_IS_SM4(sm) ((BOOLEAN)(BTM_SM4_TRUE == ((sm)&BTM_SM4_TRUE)))
-#define BTM_SEC_IS_SM4_LEGACY(sm) ((BOOLEAN)(BTM_SM4_KNOWN == ((sm)&BTM_SM4_TRUE)))
-#define BTM_SEC_IS_SM4_UNKNOWN(sm) ((BOOLEAN)(BTM_SM4_UNKNOWN == ((sm)&BTM_SM4_TRUE)))
+#define BTM_SEC_IS_SM4(sm) ((bool   )(BTM_SM4_TRUE == ((sm)&BTM_SM4_TRUE)))
+#define BTM_SEC_IS_SM4_LEGACY(sm) ((bool   )(BTM_SM4_KNOWN == ((sm)&BTM_SM4_TRUE)))
+#define BTM_SEC_IS_SM4_UNKNOWN(sm) ((bool   )(BTM_SM4_UNKNOWN == ((sm)&BTM_SM4_TRUE)))
 
 #define BTM_SEC_LE_MASK    (BTM_SEC_LE_AUTHENTICATED|BTM_SEC_LE_ENCRYPTED|BTM_SEC_LE_LINK_KEY_KNOWN|BTM_SEC_LE_LINK_KEY_AUTHED)
 
@@ -635,11 +635,11 @@
 #if BTM_MAX_LOC_BD_NAME_LEN > 0
     tBTM_LOC_BD_NAME bd_name;                    /* local Bluetooth device name */
 #endif
-    BOOLEAN          pin_type;                   /* TRUE if PIN type is fixed */
-    UINT8            pin_code_len;               /* Bonding information */
+    bool             pin_type;                   /* true if PIN type is fixed */
+    uint8_t          pin_code_len;               /* Bonding information */
     PIN_CODE         pin_code;                   /* PIN CODE if pin type is fixed */
-    BOOLEAN          connectable;                /* If TRUE page scan should be enabled */
-    UINT8            def_inq_scan_mode;          /* ??? limited/general/none */
+    bool             connectable;                /* If true page scan should be enabled */
+    uint8_t          def_inq_scan_mode;          /* ??? limited/general/none */
 } tBTM_CFG;
 
 enum
@@ -651,7 +651,7 @@
     BTM_PM_ST_PENDING = BTM_PM_STS_PENDING,
     BTM_PM_ST_INVALID = 0xFF
 };
-typedef UINT8 tBTM_PM_STATE;
+typedef uint8_t tBTM_PM_STATE;
 
 enum
 {
@@ -659,53 +659,53 @@
     BTM_PM_UPDATE_EVT,
     BTM_PM_RD_MODE_EVT     /* Read power mode API is called. */
 };
-typedef UINT8 tBTM_PM_EVENT;
+typedef uint8_t tBTM_PM_EVENT;
 
 typedef struct
 {
-    UINT16          event;
-    UINT16          len;
-    UINT8           link_ind;
+    uint16_t        event;
+    uint16_t        len;
+    uint8_t         link_ind;
 } tBTM_PM_MSG_DATA;
 
 typedef struct
 {
-    UINT8 hci_status;
-    UINT8 mode;
-    UINT16 interval;
+    uint8_t hci_status;
+    uint8_t mode;
+    uint16_t interval;
 } tBTM_PM_MD_CHG_DATA;
 
 typedef struct
 {
-    UINT8          pm_id;      /* the entity that calls SetPowerMode API */
+    uint8_t        pm_id;      /* the entity that calls SetPowerMode API */
     tBTM_PM_PWR_MD *p_pmd;
 } tBTM_PM_SET_MD_DATA;
 
 typedef struct
 {
     void        *p_data;
-    UINT8        link_ind;
+    uint8_t      link_ind;
 } tBTM_PM_SM_DATA;
 
 typedef struct
 {
     tBTM_PM_PWR_MD req_mode[BTM_MAX_PM_RECORDS+1]; /* the desired mode and parameters of the connection*/
     tBTM_PM_PWR_MD set_mode;  /* the mode and parameters sent down to the host controller. */
-    UINT16         interval;  /* the interval from last mode change event. */
+    uint16_t       interval;  /* the interval from last mode change event. */
 #if (BTM_SSR_INCLUDED == TRUE)
-    UINT16         max_lat;   /* stored SSR maximum latency */
-    UINT16         min_rmt_to;/* stored SSR minimum remote timeout */
-    UINT16         min_loc_to;/* stored SSR minimum local timeout */
+    uint16_t       max_lat;   /* stored SSR maximum latency */
+    uint16_t       min_rmt_to;/* stored SSR minimum remote timeout */
+    uint16_t       min_loc_to;/* stored SSR minimum local timeout */
 #endif
     tBTM_PM_STATE  state;     /* contains the current mode of the connection */
-    BOOLEAN        chg_ind;   /* a request change indication */
+    bool           chg_ind;   /* a request change indication */
 } tBTM_PM_MCB;
 
 #define BTM_PM_REC_NOT_USED 0
 typedef struct
 {
     tBTM_PM_STATUS_CBACK *cback;/* to notify the registered party of mode change event */
-    UINT8                 mask; /* registered request mask. 0, if this entry is not used */
+    uint8_t               mask; /* registered request mask. 0, if this entry is not used */
 } tBTM_PM_RCB;
 
 enum
@@ -718,7 +718,7 @@
     BTM_BLI_INQ_CANCEL_EVT,
     BTM_BLI_INQ_DONE_EVT
 };
-typedef UINT8 tBTM_BLI_EVENT;
+typedef uint8_t tBTM_BLI_EVENT;
 
 /* Pairing State */
 enum
@@ -735,7 +735,7 @@
     BTM_PAIR_STATE_WAIT_AUTH_COMPLETE,          /* All done, waiting authentication cpmplete    */
     BTM_PAIR_STATE_WAIT_DISCONNECT              /* Waiting to disconnect the ACL                */
 };
-typedef UINT8 tBTM_PAIRING_STATE;
+typedef uint8_t tBTM_PAIRING_STATE;
 
 #define BTM_PAIR_FLAGS_WE_STARTED_DD    0x01    /* We want to do dedicated bonding              */
 #define BTM_PAIR_FLAGS_PEER_STARTED_DD  0x02    /* Peer initiated dedicated bonding             */
@@ -749,14 +749,14 @@
 
 typedef struct
 {
-    BOOLEAN             is_mux;
+    bool                is_mux;
     BD_ADDR             bd_addr;
-    UINT16              psm;
-    BOOLEAN             is_orig;
+    uint16_t            psm;
+    bool                is_orig;
     tBTM_SEC_CALLBACK   *p_callback;
     void                *p_ref_data;
-    UINT32              mx_proto_id;
-    UINT32              mx_chan_id;
+    uint32_t            mx_proto_id;
+    uint32_t            mx_chan_id;
     tBT_TRANSPORT       transport;
     tBTM_BLE_SEC_ACT    sec_act;
 } tBTM_SEC_QUEUE_ENTRY;
@@ -769,13 +769,13 @@
 #define CONNLESS_ORIG                   0x03    /* outgoing connectionless      */
 #define CONNECTION_TYPE_ORIG_MASK       0x01    /* mask for direction           */
 #define CONNECTION_TYPE_CONNLESS_MASK   0x02    /* mask for connectionless or not */
-typedef UINT8 CONNECTION_TYPE;
+typedef uint8_t CONNECTION_TYPE;
 
 #else
 
-#define CONN_ORIENT_TERM                FALSE
-#define CONN_ORIENT_ORIG                TRUE
-typedef BOOLEAN CONNECTION_TYPE;
+#define CONN_ORIENT_TERM                false
+#define CONN_ORIENT_ORIG                true
+typedef bool    CONNECTION_TYPE;
 
 #endif /* (L2CAP_UCD_INCLUDED == TRUE) */
 
@@ -792,9 +792,9 @@
     **      ACL Management
     ****************************************************/
     tACL_CONN   acl_db[MAX_L2CAP_LINKS];
-    UINT8       btm_scn[BTM_MAX_SCN];        /* current SCNs: TRUE if SCN is in use */
-    UINT16      btm_def_link_policy;
-    UINT16      btm_def_link_super_tout;
+    uint8_t     btm_scn[BTM_MAX_SCN];        /* current SCNs: true if SCN is in use */
+    uint16_t    btm_def_link_policy;
+    uint16_t    btm_def_link_super_tout;
 
     tBTM_BL_EVENT_MASK     bl_evt_mask;
     tBTM_BL_CHANGE_CB     *p_bl_changed_cb;    /* Callback for when Busy Level changed */
@@ -804,8 +804,8 @@
     ****************************************************/
     tBTM_PM_MCB pm_mode_db[MAX_L2CAP_LINKS];   /* per ACL link */
     tBTM_PM_RCB pm_reg_db[BTM_MAX_PM_RECORDS+1]; /* per application/module */
-    UINT8       pm_pend_link;  /* the index of acl_db, which has a pending PM cmd */
-    UINT8       pm_pend_id;    /* the id pf the module, which has a pending PM cmd */
+    uint8_t     pm_pend_link;  /* the index of acl_db, which has a pending PM cmd */
+    uint8_t     pm_pend_id;    /* the id pf the module, which has a pending PM cmd */
 
     /*****************************************************
     **      Device control
@@ -818,16 +818,16 @@
 #if (BLE_INCLUDED == TRUE)
     tBTM_BLE_CB             ble_ctr_cb;
 
-    UINT16                  enc_handle;
+    uint16_t                enc_handle;
     BT_OCTET8               enc_rand;   /* received rand value from LTK request*/
-    UINT16                  ediv;       /* received ediv value from LTK request */
-    UINT8                   key_size;
+    uint16_t                ediv;       /* received ediv value from LTK request */
+    uint8_t                 key_size;
     tBTM_BLE_VSC_CB         cmn_ble_vsc_cb;
 #endif
 
                                             /* Packet types supported by the local device */
-    UINT16      btm_acl_pkt_types_supported;
-    UINT16      btm_sco_pkt_types_supported;
+    uint16_t    btm_acl_pkt_types_supported;
+    uint16_t    btm_sco_pkt_types_supported;
 
 
     /*****************************************************
@@ -838,7 +838,7 @@
     /*****************************************************
     **      SCO Management
     *****************************************************/
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
     tSCO_CB             sco_cb;
 #endif
 
@@ -852,24 +852,24 @@
 
     tBTM_SEC_DEV_REC        *p_collided_dev_rec;
     alarm_t                 *sec_collision_timer;
-    UINT32                   collision_start_time;
-    UINT32                   max_collision_delay;
-    UINT32                   dev_rec_count;      /* Counter used for device record timestamp */
-    UINT8                    security_mode;
-    BOOLEAN                  pairing_disabled;
-    BOOLEAN                  connect_only_paired;
-    BOOLEAN                  security_mode_changed;  /* mode changed during bonding */
-    BOOLEAN                  pin_type_changed;       /* pin type changed during bonding */
-    BOOLEAN                  sec_req_pending;       /*   TRUE if a request is pending */
+    uint32_t                 collision_start_time;
+    uint32_t                 max_collision_delay;
+    uint32_t                 dev_rec_count;      /* Counter used for device record timestamp */
+    uint8_t                  security_mode;
+    bool                     pairing_disabled;
+    bool                     connect_only_paired;
+    bool                     security_mode_changed;  /* mode changed during bonding */
+    bool                     pin_type_changed;       /* pin type changed during bonding */
+    bool                     sec_req_pending;       /*   true if a request is pending */
 
-    UINT8                    pin_code_len;  /* for legacy devices */
+    uint8_t                  pin_code_len;  /* for legacy devices */
     PIN_CODE                 pin_code;      /* for legacy devices */
     tBTM_PAIRING_STATE       pairing_state; /* The current pairing state    */
-    UINT8                    pairing_flags; /* The current pairing flags    */
+    uint8_t                  pairing_flags; /* The current pairing flags    */
     BD_ADDR                  pairing_bda;   /* The device currently pairing */
     alarm_t                 *pairing_timer; /* Timer for pairing process    */
-    UINT16                   disc_handle;   /* for legacy devices */
-    UINT8                    disc_reason;   /* for legacy devices */
+    uint16_t                 disc_handle;   /* for legacy devices */
+    uint8_t                  disc_reason;   /* for legacy devices */
     tBTM_SEC_SERV_REC        sec_serv_rec[BTM_SEC_MAX_SERVICE_RECORDS];
     list_t                  *sec_dev_rec;   /* list of tBTM_SEC_DEV_REC */
     tBTM_SEC_SERV_REC       *p_out_serv;
@@ -878,17 +878,17 @@
     BD_ADDR                  connecting_bda;
     DEV_CLASS                connecting_dc;
 
-    UINT8                   acl_disc_reason;
-    UINT8                   trace_level;
-    UINT8                   busy_level; /* the current busy level */
-    BOOLEAN                 is_paging;  /* TRUE, if paging is in progess */
-    BOOLEAN                 is_inquiry; /* TRUE, if inquiry is in progess */
+    uint8_t                 acl_disc_reason;
+    uint8_t                 trace_level;
+    uint8_t                 busy_level; /* the current busy level */
+    bool                    is_paging;  /* true, if paging is in progess */
+    bool                    is_inquiry; /* true, if inquiry is in progess */
     fixed_queue_t          *page_queue;
-    BOOLEAN                 paging;
-    BOOLEAN                 discing;
+    bool                    paging;
+    bool                    discing;
     fixed_queue_t          *sec_pending_q;  /* pending sequrity requests in tBTM_SEC_QUEUE_ENTRY format */
 
-#if  (!defined(BT_TRACE_VERBOSE) || (BT_TRACE_VERBOSE == FALSE))
+#if (BT_TRACE_VERBOSE == FALSE)
     char state_temp_buffer[BTM_STATE_BUFFER_SIZE];
 #endif
 } tBTM_CB;
@@ -900,9 +900,9 @@
 #define BTM_SEC_ENCRYPT_MITM      4    /* authenticated encryption */
 #define BTM_SEC_ENC_PENDING       5    /* wait for link encryption pending */
 
-typedef UINT8 tBTM_SEC_ACTION;
+typedef uint8_t tBTM_SEC_ACTION;
 
-#if BTM_DYNAMIC_MEMORY == FALSE
+#if (BTM_DYNAMIC_MEMORY == FALSE)
 extern tBTM_CB  btm_cb;
 #else
 extern tBTM_CB *btm_cb_ptr;
@@ -919,88 +919,88 @@
 */
 extern tBTM_STATUS  btm_initiate_rem_name(BD_ADDR remote_bda,
                                           tBTM_INQ_INFO *p_cur,
-                                          UINT8 origin, period_ms_t timeout_ms,
+                                          uint8_t origin, period_ms_t timeout_ms,
                                           tBTM_CMPL_CB *p_cb);
 
-extern void         btm_process_remote_name (BD_ADDR bda, BD_NAME name, UINT16 evt_len,
-                                             UINT8 hci_status);
+extern void         btm_process_remote_name (BD_ADDR bda, BD_NAME name, uint16_t evt_len,
+                                             uint8_t hci_status);
 extern void         btm_inq_rmt_name_failed(void);
 extern void         btm_inq_remote_name_timer_timeout(void *data);
 
 /* Inquiry related functions */
 extern void         btm_clr_inq_db (BD_ADDR p_bda);
 extern void         btm_inq_db_init (void);
-extern void         btm_process_inq_results (UINT8 *p, UINT8 inq_res_mode);
-extern void         btm_process_inq_complete (UINT8 status, UINT8 mode);
-extern void         btm_process_cancel_complete(UINT8 status, UINT8 mode);
-extern void         btm_event_filter_complete (UINT8 *p);
+extern void         btm_process_inq_results (uint8_t *p, uint8_t inq_res_mode);
+extern void         btm_process_inq_complete (uint8_t status, uint8_t mode);
+extern void         btm_process_cancel_complete(uint8_t status, uint8_t mode);
+extern void         btm_event_filter_complete (uint8_t *p);
 extern void         btm_inq_stop_on_ssp(void);
 extern void         btm_inq_clear_ssp(void);
 extern tINQ_DB_ENT *btm_inq_db_find (const BD_ADDR p_bda);
-extern BOOLEAN      btm_inq_find_bdaddr (BD_ADDR p_bda);
+extern bool         btm_inq_find_bdaddr (BD_ADDR p_bda);
 
-extern BOOLEAN btm_lookup_eir(BD_ADDR_PTR p_rem_addr);
+extern bool    btm_lookup_eir(BD_ADDR_PTR p_rem_addr);
 
 /* Internal functions provided by btm_acl.c
 ********************************************
 */
 extern void         btm_acl_init (void);
 extern void         btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
-                                     UINT16 hci_handle, UINT8 link_role, tBT_TRANSPORT transport);
+                                     uint16_t hci_handle, uint8_t link_role, tBT_TRANSPORT transport);
 extern void         btm_acl_removed (BD_ADDR bda, tBT_TRANSPORT transport);
 extern void         btm_acl_device_down (void);
 extern void         btm_acl_update_busy_level (tBTM_BLI_EVENT event);
 
 extern void         btm_cont_rswitch (tACL_CONN *p,
                                       tBTM_SEC_DEV_REC *p_dev_rec,
-                                      UINT8 hci_status);
+                                      uint8_t hci_status);
 
-extern UINT8        btm_handle_to_acl_index (UINT16 hci_handle);
-extern void         btm_read_link_policy_complete (UINT8 *p);
+extern uint8_t      btm_handle_to_acl_index (uint16_t hci_handle);
+extern void         btm_read_link_policy_complete (uint8_t *p);
 
 extern void         btm_read_rssi_timeout(void *data);
-extern void         btm_read_rssi_complete(UINT8 *p);
+extern void         btm_read_rssi_complete(uint8_t *p);
 
 extern void         btm_read_tx_power_timeout(void *data);
-extern void         btm_read_tx_power_complete(UINT8 *p, BOOLEAN is_ble);
+extern void         btm_read_tx_power_complete(uint8_t *p, bool    is_ble);
 
 extern void         btm_read_link_quality_timeout(void *data);
-extern void         btm_read_link_quality_complete(UINT8 *p);
+extern void         btm_read_link_quality_complete(uint8_t *p);
 
-extern tBTM_STATUS  btm_set_packet_types (tACL_CONN *p, UINT16 pkt_types);
-extern void         btm_process_clk_off_comp_evt (UINT16 hci_handle, UINT16 clock_offset);
-extern void         btm_acl_role_changed (UINT8 hci_status, BD_ADDR bd_addr, UINT8 new_role);
-extern void         btm_acl_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable);
-extern UINT16       btm_get_acl_disc_reason_code (void);
+extern tBTM_STATUS  btm_set_packet_types (tACL_CONN *p, uint16_t pkt_types);
+extern void         btm_process_clk_off_comp_evt (uint16_t hci_handle, uint16_t clock_offset);
+extern void         btm_acl_role_changed (uint8_t hci_status, BD_ADDR bd_addr, uint8_t new_role);
+extern void         btm_acl_encrypt_change (uint16_t handle, uint8_t status, uint8_t encr_enable);
+extern uint16_t     btm_get_acl_disc_reason_code (void);
 extern tBTM_STATUS  btm_remove_acl (BD_ADDR bd_addr, tBT_TRANSPORT transport);
-extern void         btm_read_remote_features_complete (UINT8 *p);
-extern void         btm_read_remote_ext_features_complete (UINT8 *p);
-extern void         btm_read_remote_ext_features_failed (UINT8 status, UINT16 handle);
-extern void         btm_read_remote_version_complete (UINT8 *p);
+extern void         btm_read_remote_features_complete (uint8_t *p);
+extern void         btm_read_remote_ext_features_complete (uint8_t *p);
+extern void         btm_read_remote_ext_features_failed (uint8_t status, uint16_t handle);
+extern void         btm_read_remote_version_complete (uint8_t *p);
 extern void         btm_establish_continue (tACL_CONN *p_acl_cb);
 
-extern void         btm_acl_chk_peer_pkt_type_support (tACL_CONN *p, UINT16 *p_pkt_type);
+extern void         btm_acl_chk_peer_pkt_type_support (tACL_CONN *p, uint16_t *p_pkt_type);
 /* Read maximum data packet that can be sent over current connection */
-extern UINT16 btm_get_max_packet_size (BD_ADDR addr);
+extern uint16_t btm_get_max_packet_size (BD_ADDR addr);
 extern tACL_CONN *btm_bda_to_acl (const BD_ADDR bda, tBT_TRANSPORT transport);
-extern BOOLEAN    btm_acl_notif_conn_collision (BD_ADDR bda);
+extern bool       btm_acl_notif_conn_collision (BD_ADDR bda);
 
 extern void btm_pm_reset(void);
-extern void btm_pm_sm_alloc(UINT8 ind);
-extern void btm_pm_proc_cmd_status(UINT8 status);
-extern void btm_pm_proc_mode_change (UINT8 hci_status, UINT16 hci_handle, UINT8 mode,
-                                     UINT16 interval);
-extern void btm_pm_proc_ssr_evt (UINT8 *p, UINT16 evt_len);
+extern void btm_pm_sm_alloc(uint8_t ind);
+extern void btm_pm_proc_cmd_status(uint8_t status);
+extern void btm_pm_proc_mode_change (uint8_t hci_status, uint16_t hci_handle, uint8_t mode,
+                                     uint16_t interval);
+extern void btm_pm_proc_ssr_evt (uint8_t *p, uint16_t evt_len);
 extern tBTM_STATUS btm_read_power_mode_state (BD_ADDR remote_bda,
                                                       tBTM_PM_STATE *pmState);
-#if BTM_SCO_INCLUDED == TRUE
-extern void btm_sco_chk_pend_unpark (UINT8 hci_status, UINT16 hci_handle);
+#if (BTM_SCO_INCLUDED == TRUE)
+extern void btm_sco_chk_pend_unpark (uint8_t hci_status, uint16_t hci_handle);
 #else
 #define btm_sco_chk_pend_unpark(hci_status, hci_handle)
 #endif /* BTM_SCO_INCLUDED */
 
 extern void btm_qos_setup_timeout(void *data);
-extern void btm_qos_setup_complete(UINT8 status, UINT16 handle,
+extern void btm_qos_setup_complete(uint8_t status, uint16_t handle,
                                    FLOW_SPEC *p_flow);
 
 
@@ -1008,121 +1008,121 @@
 ********************************************
 */
 extern void btm_sco_init (void);
-extern void btm_sco_connected (UINT8 hci_status, BD_ADDR bda, UINT16 hci_handle,
+extern void btm_sco_connected (uint8_t hci_status, BD_ADDR bda, uint16_t hci_handle,
                                tBTM_ESCO_DATA *p_esco_data);
-extern void btm_esco_proc_conn_chg (UINT8 status, UINT16 handle, UINT8 tx_interval,
-                                    UINT8 retrans_window, UINT16 rx_pkt_len,
-                                    UINT16 tx_pkt_len);
-extern void btm_sco_conn_req (BD_ADDR bda,  DEV_CLASS dev_class, UINT8 link_type);
-extern void btm_sco_removed (UINT16 hci_handle, UINT8 reason);
+extern void btm_esco_proc_conn_chg (uint8_t status, uint16_t handle, uint8_t tx_interval,
+                                    uint8_t retrans_window, uint16_t rx_pkt_len,
+                                    uint16_t tx_pkt_len);
+extern void btm_sco_conn_req (BD_ADDR bda,  DEV_CLASS dev_class, uint8_t link_type);
+extern void btm_sco_removed (uint16_t hci_handle, uint8_t reason);
 extern void btm_sco_acl_removed (BD_ADDR bda);
 extern void btm_route_sco_data (BT_HDR *p_msg);
-extern BOOLEAN btm_is_sco_active (UINT16 handle);
+extern bool    btm_is_sco_active (uint16_t handle);
 extern void btm_remove_sco_links (BD_ADDR bda);
-extern BOOLEAN btm_is_sco_active_by_bdaddr (BD_ADDR remote_bda);
+extern bool    btm_is_sco_active_by_bdaddr (BD_ADDR remote_bda);
 
 extern tBTM_SCO_TYPE btm_read_def_esco_mode (tBTM_ESCO_PARAMS *p_parms);
-extern UINT16  btm_find_scb_by_handle (UINT16 handle);
-extern void btm_sco_flush_sco_data(UINT16 sco_inx);
+extern uint16_t btm_find_scb_by_handle (uint16_t handle);
+extern void btm_sco_flush_sco_data(uint16_t sco_inx);
 
 /* Internal functions provided by btm_devctl.c
 **********************************************
 */
 extern void btm_dev_init(void);
 extern void btm_read_local_name_timeout(void *data);
-extern void btm_read_local_name_complete(UINT8 *p, UINT16 evt_len);
+extern void btm_read_local_name_complete(uint8_t *p, uint16_t evt_len);
 
 #if (BLE_INCLUDED == TRUE)
-extern void btm_ble_add_2_white_list_complete(UINT8 status);
-extern void btm_ble_remove_from_white_list_complete(UINT8 *p, UINT16 evt_len);
-extern void btm_ble_clear_white_list_complete(UINT8 *p, UINT16 evt_len);
-extern BOOLEAN btm_ble_addr_resolvable(BD_ADDR rpa, tBTM_SEC_DEV_REC *p_dev_rec);
+extern void btm_ble_add_2_white_list_complete(uint8_t status);
+extern void btm_ble_remove_from_white_list_complete(uint8_t *p, uint16_t evt_len);
+extern void btm_ble_clear_white_list_complete(uint8_t *p, uint16_t evt_len);
+extern bool    btm_ble_addr_resolvable(BD_ADDR rpa, tBTM_SEC_DEV_REC *p_dev_rec);
 extern tBTM_STATUS btm_ble_read_resolving_list_entry(tBTM_SEC_DEV_REC *p_dev_rec);
-extern BOOLEAN btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec);
+extern bool    btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec);
 extern void btm_ble_resolving_list_remove_dev(tBTM_SEC_DEV_REC *p_dev_rec);
 #endif  /* BLE_INCLUDED */
 
 /* Vendor Specific Command complete evt handler */
-extern void btm_vsc_complete (UINT8 *p, UINT16 cc_opcode, UINT16 evt_len,
+extern void btm_vsc_complete (uint8_t *p, uint16_t cc_opcode, uint16_t evt_len,
                               tBTM_CMPL_CB *p_vsc_cplt_cback);
 extern void btm_inq_db_reset (void);
-extern void btm_vendor_specific_evt (UINT8 *p, UINT8 evt_len);
-extern void btm_delete_stored_link_key_complete (UINT8 *p);
+extern void btm_vendor_specific_evt (uint8_t *p, uint8_t evt_len);
+extern void btm_delete_stored_link_key_complete (uint8_t *p);
 extern void btm_report_device_status (tBTM_DEV_STATUS status);
 
 
 /* Internal functions provided by btm_dev.c
 **********************************************
 */
-extern BOOLEAN btm_dev_support_switch (BD_ADDR bd_addr);
+extern bool    btm_dev_support_switch (BD_ADDR bd_addr);
 
 extern tBTM_SEC_DEV_REC  *btm_sec_alloc_dev (BD_ADDR bd_addr);
 extern void               btm_sec_free_dev (tBTM_SEC_DEV_REC *p_dev_rec);
 extern tBTM_SEC_DEV_REC  *btm_find_dev (const BD_ADDR bd_addr);
 extern tBTM_SEC_DEV_REC  *btm_find_or_alloc_dev (BD_ADDR bd_addr);
-extern tBTM_SEC_DEV_REC  *btm_find_dev_by_handle (UINT16 handle);
+extern tBTM_SEC_DEV_REC  *btm_find_dev_by_handle (uint16_t handle);
 extern tBTM_BOND_TYPE     btm_get_bond_type_dev(BD_ADDR bd_addr);
-extern BOOLEAN            btm_set_bond_type_dev(BD_ADDR bd_addr,
+extern bool               btm_set_bond_type_dev(BD_ADDR bd_addr,
                                                 tBTM_BOND_TYPE bond_type);
 
 /* Internal functions provided by btm_sec.c
 **********************************************
 */
-extern BOOLEAN btm_dev_support_switch (BD_ADDR bd_addr);
-extern tBTM_STATUS  btm_sec_l2cap_access_req (BD_ADDR bd_addr, UINT16 psm,
-                                       UINT16 handle, CONNECTION_TYPE conn_type,
+extern bool    btm_dev_support_switch (BD_ADDR bd_addr);
+extern tBTM_STATUS  btm_sec_l2cap_access_req (BD_ADDR bd_addr, uint16_t psm,
+                                       uint16_t handle, CONNECTION_TYPE conn_type,
                                        tBTM_SEC_CALLBACK *p_callback, void *p_ref_data);
-extern tBTM_STATUS  btm_sec_mx_access_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator,
-                                        UINT32 mx_proto_id, UINT32 mx_chan_id,
+extern tBTM_STATUS  btm_sec_mx_access_request (BD_ADDR bd_addr, uint16_t psm, bool    is_originator,
+                                        uint32_t mx_proto_id, uint32_t mx_chan_id,
                                         tBTM_SEC_CALLBACK *p_callback, void *p_ref_data);
-extern void  btm_sec_conn_req (UINT8 *bda, UINT8 *dc);
-extern void btm_create_conn_cancel_complete (UINT8 *p);
+extern void  btm_sec_conn_req (uint8_t *bda, uint8_t *dc);
+extern void btm_create_conn_cancel_complete (uint8_t *p);
 
 extern void  btm_read_inq_tx_power_timeout(void *data);
-extern void  btm_read_inq_tx_power_complete(UINT8 *p);
+extern void  btm_read_inq_tx_power_complete(uint8_t *p);
 
-extern void  btm_sec_init (UINT8 sec_mode);
+extern void  btm_sec_init (uint8_t sec_mode);
 extern void  btm_sec_dev_reset (void);
 extern void  btm_sec_abort_access_req (BD_ADDR bd_addr);
-extern void  btm_sec_auth_complete (UINT16 handle, UINT8 status);
-extern void  btm_sec_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable);
-extern void  btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode);
-extern tBTM_STATUS btm_sec_disconnect (UINT16 handle, UINT8 reason);
-extern void  btm_sec_disconnected (UINT16 handle, UINT8 reason);
-extern void  btm_sec_rmt_name_request_complete (UINT8 *bd_addr, UINT8 *bd_name, UINT8 status);
-extern void  btm_sec_rmt_host_support_feat_evt (UINT8 *p);
-extern void  btm_io_capabilities_req (UINT8 *p);
-extern void  btm_io_capabilities_rsp (UINT8 *p);
-extern void  btm_proc_sp_req_evt (tBTM_SP_EVT event, UINT8 *p);
-extern void  btm_keypress_notif_evt (UINT8 *p);
-extern void  btm_simple_pair_complete (UINT8 *p);
-extern void  btm_sec_link_key_notification (UINT8 *p_bda, UINT8 *p_link_key, UINT8 key_type);
-extern void  btm_sec_link_key_request (UINT8 *p_bda);
-extern void  btm_sec_pin_code_request (UINT8 *p_bda);
-extern void  btm_sec_update_clock_offset (UINT16 handle, UINT16 clock_offset);
-extern void  btm_sec_dev_rec_cback_event (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 res, BOOLEAN is_le_trasnport);
+extern void  btm_sec_auth_complete (uint16_t handle, uint8_t status);
+extern void  btm_sec_encrypt_change (uint16_t handle, uint8_t status, uint8_t encr_enable);
+extern void  btm_sec_connected (uint8_t *bda, uint16_t handle, uint8_t status, uint8_t enc_mode);
+extern tBTM_STATUS btm_sec_disconnect (uint16_t handle, uint8_t reason);
+extern void  btm_sec_disconnected (uint16_t handle, uint8_t reason);
+extern void  btm_sec_rmt_name_request_complete (uint8_t *bd_addr, uint8_t *bd_name, uint8_t status);
+extern void  btm_sec_rmt_host_support_feat_evt (uint8_t *p);
+extern void  btm_io_capabilities_req (uint8_t *p);
+extern void  btm_io_capabilities_rsp (uint8_t *p);
+extern void  btm_proc_sp_req_evt (tBTM_SP_EVT event, uint8_t *p);
+extern void  btm_keypress_notif_evt (uint8_t *p);
+extern void  btm_simple_pair_complete (uint8_t *p);
+extern void  btm_sec_link_key_notification (uint8_t *p_bda, uint8_t *p_link_key, uint8_t key_type);
+extern void  btm_sec_link_key_request (uint8_t *p_bda);
+extern void  btm_sec_pin_code_request (uint8_t *p_bda);
+extern void  btm_sec_update_clock_offset (uint16_t handle, uint16_t clock_offset);
+extern void  btm_sec_dev_rec_cback_event (tBTM_SEC_DEV_REC *p_dev_rec, uint8_t res, bool    is_le_trasnport);
 extern void btm_sec_set_peer_sec_caps (tACL_CONN *p_acl_cb, tBTM_SEC_DEV_REC *p_dev_rec);
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 extern void  btm_sec_clear_ble_keys (tBTM_SEC_DEV_REC  *p_dev_rec);
-extern BOOLEAN btm_sec_is_a_bonded_dev (BD_ADDR bda);
+extern bool    btm_sec_is_a_bonded_dev (BD_ADDR bda);
 extern void btm_consolidate_dev(tBTM_SEC_DEV_REC *p_target_rec);
-extern BOOLEAN btm_sec_is_le_capable_dev (BD_ADDR bda);
-extern BOOLEAN btm_ble_init_pseudo_addr (tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR new_pseudo_addr);
-extern tBTM_SEC_SERV_REC *btm_sec_find_first_serv (CONNECTION_TYPE conn_type, UINT16 psm);
-extern BOOLEAN btm_ble_start_sec_check(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator,
+extern bool    btm_sec_is_le_capable_dev (BD_ADDR bda);
+extern bool    btm_ble_init_pseudo_addr (tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR new_pseudo_addr);
+extern tBTM_SEC_SERV_REC *btm_sec_find_first_serv (CONNECTION_TYPE conn_type, uint16_t psm);
+extern bool    btm_ble_start_sec_check(BD_ADDR bd_addr, uint16_t psm, bool    is_originator,
                             tBTM_SEC_CALLBACK *p_callback, void *p_ref_data);
 #endif /* BLE_INCLUDED */
 
 extern tINQ_DB_ENT *btm_inq_db_new (BD_ADDR p_bda);
 
-extern void  btm_rem_oob_req (UINT8 *p);
-extern void  btm_read_local_oob_complete (UINT8 *p);
+extern void  btm_rem_oob_req (uint8_t *p);
+extern void  btm_read_local_oob_complete (uint8_t *p);
 
 extern void  btm_acl_resubmit_page (void);
 extern void  btm_acl_reset_paging (void);
 extern void  btm_acl_paging (BT_HDR *p, BD_ADDR dest);
-extern UINT8 btm_sec_clr_service_by_psm (UINT16 psm);
+extern uint8_t btm_sec_clr_service_by_psm (uint16_t psm);
 extern void  btm_sec_clr_temp_auth_service (BD_ADDR bda);
 
 #ifdef __cplusplus
diff --git a/stack/btm/btm_main.c b/stack/btm/btm_main.c
index 93b0ecc..de3f04f 100644
--- a/stack/btm/btm_main.c
+++ b/stack/btm/btm_main.c
@@ -31,7 +31,7 @@
 
 /* Global BTM control block structure
 */
-#if BTM_DYNAMIC_MEMORY == FALSE
+#if (BTM_DYNAMIC_MEMORY == FALSE)
 tBTM_CB  btm_cb;
 #endif
 
@@ -69,7 +69,7 @@
         btm_sec_init(BTM_SEC_MODE_SC);
     else
         btm_sec_init(BTM_SEC_MODE_SP);
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
     btm_sco_init();                     /* SCO Database and Structures (If included) */
 #endif
 
diff --git a/stack/btm/btm_pm.c b/stack/btm/btm_pm.c
index e24563b..d074693 100644
--- a/stack/btm/btm_pm.c
+++ b/stack/btm/btm_pm.c
@@ -52,17 +52,17 @@
 #define BTM_PM_STORED_MASK      0x80 /* set this mask if the command is stored */
 #define BTM_PM_NUM_SET_MODES    3 /* only hold, sniff & park */
 
-/* Usage:  (ptr_features[ offset ] & mask )?TRUE:FALSE */
+/* Usage:  (ptr_features[ offset ] & mask )?true:false */
 /* offset to supported feature */
-const UINT8 btm_pm_mode_off[BTM_PM_NUM_SET_MODES] = {0,    0,    1};
+const uint8_t btm_pm_mode_off[BTM_PM_NUM_SET_MODES] = {0,    0,    1};
 /* mask to supported feature */
-const UINT8 btm_pm_mode_msk[BTM_PM_NUM_SET_MODES] = {0x40, 0x80, 0x01};
+const uint8_t btm_pm_mode_msk[BTM_PM_NUM_SET_MODES] = {0x40, 0x80, 0x01};
 
 #define BTM_PM_GET_MD1      1
 #define BTM_PM_GET_MD2      2
 #define BTM_PM_GET_COMP     3
 
-const UINT8 btm_pm_md_comp_matrix[BTM_PM_NUM_SET_MODES*BTM_PM_NUM_SET_MODES] =
+const uint8_t btm_pm_md_comp_matrix[BTM_PM_NUM_SET_MODES*BTM_PM_NUM_SET_MODES] =
 {
     BTM_PM_GET_COMP,
     BTM_PM_GET_MD2,
@@ -79,17 +79,17 @@
 
 /* function prototype */
 static int btm_pm_find_acl_ind(BD_ADDR remote_bda);
-static tBTM_STATUS btm_pm_snd_md_req( UINT8 pm_id, int link_ind, tBTM_PM_PWR_MD *p_mode );
+static tBTM_STATUS btm_pm_snd_md_req( uint8_t pm_id, int link_ind, tBTM_PM_PWR_MD *p_mode );
 static const char *mode_to_string(tBTM_PM_MODE mode);
 
 /*
 #ifdef BTM_PM_DEBUG
 #undef BTM_PM_DEBUG
-#define BTM_PM_DEBUG    TRUE
+#define BTM_PM_DEBUG    true
 #endif
 */
 
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
 const char * btm_pm_state_str[] =
 {
     "pm_active_state",
@@ -131,7 +131,7 @@
 **                  BTM_ILLEGAL_VALUE
 **
 *******************************************************************************/
-tBTM_STATUS BTM_PmRegister (UINT8 mask, UINT8 *p_pm_id, tBTM_PM_STATUS_CBACK *p_cb)
+tBTM_STATUS BTM_PmRegister (uint8_t mask, uint8_t *p_pm_id, tBTM_PM_STATUS_CBACK *p_cb)
 {
     int xx;
 
@@ -176,9 +176,9 @@
 **                  BTM_UNKNOWN_ADDR if bd addr is not active or bad
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetPowerMode (UINT8 pm_id, BD_ADDR remote_bda, tBTM_PM_PWR_MD *p_mode)
+tBTM_STATUS BTM_SetPowerMode (uint8_t pm_id, BD_ADDR remote_bda, tBTM_PM_PWR_MD *p_mode)
 {
-    UINT8               *p_features;
+    uint8_t             *p_features;
     int               ind, acl_ind;
     tBTM_PM_MCB *p_cb = NULL;   /* per ACL link */
     tBTM_PM_MODE        mode;
@@ -232,16 +232,16 @@
          (btm_cb.pm_reg_db[pm_id].mask & BTM_PM_REG_SET))
        || ((pm_id == BTM_PM_SET_ONLY_ID) && (btm_cb.pm_pend_link != MAX_L2CAP_LINKS)) )
     {
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
     BTM_TRACE_DEBUG( "BTM_SetPowerMode: Saving cmd acl_ind %d temp_pm_id %d", acl_ind,temp_pm_id);
 #endif  // BTM_PM_DEBUG
         /* Make sure mask is set to BTM_PM_REG_SET */
         btm_cb.pm_reg_db[temp_pm_id].mask |= BTM_PM_REG_SET;
         *(&p_cb->req_mode[temp_pm_id]) = *((tBTM_PM_PWR_MD *)p_mode);
-        p_cb->chg_ind = TRUE;
+        p_cb->chg_ind = true;
     }
 
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
     BTM_TRACE_DEBUG( "btm_pm state:0x%x, pm_pend_link: %d", p_cb->state, btm_cb.pm_pend_link);
 #endif  // BTM_PM_DEBUG
     /* if mode == hold or pending, return */
@@ -342,8 +342,8 @@
 **                  BTM_CMD_STORED if the command is stored
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetSsrParams (BD_ADDR remote_bda, UINT16 max_lat,
-                              UINT16 min_rmt_to, UINT16 min_loc_to)
+tBTM_STATUS BTM_SetSsrParams (BD_ADDR remote_bda, uint16_t max_lat,
+                              uint16_t min_rmt_to, uint16_t min_loc_to)
 {
 #if (BTM_SSR_INCLUDED == TRUE)
     int acl_ind;
@@ -415,12 +415,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_pm_sm_alloc(UINT8 ind)
+void btm_pm_sm_alloc(uint8_t ind)
 {
     tBTM_PM_MCB *p_db = &btm_cb.pm_mode_db[ind];   /* per ACL link */
     memset (p_db, 0, sizeof(tBTM_PM_MCB));
     p_db->state = BTM_PM_ST_ACTIVE;
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
     BTM_TRACE_DEBUG( "btm_pm_sm_alloc ind:%d st:%d", ind, p_db->state);
 #endif  // BTM_PM_DEBUG
 }
@@ -438,7 +438,7 @@
 static int btm_pm_find_acl_ind(BD_ADDR remote_bda)
 {
     tACL_CONN   *p = &btm_cb.acl_db[0];
-    UINT8 xx;
+    uint8_t xx;
 
     for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p++)
     {
@@ -448,7 +448,7 @@
 #endif  // BLE_INCLUDED
             )
         {
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
             BTM_TRACE_DEBUG( "btm_pm_find_acl_ind ind:%d, st:%d", xx, btm_cb.pm_mode_db[xx].state);
 #endif  // BTM_PM_DEBUG
             break;
@@ -466,7 +466,7 @@
 *******************************************************************************/
 static tBTM_PM_PWR_MD * btm_pm_compare_modes(tBTM_PM_PWR_MD *p_md1, tBTM_PM_PWR_MD *p_md2, tBTM_PM_PWR_MD *p_res)
 {
-    UINT8 res;
+    uint8_t res;
 
     if(p_md1 == NULL)
     {
@@ -538,7 +538,7 @@
 ** Returns      void
 **
 *******************************************************************************/
-static tBTM_PM_MODE btm_pm_get_set_mode(UINT8 pm_id, tBTM_PM_MCB *p_cb, tBTM_PM_PWR_MD *p_mode, tBTM_PM_PWR_MD *p_res)
+static tBTM_PM_MODE btm_pm_get_set_mode(uint8_t pm_id, tBTM_PM_MCB *p_cb, tBTM_PM_PWR_MD *p_mode, tBTM_PM_PWR_MD *p_res)
 {
     int   xx, loop_max;
     tBTM_PM_PWR_MD *p_md = NULL;
@@ -600,19 +600,19 @@
 ** Function     btm_pm_snd_md_req
 ** Description  get the resulting mode and send the resuest to host controller
 ** Returns      tBTM_STATUS
-**, BOOLEAN *p_chg_ind
+**, bool    *p_chg_ind
 *******************************************************************************/
-static tBTM_STATUS btm_pm_snd_md_req(UINT8 pm_id, int link_ind, tBTM_PM_PWR_MD *p_mode)
+static tBTM_STATUS btm_pm_snd_md_req(uint8_t pm_id, int link_ind, tBTM_PM_PWR_MD *p_mode)
 {
     tBTM_PM_PWR_MD  md_res;
     tBTM_PM_MODE    mode;
     tBTM_PM_MCB *p_cb = &btm_cb.pm_mode_db[link_ind];
-    BOOLEAN      chg_ind = FALSE;
+    bool         chg_ind = false;
 
     mode = btm_pm_get_set_mode(pm_id, p_cb, p_mode, &md_res);
     md_res.mode = mode;
 
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
     BTM_TRACE_DEBUG( "btm_pm_snd_md_req link_ind:%d, mode: %d",
         link_ind, mode);
 #endif  // BTM_PM_DEBUG
@@ -624,15 +624,15 @@
             ((md_res.max >= p_cb->interval) && (md_res.min <= p_cb->interval)) )
             return BTM_CMD_STORED;
         /* Otherwise, needs to wake, then sleep */
-        chg_ind = TRUE;
+        chg_ind = true;
     }
     p_cb->chg_ind = chg_ind;
 
      /* cannot go directly from current mode to resulting mode. */
     if( mode != BTM_PM_MD_ACTIVE && p_cb->state != BTM_PM_MD_ACTIVE)
-        p_cb->chg_ind = TRUE; /* needs to wake, then sleep */
+        p_cb->chg_ind = true; /* needs to wake, then sleep */
 
-    if(p_cb->chg_ind == TRUE) /* needs to wake first */
+    if(p_cb->chg_ind == true) /* needs to wake first */
         md_res.mode = BTM_PM_MD_ACTIVE;
 #if (BTM_SSR_INCLUDED == TRUE)
     else if(BTM_PM_MD_SNIFF == md_res.mode && p_cb->max_lat)
@@ -648,7 +648,7 @@
     /* send the appropriate HCI command */
     btm_cb.pm_pend_id   = pm_id;
 
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
     BTM_TRACE_DEBUG("btm_pm_snd_md_req state:0x%x, link_ind: %d", p_cb->state, link_ind);
 #endif  // BTM_PM_DEBUG
 
@@ -709,7 +709,7 @@
     if(btm_cb.pm_pend_link == MAX_L2CAP_LINKS)
     {
         /* the command was not sent */
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
         BTM_TRACE_DEBUG( "pm_pend_link: %d",btm_cb.pm_pend_link);
 #endif  // BTM_PM_DEBUG
         return (BTM_NO_RESOURCES);
@@ -756,7 +756,7 @@
 ** Returns          none.
 **
 *******************************************************************************/
-void btm_pm_proc_cmd_status(UINT8 status)
+void btm_pm_proc_cmd_status(uint8_t status)
 {
     tBTM_PM_MCB     *p_cb;
     tBTM_PM_STATUS  pm_status;
@@ -770,7 +770,7 @@
     {
         p_cb->state = BTM_PM_ST_PENDING;
         pm_status = BTM_PM_STS_PENDING;
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
         BTM_TRACE_DEBUG( "btm_pm_proc_cmd_status new state:0x%x", p_cb->state);
 #endif // BTM_PM_DEBUG
     }
@@ -787,7 +787,7 @@
     }
 
     /* no pending cmd now */
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
     BTM_TRACE_DEBUG( "btm_pm_proc_cmd_status state:0x%x, pm_pend_link: %d(new: %d)",
         p_cb->state, btm_cb.pm_pend_link, MAX_L2CAP_LINKS);
 #endif  // BTM_PM_DEBUG
@@ -810,7 +810,7 @@
 ** Returns          none.
 **
 *******************************************************************************/
-void btm_pm_proc_mode_change (UINT8 hci_status, UINT16 hci_handle, UINT8 mode, UINT16 interval)
+void btm_pm_proc_mode_change (uint8_t hci_status, uint16_t hci_handle, uint8_t mode, uint16_t interval)
 {
     tACL_CONN   *p;
     tBTM_PM_MCB *p_cb = NULL;
@@ -855,7 +855,7 @@
     /* new request has been made. - post a message to BTU task */
     if(old_state & BTM_PM_STORED_MASK)
     {
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
         BTM_TRACE_DEBUG( "btm_pm_proc_mode_change: Sending stored req:%d", xx);
 #endif  // BTM_PM_DEBUG
         btm_pm_snd_md_req(BTM_PM_SET_ONLY_ID, xx, NULL);
@@ -864,9 +864,9 @@
     {
         for(zz=0; zz<MAX_L2CAP_LINKS; zz++)
         {
-            if(btm_cb.pm_mode_db[zz].chg_ind == TRUE)
+            if(btm_cb.pm_mode_db[zz].chg_ind == true)
             {
-#if BTM_PM_DEBUG == TRUE
+#if (BTM_PM_DEBUG == TRUE)
                 BTM_TRACE_DEBUG( "btm_pm_proc_mode_change: Sending PM req :%d", zz);
 #endif   // BTM_PM_DEBUG
                 btm_pm_snd_md_req(BTM_PM_SET_ONLY_ID, zz, NULL);
@@ -883,7 +883,7 @@
             (*btm_cb.pm_reg_db[yy].cback)( p->remote_addr, mode, interval, hci_status);
         }
     }
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
     /*check if sco disconnect  is waiting for the mode change */
     btm_sco_disc_chk_pend_for_modechange(hci_handle);
 #endif
@@ -902,15 +902,15 @@
 **
 *******************************************************************************/
 #if (BTM_SSR_INCLUDED == TRUE)
-void btm_pm_proc_ssr_evt (UINT8 *p, UINT16 evt_len)
+void btm_pm_proc_ssr_evt (uint8_t *p, uint16_t evt_len)
 {
-    UINT8       status;
-    UINT16      handle;
-    UINT16      max_rx_lat;
+    uint8_t     status;
+    uint16_t    handle;
+    uint16_t    max_rx_lat;
     int         xx, yy;
     tBTM_PM_MCB *p_cb;
     tACL_CONN   *p_acl=NULL;
-    UINT16      use_ssr = TRUE;
+    uint16_t    use_ssr = true;
     UNUSED(evt_len);
 
     STREAM_TO_UINT8 (status, p);
@@ -928,7 +928,7 @@
     if(p_cb->interval == max_rx_lat)
     {
         /* using legacy sniff */
-        use_ssr = FALSE;
+        use_ssr = false;
     }
 
     /* notify registered parties */
@@ -951,10 +951,10 @@
 **
 ** Description      This function is called to check if in active or sniff mode
 **
-** Returns          TRUE, if in active or sniff mode
+** Returns          true, if in active or sniff mode
 **
 *******************************************************************************/
-BOOLEAN btm_pm_device_in_active_or_sniff_mode(void)
+bool    btm_pm_device_in_active_or_sniff_mode(void)
 {
     /* The active state is the highest state-includes connected device and sniff mode*/
 
@@ -962,19 +962,19 @@
     if (BTM_GetNumAclLinks() > 0)
     {
         BTM_TRACE_DEBUG("%s - ACL links: %d", __func__, BTM_GetNumAclLinks());
-        return TRUE;
+        return true;
     }
 
-#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
+#if (BLE_INCLUDED == TRUE)
     /* Check BLE states */
     if (btm_ble_get_conn_st() != BLE_CONN_IDLE)
     {
         BTM_TRACE_DEBUG("%s - BLE state: %x", __func__, btm_ble_get_conn_st());
-        return TRUE;
+        return true;
     }
 #endif
 
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -983,10 +983,10 @@
 **
 ** Description      This function is called to check if in paging, inquiry or connecting mode
 **
-** Returns          TRUE, if in paging, inquiry or connecting mode
+** Returns          true, if in paging, inquiry or connecting mode
 **
 *******************************************************************************/
-BOOLEAN btm_pm_device_in_scan_state(void)
+bool    btm_pm_device_in_scan_state(void)
 {
     /* Scan state-paging, inquiry, and trying to connect */
 
@@ -995,17 +995,17 @@
        BTM_BL_PAGING_STARTED == btm_cb.busy_level)
     {
        BTM_TRACE_DEBUG("btm_pm_device_in_scan_state- paging");
-       return TRUE;
+       return true;
     }
 
     /* Check for inquiry */
     if ((btm_cb.btm_inq_vars.inq_active & (BTM_BR_INQ_ACTIVE_MASK | BTM_BLE_INQ_ACTIVE_MASK)) != 0)
     {
         BTM_TRACE_DEBUG("btm_pm_device_in_scan_state- Inq active");
-        return TRUE;
+        return true;
     }
 
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -1019,10 +1019,10 @@
 *******************************************************************************/
 tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void)
 {
-    if (TRUE == btm_pm_device_in_active_or_sniff_mode())
+    if (true == btm_pm_device_in_active_or_sniff_mode())
        return BTM_CONTRL_ACTIVE;
     else
-    if (TRUE == btm_pm_device_in_scan_state())
+    if (true == btm_pm_device_in_scan_state())
        return BTM_CONTRL_SCAN;
     else
        return BTM_CONTRL_IDLE;
diff --git a/stack/btm/btm_sco.c b/stack/btm/btm_sco.c
index 4ceb640..ca069bb 100644
--- a/stack/btm/btm_sco.c
+++ b/stack/btm/btm_sco.c
@@ -37,7 +37,7 @@
 #include "device/include/controller.h"
 
 
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
 
 /********************************************************************************/
 /*                 L O C A L    D A T A    D E F I N I T I O N S                */
@@ -81,9 +81,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sco_flush_sco_data(UINT16 sco_inx)
+void btm_sco_flush_sco_data(uint16_t sco_inx)
 {
-#if BTM_SCO_HCI_INCLUDED == TRUE
+#if (BTM_SCO_HCI_INCLUDED == TRUE)
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN   *p ;
     BT_HDR      *p_buf;
@@ -117,7 +117,7 @@
     memset (&btm_cb.sco_cb, 0, sizeof(tSCO_CB));
 #endif
 
-#if BTM_SCO_HCI_INCLUDED == TRUE
+#if (BTM_SCO_HCI_INCLUDED == TRUE)
     for (int i = 0; i < BTM_MAX_SCO_LINKS; i++)
         btm_cb.sco_cb.sco_db[i].xmit_data_q = fixed_queue_new(SIZE_MAX);
 #endif
@@ -145,13 +145,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btm_esco_conn_rsp (UINT16 sco_inx, UINT8 hci_status, BD_ADDR bda,
+static void btm_esco_conn_rsp (uint16_t sco_inx, uint8_t hci_status, BD_ADDR bda,
                                tBTM_ESCO_PARAMS *p_parms)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN        *p_sco = NULL;
     tBTM_ESCO_PARAMS *p_setup;
-    UINT16            temp_pkt_types;
+    uint16_t          temp_pkt_types;
 
     if (sco_inx < BTM_MAX_SCO_LINKS)
         p_sco = &btm_cb.sco_cb.sco_db[sco_inx];
@@ -233,7 +233,7 @@
 }
 
 
-#if BTM_SCO_HCI_INCLUDED == TRUE
+#if (BTM_SCO_HCI_INCLUDED == TRUE)
 /*******************************************************************************
 **
 ** Function         btm_sco_check_send_pkts
@@ -244,7 +244,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sco_check_send_pkts (UINT16 sco_inx)
+void btm_sco_check_send_pkts (uint16_t sco_inx)
 {
     tSCO_CB  *p_cb = &btm_cb.sco_cb;
     tSCO_CONN   *p_ccb = &p_cb->sco_db[sco_inx];
@@ -253,7 +253,7 @@
     BT_HDR  *p_buf;
     while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_ccb->xmit_data_q)) != NULL)
     {
-#if BTM_SCO_HCI_DEBUG
+#if (BTM_SCO_HCI_DEBUG == TRUE)
         BTM_TRACE_DEBUG("btm: [%d] buf in xmit_data_q",
                         fixed_queue_length(p_ccb->xmit_data_q) + 1);
 #endif
@@ -274,11 +274,11 @@
 *******************************************************************************/
 void  btm_route_sco_data(BT_HDR *p_msg)
 {
-#if BTM_SCO_HCI_INCLUDED == TRUE
-    UINT16      sco_inx, handle;
-    UINT8       *p = (UINT8 *)(p_msg + 1) + p_msg->offset;
-    UINT8       pkt_size = 0;
-    UINT8       pkt_status = 0;
+#if (BTM_SCO_HCI_INCLUDED == TRUE)
+    uint16_t    sco_inx, handle;
+    uint8_t     *p = (uint8_t *)(p_msg + 1) + p_msg->offset;
+    uint8_t     pkt_size = 0;
+    uint8_t     pkt_status = 0;
 
     /* Extract Packet_Status_Flag and handle */
     STREAM_TO_UINT16 (handle, p);
@@ -328,11 +328,11 @@
 **
 **
 *******************************************************************************/
-tBTM_STATUS BTM_WriteScoData (UINT16 sco_inx, BT_HDR *p_buf)
+tBTM_STATUS BTM_WriteScoData (uint16_t sco_inx, BT_HDR *p_buf)
 {
-#if (BTM_SCO_HCI_INCLUDED == TRUE) && (BTM_MAX_SCO_LINKS>0)
+#if (BTM_SCO_HCI_INCLUDED == TRUE && BTM_MAX_SCO_LINKS > 0)
     tSCO_CONN   *p_ccb = &btm_cb.sco_cb.sco_db[sco_inx];
-    UINT8   *p;
+    uint8_t *p;
     tBTM_STATUS     status = BTM_SUCCESS;
 
     if (sco_inx < BTM_MAX_SCO_LINKS && btm_cb.sco_cb.p_data_cb &&
@@ -350,7 +350,7 @@
             /* Step back 3 bytes to add the headers */
             p_buf->offset -= HCI_SCO_PREAMBLE_SIZE;
             /* 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;
             /* add HCI handle */
             UINT16_TO_STREAM (p, p_ccb->hci_handle);
             /* only sent the first BTM_SCO_DATA_SIZE_MAX bytes data if more than max,
@@ -361,7 +361,7 @@
                 status = BTM_SCO_BAD_LENGTH;
             }
 
-            UINT8_TO_STREAM (p, (UINT8)p_buf->len);
+            UINT8_TO_STREAM (p, (uint8_t)p_buf->len);
             p_buf->len += HCI_SCO_PREAMBLE_SIZE;
 
             fixed_queue_enqueue(p_ccb->xmit_data_q, p_buf);
@@ -397,11 +397,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static tBTM_STATUS btm_send_connect_request(UINT16 acl_handle,
+static tBTM_STATUS btm_send_connect_request(uint16_t acl_handle,
                                             tBTM_ESCO_PARAMS *p_setup)
 {
-    UINT16 temp_pkt_types;
-    UINT8 xx;
+    uint16_t temp_pkt_types;
+    uint8_t xx;
     tACL_CONN *p_acl;
 
     /* Send connect request depending on version of spec */
@@ -446,21 +446,21 @@
             if (BTM_BothEndsSupportSecureConnections(p_acl->remote_addr))
             {
                 temp_pkt_types &= ~(BTM_SCO_PKT_TYPE_MASK);
-                BTM_TRACE_DEBUG("%s: SCO Conn: pkt_types after removing SCO (0x%04x)", __FUNCTION__,
+                BTM_TRACE_DEBUG("%s: SCO Conn: pkt_types after removing SCO (0x%04x)", __func__,
                                  temp_pkt_types);
 
                 /* Return error if no packet types left */
                 if (temp_pkt_types == 0)
                 {
                     BTM_TRACE_ERROR("%s: SCO Conn (BR/EDR SC): No packet types available",
-                                    __FUNCTION__);
+                                    __func__);
                     return (BTM_WRONG_MODE);
                 }
             }
             else
             {
                 BTM_TRACE_DEBUG("%s: SCO Conn(BR/EDR SC):local or peer does not support BR/EDR SC",
-                                __FUNCTION__);
+                                __func__);
             }
         }
 
@@ -511,7 +511,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_accept_sco_link(UINT16 sco_inx, tBTM_ESCO_PARAMS *p_setup,
+void btm_accept_sco_link(uint16_t sco_inx, tBTM_ESCO_PARAMS *p_setup,
                          tBTM_SCO_CB *p_conn_cb, tBTM_SCO_CB *p_disc_cb)
 {
 #if (BTM_MAX_SCO_LINKS>0)
@@ -546,7 +546,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_reject_sco_link( UINT16 sco_inx )
+void btm_reject_sco_link( uint16_t sco_inx )
 {
     btm_esco_conn_rsp(sco_inx, HCI_ERR_HOST_REJECT_RESOURCES,
                       btm_cb.sco_cb.sco_db[sco_inx].esco.data.bd_addr, NULL);
@@ -557,7 +557,7 @@
 ** Function         BTM_CreateSco
 **
 ** Description      This function is called to create an SCO connection. If the
-**                  "is_orig" flag is TRUE, the connection will be originated,
+**                  "is_orig" flag is true, the connection will be originated,
 **                  otherwise BTM will wait for the other side to connect.
 **
 **                  NOTE:  If BTM_IGNORE_SCO_PKT_TYPE is passed in the pkt_types
@@ -572,23 +572,23 @@
 **                                   with the sco index used for the connection.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, BOOLEAN is_orig, UINT16 pkt_types,
-                           UINT16 *p_sco_inx, tBTM_SCO_CB *p_conn_cb,
+tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, bool    is_orig, uint16_t pkt_types,
+                           uint16_t *p_sco_inx, tBTM_SCO_CB *p_conn_cb,
                            tBTM_SCO_CB *p_disc_cb)
 {
 #if (BTM_MAX_SCO_LINKS > 0)
     tBTM_ESCO_PARAMS *p_setup;
     tSCO_CONN        *p = &btm_cb.sco_cb.sco_db[0];
-    UINT16            xx;
-    UINT16            acl_handle = 0;
-    UINT16            temp_pkt_types;
+    uint16_t          xx;
+    uint16_t          acl_handle = 0;
+    uint16_t          temp_pkt_types;
     tACL_CONN        *p_acl;
 
 #if (BTM_SCO_WAKE_PARKED_LINK == TRUE)
     tBTM_PM_PWR_MD    pm;
     tBTM_PM_STATE     state;
 #else
-    UINT8             mode;
+    uint8_t           mode;
 #endif  // BTM_SCO_WAKE_PARKED_LINK
 
     *p_sco_inx = BTM_INVALID_SCO_INDEX;
@@ -633,7 +633,7 @@
                 if (is_orig)
                 {
                     /* can not create SCO link if in park mode */
-#if BTM_SCO_WAKE_PARKED_LINK == TRUE
+#if (BTM_SCO_WAKE_PARKED_LINK == TRUE)
                     if ((btm_read_power_mode_state(p->esco.data.bd_addr, &state) == BTM_SUCCESS))
                     {
                         if (state == BTM_PM_ST_SNIFF || state == BTM_PM_ST_PARK ||
@@ -652,10 +652,10 @@
 #endif  // BTM_SCO_WAKE_PARKED_LINK
                 }
                 memcpy (p->esco.data.bd_addr, remote_bda, BD_ADDR_LEN);
-                p->rem_bd_known = TRUE;
+                p->rem_bd_known = true;
             }
             else
-                p->rem_bd_known = FALSE;
+                p->rem_bd_known = false;
 
             /* Link role is ignored in for this message */
             if (pkt_types == BTM_IGNORE_SCO_PKT_TYPE)
@@ -740,11 +740,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sco_chk_pend_unpark (UINT8 hci_status, UINT16 hci_handle)
+void btm_sco_chk_pend_unpark (uint8_t hci_status, uint16_t hci_handle)
 {
 #if (BTM_MAX_SCO_LINKS>0)
-    UINT16      xx;
-    UINT16      acl_handle;
+    uint16_t    xx;
+    uint16_t    acl_handle;
     tSCO_CONN   *p = &btm_cb.sco_cb.sco_db[0];
 
     for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++)
@@ -774,11 +774,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sco_chk_pend_rolechange (UINT16 hci_handle)
+void btm_sco_chk_pend_rolechange (uint16_t hci_handle)
 {
 #if (BTM_MAX_SCO_LINKS>0)
-    UINT16      xx;
-    UINT16      acl_handle;
+    uint16_t    xx;
+    uint16_t    acl_handle;
     tSCO_CONN   *p = &btm_cb.sco_cb.sco_db[0];
 
     for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++)
@@ -806,7 +806,7 @@
 ** Returns         void
 **
 *******************************************************************************/
-void btm_sco_disc_chk_pend_for_modechange (UINT16 hci_handle)
+void btm_sco_disc_chk_pend_for_modechange (uint16_t hci_handle)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN   *p = &btm_cb.sco_cb.sco_db[0];
@@ -814,7 +814,7 @@
     BTM_TRACE_DEBUG("%s: hci_handle 0x%04x, p->state 0x%02x", __func__,
                      hci_handle, p->state);
 
-    for (UINT16 xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++)
+    for (uint16_t xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++)
     {
         if ((p->state == SCO_ST_PEND_MODECHANGE) &&
             (BTM_GetHCIConnHandle (p->esco.data.bd_addr, BT_TRANSPORT_BR_EDR)) == hci_handle)
@@ -837,12 +837,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sco_conn_req (BD_ADDR bda,  DEV_CLASS dev_class, UINT8 link_type)
+void btm_sco_conn_req (BD_ADDR bda,  DEV_CLASS dev_class, uint8_t link_type)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CB     *p_sco = &btm_cb.sco_cb;
     tSCO_CONN   *p = &p_sco->sco_db[0];
-    UINT16      xx;
+    uint16_t    xx;
     tBTM_ESCO_CONN_REQ_EVT_DATA evt_data;
 
     for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++)
@@ -857,7 +857,7 @@
             ((p->state == SCO_ST_LISTENING) && (rem_bd_matches || !p->rem_bd_known)))
         {
             /* If this guy was a wildcard, he is not one any more */
-            p->rem_bd_known = TRUE;
+            p->rem_bd_known = true;
             p->esco.data.link_type = link_type;
             p->state = SCO_ST_W4_CONN_RSP;
             memcpy (p->esco.data.bd_addr, bda, BD_ADDR_LEN);
@@ -903,12 +903,12 @@
         {
             if (p->state == SCO_ST_UNUSED)
             {
-                p->is_orig = FALSE;
+                p->is_orig = false;
                 p->state = SCO_ST_LISTENING;
 
                 p->esco.data.link_type = link_type;
                 memcpy (p->esco.data.bd_addr, bda, BD_ADDR_LEN);
-                p->rem_bd_known = TRUE;
+                p->rem_bd_known = true;
                 break;
             }
         }
@@ -935,13 +935,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sco_connected (UINT8 hci_status, BD_ADDR bda, UINT16 hci_handle,
+void btm_sco_connected (uint8_t hci_status, BD_ADDR bda, uint16_t hci_handle,
                         tBTM_ESCO_DATA *p_esco_data)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN   *p = &btm_cb.sco_cb.sco_db[0];
-    UINT16      xx;
-    BOOLEAN     spt = FALSE;
+    uint16_t    xx;
+    bool        spt = false;
     tBTM_CHG_ESCO_PARAMS parms;
 #endif
 
@@ -990,7 +990,7 @@
             }
 
             if (p->state == SCO_ST_LISTENING)
-                spt = TRUE;
+                spt = true;
 
             p->state = SCO_ST_CONNECTED;
             p->hci_handle = hci_handle;
@@ -1034,7 +1034,7 @@
 **                  no match.
 **
 *******************************************************************************/
-UINT16  btm_find_scb_by_handle (UINT16 handle)
+uint16_t btm_find_scb_by_handle (uint16_t handle)
 {
     int         xx;
     tSCO_CONN    *p = &btm_cb.sco_cb.sco_db[0];
@@ -1060,11 +1060,11 @@
 ** Returns          status of the operation
 **
 *******************************************************************************/
-tBTM_STATUS BTM_RemoveSco (UINT16 sco_inx)
+tBTM_STATUS BTM_RemoveSco (uint16_t sco_inx)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN   *p = &btm_cb.sco_cb.sco_db[sco_inx];
-    UINT16       tempstate;
+    uint16_t     tempstate;
     tBTM_PM_STATE   state = BTM_PM_ST_INVALID;
 
     BTM_TRACE_DEBUG("%s", __func__);
@@ -1119,7 +1119,7 @@
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN   *p = &btm_cb.sco_cb.sco_db[0];
-    UINT16       xx;
+    uint16_t     xx;
 
     for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++)
     {
@@ -1141,11 +1141,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sco_removed (UINT16 hci_handle, UINT8 reason)
+void btm_sco_removed (uint16_t hci_handle, uint8_t reason)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN   *p = &btm_cb.sco_cb.sco_db[0];
-    UINT16      xx;
+    uint16_t    xx;
 #endif
 
     btm_cb.sco_cb.sco_disc_reason = reason;
@@ -1160,7 +1160,7 @@
 
             p->state = SCO_ST_UNUSED;
             p->hci_handle = BTM_INVALID_HCI_HANDLE;
-            p->rem_bd_known = FALSE;
+            p->rem_bd_known = false;
             p->esco.p_esco_cback = NULL;    /* Deregister eSCO callback */
             (*p->p_disc_cb)(xx);
 
@@ -1188,7 +1188,7 @@
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN   *p = &btm_cb.sco_cb.sco_db[0];
-    UINT16      xx;
+    uint16_t    xx;
 
     for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++)
     {
@@ -1232,7 +1232,7 @@
 ** Returns          status of the operation
 **
 *******************************************************************************/
-tBTM_STATUS BTM_SetScoPacketTypes (UINT16 sco_inx, UINT16 pkt_types)
+tBTM_STATUS BTM_SetScoPacketTypes (uint16_t sco_inx, uint16_t pkt_types)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tBTM_CHG_ESCO_PARAMS parms;
@@ -1277,7 +1277,7 @@
 **                  BTM_SCO_PKT_TYPES_MASK_NO_3_EV5
 **
 *******************************************************************************/
-UINT16 BTM_ReadScoPacketTypes (UINT16 sco_inx)
+uint16_t BTM_ReadScoPacketTypes (uint16_t sco_inx)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN *p = &btm_cb.sco_cb.sco_db[sco_inx];
@@ -1303,9 +1303,9 @@
 ** Returns          HCI reason or BTM_INVALID_SCO_DISC_REASON if not set.
 **
 *******************************************************************************/
-UINT16 BTM_ReadScoDiscReason (void)
+uint16_t BTM_ReadScoDiscReason (void)
 {
-    UINT16 res = btm_cb.sco_cb.sco_disc_reason;
+    uint16_t res = btm_cb.sco_cb.sco_disc_reason;
     btm_cb.sco_cb.sco_disc_reason = BTM_INVALID_SCO_DISC_REASON;
     return (res);
 }
@@ -1331,7 +1331,7 @@
 **                  BTM_SCO_PKT_TYPES_MASK_NO_3_EV5
 **
 *******************************************************************************/
-UINT16 BTM_ReadDeviceScoPacketTypes (void)
+uint16_t BTM_ReadDeviceScoPacketTypes (void)
 {
     return (btm_cb.btm_sco_pkt_types_supported);
 }
@@ -1346,7 +1346,7 @@
 ** Returns          handle for the connection, or 0xFFFF if invalid SCO index.
 **
 *******************************************************************************/
-UINT16 BTM_ReadScoHandle (UINT16 sco_inx)
+uint16_t BTM_ReadScoHandle (uint16_t sco_inx)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN   *p = &btm_cb.sco_cb.sco_db[sco_inx];
@@ -1371,7 +1371,7 @@
 ** Returns          pointer to BD address or NULL if not known
 **
 *******************************************************************************/
-UINT8 *BTM_ReadScoBdAddr (UINT16 sco_inx)
+uint8_t *BTM_ReadScoBdAddr (uint16_t sco_inx)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN   *p = &btm_cb.sco_cb.sco_db[sco_inx];
@@ -1461,7 +1461,7 @@
 **                          later or does not support eSCO.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_RegForEScoEvts (UINT16 sco_inx, tBTM_ESCO_CBACK *p_esco_cback)
+tBTM_STATUS BTM_RegForEScoEvts (uint16_t sco_inx, tBTM_ESCO_CBACK *p_esco_cback)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     if (!btm_cb.sco_cb.esco_supported)
@@ -1498,10 +1498,10 @@
 **                  BTM_WRONG_MODE if no connection with a peer device or bad sco_inx.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_ReadEScoLinkParms (UINT16 sco_inx, tBTM_ESCO_DATA *p_parms)
+tBTM_STATUS BTM_ReadEScoLinkParms (uint16_t sco_inx, tBTM_ESCO_DATA *p_parms)
 {
 #if (BTM_MAX_SCO_LINKS>0)
-    UINT8 index;
+    uint8_t index;
 
     BTM_TRACE_API("BTM_ReadEScoLinkParms -> sco_inx 0x%04x", sco_inx);
 
@@ -1551,12 +1551,12 @@
 **                  BTM_WRONG_MODE if no connection with a peer device or bad sco_inx.
 **
 *******************************************************************************/
-tBTM_STATUS BTM_ChangeEScoLinkParms (UINT16 sco_inx, tBTM_CHG_ESCO_PARAMS *p_parms)
+tBTM_STATUS BTM_ChangeEScoLinkParms (uint16_t sco_inx, tBTM_CHG_ESCO_PARAMS *p_parms)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tBTM_ESCO_PARAMS *p_setup;
     tSCO_CONN        *p_sco;
-    UINT16            temp_pkt_types;
+    uint16_t          temp_pkt_types;
 
     /* Make sure sco handle is valid and on an active link */
     if (sco_inx >= BTM_MAX_SCO_LINKS ||
@@ -1630,7 +1630,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void BTM_EScoConnRsp (UINT16 sco_inx, UINT8 hci_status, tBTM_ESCO_PARAMS *p_parms)
+void BTM_EScoConnRsp (uint16_t sco_inx, uint8_t hci_status, tBTM_ESCO_PARAMS *p_parms)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     if (sco_inx < BTM_MAX_SCO_LINKS &&
@@ -1673,14 +1673,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_esco_proc_conn_chg (UINT8 status, UINT16 handle, UINT8 tx_interval,
-                             UINT8 retrans_window, UINT16 rx_pkt_len,
-                             UINT16 tx_pkt_len)
+void btm_esco_proc_conn_chg (uint8_t status, uint16_t handle, uint8_t tx_interval,
+                             uint8_t retrans_window, uint16_t rx_pkt_len,
+                             uint16_t tx_pkt_len)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN               *p = &btm_cb.sco_cb.sco_db[0];
     tBTM_CHG_ESCO_EVT_DATA   data;
-    UINT16                   xx;
+    uint16_t                 xx;
 
     BTM_TRACE_EVENT("btm_esco_proc_conn_chg -> handle 0x%04x, status 0x%02x",
                       handle, status);
@@ -1716,22 +1716,22 @@
 ** Description      This function is called to see if a SCO handle is already in
 **                  use.
 **
-** Returns          BOOLEAN
+** Returns          bool
 **
 *******************************************************************************/
-BOOLEAN btm_is_sco_active (UINT16 handle)
+bool    btm_is_sco_active (uint16_t handle)
 {
 #if (BTM_MAX_SCO_LINKS>0)
-    UINT16     xx;
+    uint16_t   xx;
     tSCO_CONN *p = &btm_cb.sco_cb.sco_db[0];
 
     for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++)
     {
         if (handle == p->hci_handle && p->state == SCO_ST_CONNECTED)
-            return (TRUE);
+            return (true);
     }
 #endif
-    return (FALSE);
+    return (false);
 }
 
 /*******************************************************************************
@@ -1740,15 +1740,15 @@
 **
 ** Description      This function returns the number of active sco links.
 **
-** Returns          UINT8
+** Returns          uint8_t
 **
 *******************************************************************************/
-UINT8 BTM_GetNumScoLinks (void)
+uint8_t BTM_GetNumScoLinks (void)
 {
 #if (BTM_MAX_SCO_LINKS>0)
     tSCO_CONN *p = &btm_cb.sco_cb.sco_db[0];
-    UINT16     xx;
-    UINT8      num_scos = 0;
+    uint16_t   xx;
+    uint8_t    num_scos = 0;
 
     for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++)
     {
@@ -1775,13 +1775,13 @@
 **
 ** Description      This function is called to see if a SCO active to a bd address.
 **
-** Returns          BOOLEAN
+** Returns          bool
 **
 *******************************************************************************/
-BOOLEAN btm_is_sco_active_by_bdaddr (BD_ADDR remote_bda)
+bool    btm_is_sco_active_by_bdaddr (BD_ADDR remote_bda)
 {
 #if (BTM_MAX_SCO_LINKS>0)
-    UINT8 xx;
+    uint8_t xx;
     tSCO_CONN *p = &btm_cb.sco_cb.sco_db[0];
 
     /* If any SCO is being established to the remote BD address, refuse this */
@@ -1789,30 +1789,30 @@
     {
         if ((!memcmp (p->esco.data.bd_addr, remote_bda, BD_ADDR_LEN)) && (p->state == SCO_ST_CONNECTED))
         {
-            return (TRUE);
+            return (true);
         }
     }
 #endif
-    return (FALSE);
+    return (false);
 }
 #else   /* SCO_EXCLUDED == TRUE (Link in stubs) */
 
-tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, BOOLEAN is_orig,
-                           UINT16 pkt_types, UINT16 *p_sco_inx,
+tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, bool    is_orig,
+                           uint16_t pkt_types, uint16_t *p_sco_inx,
                            tBTM_SCO_CB *p_conn_cb,
                            tBTM_SCO_CB *p_disc_cb) {return (BTM_NO_RESOURCES);}
-tBTM_STATUS BTM_RemoveSco (UINT16 sco_inx) {return (BTM_NO_RESOURCES);}
-tBTM_STATUS BTM_SetScoPacketTypes (UINT16 sco_inx, UINT16 pkt_types) {return (BTM_NO_RESOURCES);}
-UINT16 BTM_ReadScoPacketTypes (UINT16 sco_inx) {return (0);}
-UINT16 BTM_ReadDeviceScoPacketTypes (void) {return (0);}
-UINT16 BTM_ReadScoHandle (UINT16 sco_inx) {return (BTM_INVALID_HCI_HANDLE);}
-UINT8 *BTM_ReadScoBdAddr(UINT16 sco_inx) {return((UINT8 *) NULL);}
-UINT16 BTM_ReadScoDiscReason (void) {return (BTM_INVALID_SCO_DISC_REASON);}
+tBTM_STATUS BTM_RemoveSco (uint16_t sco_inx) {return (BTM_NO_RESOURCES);}
+tBTM_STATUS BTM_SetScoPacketTypes (uint16_t sco_inx, uint16_t pkt_types) {return (BTM_NO_RESOURCES);}
+uint16_t BTM_ReadScoPacketTypes (uint16_t sco_inx) {return (0);}
+uint16_t BTM_ReadDeviceScoPacketTypes (void) {return (0);}
+uint16_t BTM_ReadScoHandle (uint16_t sco_inx) {return (BTM_INVALID_HCI_HANDLE);}
+uint8_t *BTM_ReadScoBdAddr(uint16_t sco_inx) {return((uint8_t *) NULL);}
+uint16_t BTM_ReadScoDiscReason (void) {return (BTM_INVALID_SCO_DISC_REASON);}
 tBTM_STATUS BTM_SetEScoMode (tBTM_SCO_TYPE sco_mode, tBTM_ESCO_PARAMS *p_parms) {return (BTM_MODE_UNSUPPORTED);}
-tBTM_STATUS BTM_RegForEScoEvts (UINT16 sco_inx, tBTM_ESCO_CBACK *p_esco_cback) { return (BTM_ILLEGAL_VALUE);}
-tBTM_STATUS BTM_ReadEScoLinkParms (UINT16 sco_inx, tBTM_ESCO_DATA *p_parms) { return (BTM_MODE_UNSUPPORTED);}
-tBTM_STATUS BTM_ChangeEScoLinkParms (UINT16 sco_inx, tBTM_CHG_ESCO_PARAMS *p_parms) { return (BTM_MODE_UNSUPPORTED);}
-void BTM_EScoConnRsp (UINT16 sco_inx, UINT8 hci_status, tBTM_ESCO_PARAMS *p_parms) {}
-UINT8 BTM_GetNumScoLinks (void)  {return (0);}
+tBTM_STATUS BTM_RegForEScoEvts (uint16_t sco_inx, tBTM_ESCO_CBACK *p_esco_cback) { return (BTM_ILLEGAL_VALUE);}
+tBTM_STATUS BTM_ReadEScoLinkParms (uint16_t sco_inx, tBTM_ESCO_DATA *p_parms) { return (BTM_MODE_UNSUPPORTED);}
+tBTM_STATUS BTM_ChangeEScoLinkParms (uint16_t sco_inx, tBTM_CHG_ESCO_PARAMS *p_parms) { return (BTM_MODE_UNSUPPORTED);}
+void BTM_EScoConnRsp (uint16_t sco_inx, uint8_t hci_status, tBTM_ESCO_PARAMS *p_parms) {}
+uint8_t BTM_GetNumScoLinks (void)  {return (0);}
 
 #endif /* If SCO is being used */
diff --git a/stack/btm/btm_sec.c b/stack/btm/btm_sec.c
index 81829de..b946601 100644
--- a/stack/btm/btm_sec.c
+++ b/stack/btm/btm_sec.c
@@ -43,7 +43,7 @@
 #include <stdio.h>
 #endif
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     #include "gatt_int.h"
 #endif
 
@@ -52,22 +52,22 @@
 extern fixed_queue_t *btu_general_alarm_queue;
 
 #ifdef APPL_AUTH_WRITE_EXCEPTION
-BOOLEAN (APPL_AUTH_WRITE_EXCEPTION)(BD_ADDR bd_addr);
+bool    (APPL_AUTH_WRITE_EXCEPTION)(BD_ADDR bd_addr);
 #endif
 
 /********************************************************************************
 **              L O C A L    F U N C T I O N     P R O T O T Y P E S            *
 *********************************************************************************/
-tBTM_SEC_SERV_REC *btm_sec_find_first_serv (BOOLEAN is_originator, UINT16 psm);
+tBTM_SEC_SERV_REC *btm_sec_find_first_serv (bool    is_originator, uint16_t psm);
 static tBTM_SEC_SERV_REC *btm_sec_find_next_serv (tBTM_SEC_SERV_REC *p_cur);
-static tBTM_SEC_SERV_REC *btm_sec_find_mx_serv (UINT8 is_originator, UINT16 psm,
-                                                UINT32 mx_proto_id,
-                                                UINT32 mx_chan_id);
+static tBTM_SEC_SERV_REC *btm_sec_find_mx_serv (uint8_t is_originator, uint16_t psm,
+                                                uint32_t mx_proto_id,
+                                                uint32_t mx_chan_id);
 
 static tBTM_STATUS btm_sec_execute_procedure (tBTM_SEC_DEV_REC *p_dev_rec);
-static BOOLEAN  btm_sec_start_get_name (tBTM_SEC_DEV_REC *p_dev_rec);
-static BOOLEAN  btm_sec_start_authentication (tBTM_SEC_DEV_REC *p_dev_rec);
-static BOOLEAN  btm_sec_start_encryption (tBTM_SEC_DEV_REC *p_dev_rec);
+static bool     btm_sec_start_get_name (tBTM_SEC_DEV_REC *p_dev_rec);
+static bool     btm_sec_start_authentication (tBTM_SEC_DEV_REC *p_dev_rec);
+static bool     btm_sec_start_encryption (tBTM_SEC_DEV_REC *p_dev_rec);
 static void     btm_sec_collision_timeout(void *data);
 static void     btm_restore_mode(void);
 static void     btm_sec_pairing_timeout(void *data);
@@ -79,48 +79,48 @@
 #endif
 
 static void     btm_sec_check_pending_reqs(void);
-static BOOLEAN  btm_sec_queue_mx_request (BD_ADDR bd_addr,  UINT16 psm,  BOOLEAN is_orig,
-                                          UINT32 mx_proto_id, UINT32 mx_chan_id,
+static bool     btm_sec_queue_mx_request (BD_ADDR bd_addr,  uint16_t psm,  bool    is_orig,
+                                          uint32_t mx_proto_id, uint32_t mx_chan_id,
                                           tBTM_SEC_CALLBACK *p_callback, void *p_ref_data);
 static void     btm_sec_bond_cancel_complete (void);
 static void     btm_send_link_key_notif (tBTM_SEC_DEV_REC *p_dev_rec);
-static BOOLEAN  btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC  *p_dev_rec);
+static bool     btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC  *p_dev_rec);
 
-static UINT8    btm_sec_start_authorization (tBTM_SEC_DEV_REC *p_dev_rec);
-BOOLEAN         btm_sec_are_all_trusted(UINT32 p_mask[]);
+static uint8_t  btm_sec_start_authorization (tBTM_SEC_DEV_REC *p_dev_rec);
+bool            btm_sec_are_all_trusted(uint32_t p_mask[]);
 
-static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 reason, UINT16 conn_handle);
-UINT8           btm_sec_start_role_switch (tBTM_SEC_DEV_REC *p_dev_rec);
-tBTM_SEC_DEV_REC *btm_sec_find_dev_by_sec_state (UINT8 state);
+static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, uint8_t reason, uint16_t conn_handle);
+uint8_t         btm_sec_start_role_switch (tBTM_SEC_DEV_REC *p_dev_rec);
+tBTM_SEC_DEV_REC *btm_sec_find_dev_by_sec_state (uint8_t state);
 
-static BOOLEAN  btm_sec_set_security_level ( CONNECTION_TYPE conn_type, const char *p_name,
-                                            UINT8 service_id, UINT16 sec_level, UINT16 psm,
-                                            UINT32 mx_proto_id, UINT32 mx_chan_id);
+static bool     btm_sec_set_security_level ( CONNECTION_TYPE conn_type, const char *p_name,
+                                            uint8_t service_id, uint16_t sec_level, uint16_t psm,
+                                            uint32_t mx_proto_id, uint32_t mx_chan_id);
 
-static BOOLEAN btm_dev_authenticated(tBTM_SEC_DEV_REC *p_dev_rec);
-static BOOLEAN btm_dev_encrypted(tBTM_SEC_DEV_REC *p_dev_rec);
-static BOOLEAN btm_dev_authorized(tBTM_SEC_DEV_REC *p_dev_rec);
-static BOOLEAN btm_serv_trusted(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_SEC_SERV_REC *p_serv_rec);
-static BOOLEAN btm_sec_is_serv_level0 (UINT16 psm);
-static UINT16  btm_sec_set_serv_level4_flags (UINT16 cur_security, BOOLEAN is_originator);
+static bool    btm_dev_authenticated(tBTM_SEC_DEV_REC *p_dev_rec);
+static bool    btm_dev_encrypted(tBTM_SEC_DEV_REC *p_dev_rec);
+static bool    btm_dev_authorized(tBTM_SEC_DEV_REC *p_dev_rec);
+static bool    btm_serv_trusted(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_SEC_SERV_REC *p_serv_rec);
+static bool    btm_sec_is_serv_level0 (uint16_t psm);
+static uint16_t btm_sec_set_serv_level4_flags (uint16_t cur_security, bool    is_originator);
 
-static BOOLEAN btm_sec_queue_encrypt_request  (BD_ADDR bd_addr, tBT_TRANSPORT transport,
+static bool    btm_sec_queue_encrypt_request  (BD_ADDR bd_addr, tBT_TRANSPORT transport,
                                          tBTM_SEC_CALLBACK *p_callback, void *p_ref_data,
                                          tBTM_BLE_SEC_ACT sec_act);
 static void btm_sec_check_pending_enc_req (tBTM_SEC_DEV_REC  *p_dev_rec, tBT_TRANSPORT transport,
-                                            UINT8 encr_enable);
+                                            uint8_t encr_enable);
 
-static BOOLEAN btm_sec_use_smp_br_chnl(tBTM_SEC_DEV_REC *p_dev_rec);
-static BOOLEAN btm_sec_is_master(tBTM_SEC_DEV_REC *p_dev_rec);
+static bool    btm_sec_use_smp_br_chnl(tBTM_SEC_DEV_REC *p_dev_rec);
+static bool    btm_sec_is_master(tBTM_SEC_DEV_REC *p_dev_rec);
 
-/* TRUE - authenticated link key is possible */
-static const BOOLEAN btm_sec_io_map [BTM_IO_CAP_MAX][BTM_IO_CAP_MAX] =
+/* true - authenticated link key is possible */
+static const bool    btm_sec_io_map [BTM_IO_CAP_MAX][BTM_IO_CAP_MAX] =
 {
     /*   OUT,    IO,     IN,     NONE */
-/* OUT  */ {FALSE,  FALSE,  TRUE,   FALSE},
-/* IO   */ {FALSE,  TRUE,   TRUE,   FALSE},
-/* IN   */ {TRUE,   TRUE,   TRUE,   FALSE},
-/* NONE */ {FALSE,  FALSE,  FALSE,  FALSE}
+/* OUT  */ {false,  false,  true,   false},
+/* IO   */ {false,  true,   true,   false},
+/* IN   */ {true,   true,   true,   false},
+/* NONE */ {false,  false,  false,  false}
 };
 /*  BTM_IO_CAP_OUT      0   DisplayOnly */
 /*  BTM_IO_CAP_IO       1   DisplayYesNo */
@@ -133,16 +133,16 @@
 **
 ** Description      check device is authenticated
 **
-** Returns          BOOLEAN TRUE or FALSE
+** Returns          bool    true or false
 **
 *******************************************************************************/
-static BOOLEAN btm_dev_authenticated (tBTM_SEC_DEV_REC *p_dev_rec)
+static bool    btm_dev_authenticated (tBTM_SEC_DEV_REC *p_dev_rec)
 {
     if(p_dev_rec->sec_flags & BTM_SEC_AUTHENTICATED)
     {
-        return(TRUE);
+        return(true);
     }
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -151,16 +151,16 @@
 **
 ** Description      check device is encrypted
 **
-** Returns          BOOLEAN TRUE or FALSE
+** Returns          bool    true or false
 **
 *******************************************************************************/
-static BOOLEAN btm_dev_encrypted (tBTM_SEC_DEV_REC *p_dev_rec)
+static bool    btm_dev_encrypted (tBTM_SEC_DEV_REC *p_dev_rec)
 {
     if(p_dev_rec->sec_flags & BTM_SEC_ENCRYPTED)
     {
-        return(TRUE);
+        return(true);
     }
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -169,16 +169,16 @@
 **
 ** Description      check device is authorized
 **
-** Returns          BOOLEAN TRUE or FALSE
+** Returns          bool    true or false
 **
 *******************************************************************************/
-static BOOLEAN btm_dev_authorized (tBTM_SEC_DEV_REC *p_dev_rec)
+static bool    btm_dev_authorized (tBTM_SEC_DEV_REC *p_dev_rec)
 {
     if(p_dev_rec->sec_flags & BTM_SEC_AUTHORIZED)
     {
-        return(TRUE);
+        return(true);
     }
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -187,17 +187,17 @@
 **
 ** Description      check device is authenticated by using 16 digit pin or MITM
 **
-** Returns          BOOLEAN TRUE or FALSE
+** Returns          bool    true or false
 **
 *******************************************************************************/
-static BOOLEAN btm_dev_16_digit_authenticated(tBTM_SEC_DEV_REC *p_dev_rec)
+static bool    btm_dev_16_digit_authenticated(tBTM_SEC_DEV_REC *p_dev_rec)
 {
     // BTM_SEC_16_DIGIT_PIN_AUTHED is set if MITM or 16 digit pin is used
     if(p_dev_rec->sec_flags & BTM_SEC_16_DIGIT_PIN_AUTHED)
     {
-        return(TRUE);
+        return(true);
     }
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -206,16 +206,16 @@
 **
 ** Description      check service is trusted
 **
-** Returns          BOOLEAN TRUE or FALSE
+** Returns          bool    true or false
 **
 *******************************************************************************/
-static BOOLEAN btm_serv_trusted(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_SEC_SERV_REC *p_serv_rec)
+static bool    btm_serv_trusted(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_SEC_SERV_REC *p_serv_rec)
 {
     if(BTM_SEC_IS_SERVICE_TRUSTED(p_dev_rec->trusted_mask, p_serv_rec->service_id))
     {
-        return(TRUE);
+        return(true);
     }
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -226,22 +226,22 @@
 **                  security services.  There can be one and only one application
 **                  saving link keys.  BTM allows only first registration.
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-BOOLEAN BTM_SecRegister(tBTM_APPL_INFO *p_cb_info)
+bool    BTM_SecRegister(tBTM_APPL_INFO *p_cb_info)
 {
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     BT_OCTET16      temp_value = {0};
 #endif
 
     BTM_TRACE_EVENT("%s application registered", __func__);
 
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
     LOG_INFO(LOG_TAG, "%s p_cb_info->p_le_callback == 0x%p", __func__, p_cb_info->p_le_callback);
     if (p_cb_info->p_le_callback)
     {
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
       BTM_TRACE_EVENT("%s SMP_Register( btm_proc_smp_cback )", __func__);
       SMP_Register(btm_proc_smp_cback);
 #endif
@@ -258,11 +258,11 @@
 #endif
 
     btm_cb.api = *p_cb_info;
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
      LOG_INFO(LOG_TAG, "%s btm_cb.api.p_le_callback = 0x%p ", __func__, btm_cb.api.p_le_callback);
 #endif
     BTM_TRACE_EVENT("%s application registered", __func__);
-    return(TRUE);
+    return(true);
 }
 
 /*******************************************************************************
@@ -273,13 +273,13 @@
 **                  link key notification.  When there is nobody registered
 **                  we should avoid changing link key
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-BOOLEAN BTM_SecRegisterLinkKeyNotificationCallback (tBTM_LINK_KEY_CALLBACK *p_callback)
+bool    BTM_SecRegisterLinkKeyNotificationCallback (tBTM_LINK_KEY_CALLBACK *p_callback)
 {
     btm_cb.api.p_link_key_callback = p_callback;
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -289,10 +289,10 @@
 ** Description      Any profile can register to be notified when name of the
 **                  remote device is resolved.
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-BOOLEAN  BTM_SecAddRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback)
+bool     BTM_SecAddRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback)
 {
     int i;
 
@@ -301,11 +301,11 @@
         if (btm_cb.p_rmt_name_callback[i] == NULL)
         {
             btm_cb.p_rmt_name_callback[i] = p_callback;
-            return(TRUE);
+            return(true);
         }
     }
 
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -315,10 +315,10 @@
 ** Description      Any profile can deregister notification when a new Link Key
 **                  is generated per connection.
 **
-** Returns          TRUE if OK, else FALSE
+** Returns          true if OK, else false
 **
 *******************************************************************************/
-BOOLEAN  BTM_SecDeleteRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback)
+bool     BTM_SecDeleteRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback)
 {
     int i;
 
@@ -327,11 +327,11 @@
         if (btm_cb.p_rmt_name_callback[i] == p_callback)
         {
             btm_cb.p_rmt_name_callback[i] = NULL;
-            return(TRUE);
+            return(true);
         }
     }
 
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -340,20 +340,20 @@
 **
 ** Description      Get security flags for the device
 **
-** Returns          BOOLEAN TRUE or FALSE is device found
+** Returns          bool    true or false is device found
 **
 *******************************************************************************/
-BOOLEAN BTM_GetSecurityFlags (BD_ADDR bd_addr, UINT8 * p_sec_flags)
+bool    BTM_GetSecurityFlags (BD_ADDR bd_addr, uint8_t * p_sec_flags)
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
 
     if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL)
     {
-        *p_sec_flags = (UINT8) p_dev_rec->sec_flags;
-        return(TRUE);
+        *p_sec_flags = (uint8_t) p_dev_rec->sec_flags;
+        return(true);
     }
     BTM_TRACE_ERROR ("BTM_GetSecurityFlags false");
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -362,10 +362,10 @@
 **
 ** Description      Get security flags for the device on a particular transport
 **
-** Returns          BOOLEAN TRUE or FALSE is device found
+** Returns          bool    true or false is device found
 **
 *******************************************************************************/
-BOOLEAN BTM_GetSecurityFlagsByTransport (BD_ADDR bd_addr, UINT8 * p_sec_flags,
+bool    BTM_GetSecurityFlagsByTransport (BD_ADDR bd_addr, uint8_t * p_sec_flags,
                                                 tBT_TRANSPORT transport)
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
@@ -373,14 +373,14 @@
     if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL)
     {
         if (transport == BT_TRANSPORT_BR_EDR)
-            *p_sec_flags = (UINT8) p_dev_rec->sec_flags;
+            *p_sec_flags = (uint8_t) p_dev_rec->sec_flags;
         else
-            *p_sec_flags = (UINT8) (p_dev_rec->sec_flags >> 8);
+            *p_sec_flags = (uint8_t) (p_dev_rec->sec_flags >> 8);
 
-        return(TRUE);
+        return(true);
     }
     BTM_TRACE_ERROR ("BTM_GetSecurityFlags false");
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -392,7 +392,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void BTM_SetPinType (UINT8 pin_type, PIN_CODE pin_code, UINT8 pin_code_len)
+void BTM_SetPinType (uint8_t pin_type, PIN_CODE pin_code, uint8_t pin_code_len)
 {
     BTM_TRACE_API ("BTM_SetPinType: pin type %d [variable-0, fixed-1], code %s, length %d",
                     pin_type, (char *) pin_code, pin_code_len);
@@ -415,15 +415,15 @@
 **
 ** Description      Enable or disable pairing
 **
-** Parameters       allow_pairing - (TRUE or FALSE) whether or not the device
+** Parameters       allow_pairing - (true or false) whether or not the device
 **                      allows pairing.
-**                  connect_only_paired - (TRUE or FALSE) whether or not to
+**                  connect_only_paired - (true or false) whether or not to
 **                      only allow paired devices to connect.
 **
 ** Returns          void
 **
 *******************************************************************************/
-void BTM_SetPairableMode (BOOLEAN allow_pairing, BOOLEAN connect_only_paired)
+void BTM_SetPairableMode (bool    allow_pairing, bool    connect_only_paired)
 {
     BTM_TRACE_API ("BTM_SetPairableMode()  allow_pairing: %u   connect_only_paired: %u", allow_pairing, connect_only_paired);
 
@@ -437,24 +437,24 @@
 **
 ** Description      Enable or disable default treatment for Mode 4 Level 0 services
 **
-** Parameter        secure_connections_only_mode - (TRUE or FALSE) whether or not the device
-**                  TRUE means that the device should treat Mode 4 Level 0 services as
+** Parameter        secure_connections_only_mode - (true or false) whether or not the device
+**                  true means that the device should treat Mode 4 Level 0 services as
 **                  services of other levels. (Secure_connections_only_mode)
-**                  FALSE means that the device should provide default treatment for
+**                  false means that the device should provide default treatment for
 **                  Mode 4 Level 0 services.
 **
 ** Returns          void
 **
 *******************************************************************************/
-void BTM_SetSecureConnectionsOnly (BOOLEAN secure_connections_only_mode)
+void BTM_SetSecureConnectionsOnly (bool    secure_connections_only_mode)
 {
-    BTM_TRACE_API("%s: Mode : %u", __FUNCTION__,
+    BTM_TRACE_API("%s: Mode : %u", __func__,
                    secure_connections_only_mode);
 
     btm_cb.devcb.secure_connections_only = secure_connections_only_mode;
     btm_cb.security_mode = BTM_SEC_MODE_SC;
 }
-#define BTM_NO_AVAIL_SEC_SERVICES   ((UINT16) 0xffff)
+#define BTM_NO_AVAIL_SEC_SERVICES   ((uint16_t) 0xffff)
 
 /*******************************************************************************
 **
@@ -462,7 +462,7 @@
 **
 ** Description      Register service security level with Security Manager
 **
-** Parameters:      is_originator - TRUE if originating the connection, FALSE if not
+** Parameters:      is_originator - true if originating the connection, false if not
 **                  p_name      - Name of the service relevant only if
 **                                authorization will show this name to user. ignored
 **                                if BTM_SEC_SERVICE_NAME_LEN is 0.
@@ -472,12 +472,12 @@
 **                  mx_proto_id - protocol ID of multiplexing proto below
 **                  mx_chan_id  - channel ID of multiplexing proto below
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-BOOLEAN BTM_SetSecurityLevel (BOOLEAN is_originator, const char *p_name, UINT8 service_id,
-                              UINT16 sec_level, UINT16 psm, UINT32 mx_proto_id,
-                              UINT32 mx_chan_id)
+bool    BTM_SetSecurityLevel (bool    is_originator, const char *p_name, uint8_t service_id,
+                              uint16_t sec_level, uint16_t psm, uint32_t mx_proto_id,
+                              uint32_t mx_chan_id)
 {
 #if (L2CAP_UCD_INCLUDED == TRUE)
     CONNECTION_TYPE conn_type;
@@ -501,7 +501,7 @@
 **
 ** Description      Register service security level with Security Manager
 **
-** Parameters:      conn_type   - TRUE if originating the connection, FALSE if not
+** Parameters:      conn_type   - true if originating the connection, false if not
 **                  p_name      - Name of the service relevant only if
 **                                authorization will show this name to user. ignored
 **                                if BTM_SEC_SERVICE_NAME_LEN is 0.
@@ -511,33 +511,33 @@
 **                  mx_proto_id - protocol ID of multiplexing proto below
 **                  mx_chan_id  - channel ID of multiplexing proto below
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-static BOOLEAN btm_sec_set_security_level (CONNECTION_TYPE conn_type, const char *p_name,
-                                           UINT8 service_id, UINT16 sec_level, UINT16 psm,
-                                           UINT32 mx_proto_id, UINT32 mx_chan_id)
+static bool    btm_sec_set_security_level (CONNECTION_TYPE conn_type, const char *p_name,
+                                           uint8_t service_id, uint16_t sec_level, uint16_t psm,
+                                           uint32_t mx_proto_id, uint32_t mx_chan_id)
 {
     tBTM_SEC_SERV_REC   *p_srec;
-    UINT16               index;
-    UINT16               first_unused_record = BTM_NO_AVAIL_SEC_SERVICES;
-    BOOLEAN              record_allocated = FALSE;
-    BOOLEAN              is_originator;
+    uint16_t             index;
+    uint16_t             first_unused_record = BTM_NO_AVAIL_SEC_SERVICES;
+    bool                 record_allocated = false;
+    bool                 is_originator;
 #if (L2CAP_UCD_INCLUDED == TRUE)
-    BOOLEAN              is_ucd;
+    bool                 is_ucd;
 
     if (conn_type & CONNECTION_TYPE_ORIG_MASK)
-        is_originator = TRUE;
+        is_originator = true;
     else
-        is_originator = FALSE;
+        is_originator = false;
 
     if (conn_type & CONNECTION_TYPE_CONNLESS_MASK )
     {
-        is_ucd = TRUE;
+        is_ucd = true;
     }
     else
     {
-        is_ucd = FALSE;
+        is_ucd = false;
     }
 #else
     is_originator = conn_type;
@@ -570,7 +570,7 @@
                 service_id == p_srec->service_id)
 #endif
             {
-                record_allocated = TRUE;
+                record_allocated = true;
                 break;
             }
         }
@@ -578,7 +578,7 @@
         else if (!record_allocated)
         {
             memset (p_srec, 0, sizeof(tBTM_SEC_SERV_REC));
-            record_allocated = TRUE;
+            record_allocated = true;
             first_unused_record = index;
         }
     }
@@ -643,7 +643,7 @@
          * the connection is initiated.
          * set it to be the outgoing service */
 #if (L2CAP_UCD_INCLUDED == TRUE)
-        if ( is_ucd == FALSE )
+        if ( is_ucd == false )
 #endif
         {
             btm_cb.p_out_serv = p_srec;
@@ -692,12 +692,12 @@
 #if (L2CAP_UCD_INCLUDED == TRUE)
     if ( is_ucd )
     {
-        p_srec->security_flags     |= (UINT16)(BTM_SEC_IN_USE);
-        p_srec->ucd_security_flags |= (UINT16)(sec_level | BTM_SEC_IN_USE);
+        p_srec->security_flags     |= (uint16_t)(BTM_SEC_IN_USE);
+        p_srec->ucd_security_flags |= (uint16_t)(sec_level | BTM_SEC_IN_USE);
     }
     else
     {
-        p_srec->security_flags |= (UINT16)(sec_level | BTM_SEC_IN_USE);
+        p_srec->security_flags |= (uint16_t)(sec_level | BTM_SEC_IN_USE);
     }
 
     BTM_TRACE_API("BTM_SEC_REG[%d]: id %d, conn_type 0x%x, psm 0x%04x, proto_id %d, chan_id %d",
@@ -711,7 +711,7 @@
                    p_name, BTM_SEC_SERVICE_NAME_LEN);
 #endif
 #else
-    p_srec->security_flags |= (UINT16)(sec_level | BTM_SEC_IN_USE);
+    p_srec->security_flags |= (uint16_t)(sec_level | BTM_SEC_IN_USE);
 
     BTM_TRACE_API("BTM_SEC_REG[%d]: id %d, is_orig %d, psm 0x%04x, proto_id %d, chan_id %d",
                    index, service_id, is_originator, psm, mx_proto_id, mx_chan_id);
@@ -743,10 +743,10 @@
 ** Returns          Number of records that were freed.
 **
 *******************************************************************************/
-UINT8 BTM_SecClrService (UINT8 service_id)
+uint8_t BTM_SecClrService (uint8_t service_id)
 {
     tBTM_SEC_SERV_REC   *p_srec = &btm_cb.sec_serv_rec[0];
-    UINT8   num_freed = 0;
+    uint8_t num_freed = 0;
     int     i;
 
     for (i = 0; i < BTM_SEC_MAX_SERVICE_RECORDS; i++, p_srec++)
@@ -783,10 +783,10 @@
 ** Returns          Number of records that were freed.
 **
 *******************************************************************************/
-UINT8 btm_sec_clr_service_by_psm (UINT16 psm)
+uint8_t btm_sec_clr_service_by_psm (uint16_t psm)
 {
     tBTM_SEC_SERV_REC   *p_srec = &btm_cb.sec_serv_rec[0];
-    UINT8   num_freed = 0;
+    uint8_t num_freed = 0;
     int     i;
 
     for (i = 0; i < BTM_SEC_MAX_SERVICE_RECORDS; i++, p_srec++)
@@ -847,10 +847,10 @@
 **                  res          - result of the operation BTM_SUCCESS if success
 **                  pin_len      - length in bytes of the PIN Code
 **                  p_pin        - pointer to array with the PIN Code
-**                  trusted_mask - bitwise OR of trusted services (array of UINT32)
+**                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
 **
 *******************************************************************************/
-void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin, UINT32 trusted_mask[])
+void BTM_PINCodeReply (BD_ADDR bd_addr, uint8_t res, uint8_t pin_len, uint8_t *p_pin, uint32_t trusted_mask[])
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
 
@@ -909,17 +909,17 @@
 
     if ( (btm_cb.pairing_flags & BTM_PAIR_FLAGS_WE_STARTED_DD)
          &&  (p_dev_rec->hci_handle == BTM_SEC_INVALID_HANDLE)
-         &&  (btm_cb.security_mode_changed == FALSE) )
+         &&  (btm_cb.security_mode_changed == false) )
     {
         /* This is start of the dedicated bonding if local device is 2.0 */
         btm_cb.pin_code_len = pin_len;
         memcpy (btm_cb.pin_code, p_pin, pin_len);
 
-        btm_cb.security_mode_changed = TRUE;
+        btm_cb.security_mode_changed = true;
 #ifdef APPL_AUTH_WRITE_EXCEPTION
         if(!(APPL_AUTH_WRITE_EXCEPTION)(p_dev_rec->bd_addr))
 #endif
-        btsnd_hcic_write_auth_enable (TRUE);
+        btsnd_hcic_write_auth_enable (true);
 
         btm_cb.acl_disc_reason = 0xff ;
 
@@ -965,17 +965,17 @@
 ** Parameters:      bd_addr      - Address of the device to bond
 **                  pin_len      - length in bytes of the PIN Code
 **                  p_pin        - pointer to array with the PIN Code
-**                  trusted_mask - bitwise OR of trusted services (array of UINT32)
+**                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
 **
 **  Note: After 2.1 parameters are not used and preserved here not to change API
 *******************************************************************************/
 tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
-                                       UINT8 pin_len, UINT8 *p_pin, UINT32 trusted_mask[])
+                                       uint8_t pin_len, uint8_t *p_pin, uint32_t trusted_mask[])
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
     tBTM_STATUS      status;
-    UINT8            *p_features;
-    UINT8            ii;
+    uint8_t          *p_features;
+    uint8_t          ii;
     tACL_CONN        *p= btm_bda_to_acl(bd_addr, transport);
     BTM_TRACE_API ("btm_sec_bond_by_transport BDA: %02x:%02x:%02x:%02x:%02x:%02x",
                     bd_addr[0], bd_addr[1], bd_addr[2], bd_addr[3], bd_addr[4], bd_addr[5]);
@@ -1033,11 +1033,11 @@
     btm_cb.pairing_flags = BTM_PAIR_FLAGS_WE_STARTED_DD;
 
     p_dev_rec->security_required = BTM_SEC_OUT_AUTHENTICATE;
-    p_dev_rec->is_originator     = TRUE;
+    p_dev_rec->is_originator     = true;
     if (trusted_mask)
         BTM_SEC_COPY_TRUSTED_DEVICE(trusted_mask, p_dev_rec->trusted_mask);
 
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
     if (transport == BT_TRANSPORT_LE)
     {
         btm_ble_init_pseudo_addr (p_dev_rec, bd_addr);
@@ -1069,7 +1069,7 @@
             && (p_dev_rec->dev_class[2] & BTM_COD_MINOR_KEYBOARD)
             && (btm_cb.cfg.pin_type != HCI_PIN_TYPE_FIXED))
         {
-            btm_cb.pin_type_changed = TRUE;
+            btm_cb.pin_type_changed = true;
             btsnd_hcic_write_pin_type (HCI_PIN_TYPE_FIXED);
         }
     }
@@ -1085,7 +1085,7 @@
 
     BTM_TRACE_EVENT ("BTM_SecBond: Remote sm4: 0x%x  HCI Handle: 0x%04x", p_dev_rec->sm4, p_dev_rec->hci_handle);
 
-#if BTM_SEC_FORCE_RNR_FOR_DBOND == TRUE
+#if (BTM_SEC_FORCE_RNR_FOR_DBOND == TRUE)
     p_dev_rec->sec_flags &= ~BTM_SEC_NAME_KNOWN;
 #endif
 
@@ -1098,7 +1098,7 @@
         btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_PIN_REQ);
 
         /* Mark lcb as bonding */
-        l2cu_update_lcb_4_bonding (bd_addr, TRUE);
+        l2cu_update_lcb_4_bonding (bd_addr, true);
         return(BTM_CMD_STARTED);
     }
 
@@ -1156,14 +1156,14 @@
 **                  transport    - doing SSP over BR/EDR or SMP over LE
 **                  pin_len      - length in bytes of the PIN Code
 **                  p_pin        - pointer to array with the PIN Code
-**                  trusted_mask - bitwise OR of trusted services (array of UINT32)
+**                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
 **
 **  Note: After 2.1 parameters are not used and preserved here not to change API
 *******************************************************************************/
 tBTM_STATUS BTM_SecBondByTransport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
-                                    UINT8 pin_len, UINT8 *p_pin, UINT32 trusted_mask[])
+                                    uint8_t pin_len, uint8_t *p_pin, uint32_t trusted_mask[])
 {
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
     tBT_DEVICE_TYPE     dev_type;
     tBLE_ADDR_TYPE      addr_type;
 
@@ -1189,14 +1189,14 @@
 ** Parameters:      bd_addr      - Address of the device to bond
 **                  pin_len      - length in bytes of the PIN Code
 **                  p_pin        - pointer to array with the PIN Code
-**                  trusted_mask - bitwise OR of trusted services (array of UINT32)
+**                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
 **
 **  Note: After 2.1 parameters are not used and preserved here not to change API
 *******************************************************************************/
-tBTM_STATUS BTM_SecBond (BD_ADDR bd_addr, UINT8 pin_len, UINT8 *p_pin, UINT32 trusted_mask[])
+tBTM_STATUS BTM_SecBond (BD_ADDR bd_addr, uint8_t pin_len, uint8_t *p_pin, uint32_t trusted_mask[])
 {
     tBT_TRANSPORT   transport = BT_TRANSPORT_BR_EDR;
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     if (BTM_UseLeLink(bd_addr))
         transport = BT_TRANSPORT_LE;
 #endif
@@ -1210,7 +1210,7 @@
 **                  with peer device.
 **
 ** Parameters:      bd_addr      - Address of the peer device
-**                         transport    - FALSE for BR/EDR link; TRUE for LE link
+**                         transport    - false for BR/EDR link; true for LE link
 **
 *******************************************************************************/
 tBTM_STATUS BTM_SecBondCancel (BD_ADDR bd_addr)
@@ -1224,7 +1224,7 @@
         ||  (memcmp (btm_cb.pairing_bda, bd_addr, BD_ADDR_LEN) != 0) )
         return BTM_UNKNOWN_ADDR;
 
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
     if (btm_cb.pairing_flags & BTM_PAIR_FLAGS_LE_ACTIVE)
     {
         if (p_dev_rec->sec_state == BTM_SEC_STATE_AUTHENTICATING)
@@ -1264,7 +1264,7 @@
             if (btm_cb.pairing_flags & BTM_PAIR_FLAGS_DISC_WHEN_DONE)
                 return btm_sec_send_hci_disconnect(p_dev_rec, HCI_ERR_PEER_USER, p_dev_rec->hci_handle);
             else
-                l2cu_update_lcb_4_bonding(bd_addr, FALSE);
+                l2cu_update_lcb_4_bonding(bd_addr, false);
 
             return BTM_NOT_AUTHORIZED;
         }
@@ -1377,7 +1377,7 @@
     tBTM_SEC_DEV_REC  *p_dev_rec = btm_find_dev (bd_addr);
     if (!p_dev_rec ||
         (transport == BT_TRANSPORT_BR_EDR && p_dev_rec->hci_handle == BTM_SEC_INVALID_HANDLE)
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         || (transport == BT_TRANSPORT_LE && p_dev_rec->ble_hci_handle == BTM_SEC_INVALID_HANDLE)
 #endif
         )
@@ -1422,13 +1422,13 @@
     p_dev_rec->p_callback        = p_callback;
     p_dev_rec->p_ref_data        = p_ref_data;
     p_dev_rec->security_required |= (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_IN_ENCRYPT);
-    p_dev_rec->is_originator     = FALSE;
+    p_dev_rec->is_originator     = false;
 
     BTM_TRACE_API ("Security Manager: BTM_SetEncryption Handle:%d State:%d Flags:0x%x Required:0x%x",
                     p_dev_rec->hci_handle, p_dev_rec->sec_state, p_dev_rec->sec_flags,
                     p_dev_rec->security_required);
 
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
     if (transport == BT_TRANSPORT_LE)
     {
         tACL_CONN *p = btm_bda_to_acl(bd_addr, transport);
@@ -1439,7 +1439,7 @@
         else
         {
             rc = BTM_WRONG_MODE;
-            BTM_TRACE_WARNING("%s: cannot call btm_ble_set_encryption, p is NULL", __FUNCTION__);
+            BTM_TRACE_WARNING("%s: cannot call btm_ble_set_encryption, p is NULL", __func__);
         }
     }
     else
@@ -1461,9 +1461,9 @@
 /*******************************************************************************
  * disconnect the ACL link, if it's not done yet.
 *******************************************************************************/
-static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 reason, UINT16 conn_handle)
+static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, uint8_t reason, uint16_t conn_handle)
 {
-    UINT8       old_state = p_dev_rec->sec_state;
+    uint8_t     old_state = p_dev_rec->sec_state;
     tBTM_STATUS status = BTM_CMD_STARTED;
 
     BTM_TRACE_EVENT ("btm_sec_send_hci_disconnect:  handle:0x%x, reason=0x%x",
@@ -1479,7 +1479,7 @@
             p_dev_rec->sec_state = BTM_SEC_STATE_DISCONNECTING_BOTH;
             break;
 
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
         case BTM_SEC_STATE_DISCONNECTING_BLE:
             if (conn_handle == p_dev_rec->ble_hci_handle)
                 return status;
@@ -1552,13 +1552,13 @@
                 p_dev_rec->sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED;
         }
 
-        btsnd_hcic_user_conf_reply (bd_addr, TRUE);
+        btsnd_hcic_user_conf_reply (bd_addr, true);
     }
     else
     {
         /* Report authentication failed event from state BTM_PAIR_STATE_WAIT_AUTH_COMPLETE */
         btm_cb.acl_disc_reason = HCI_ERR_HOST_REJECT_SECURITY;
-        btsnd_hcic_user_conf_reply (bd_addr, FALSE);
+        btsnd_hcic_user_conf_reply (bd_addr, false);
     }
 }
 
@@ -1576,7 +1576,7 @@
 **
 *******************************************************************************/
 #if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE)
-void BTM_PasskeyReqReply(tBTM_STATUS res, BD_ADDR bd_addr, UINT32 passkey)
+void BTM_PasskeyReqReply(tBTM_STATUS res, BD_ADDR bd_addr, uint32_t passkey)
 {
     BTM_TRACE_API ("BTM_PasskeyReqReply: State: %s  res:%d",
                     btm_pair_state_descr(btm_cb.pairing_state), res);
@@ -1697,7 +1697,7 @@
 {
     tBTM_STATUS status = BTM_SUCCESS;
 
-    if (btsnd_hcic_read_local_oob_data() == FALSE)
+    if (btsnd_hcic_read_local_oob_data() == false)
         status = BTM_NO_RESOURCES;
 
     return status;
@@ -1755,14 +1755,14 @@
 ** Returns          Number of bytes in p_data.
 **
 *******************************************************************************/
-UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
-                        BT_OCTET16 r, UINT8 name_len)
+uint16_t BTM_BuildOobData(uint8_t *p_data, uint16_t max_len, BT_OCTET16 c,
+                        BT_OCTET16 r, uint8_t name_len)
 {
-    UINT8   *p = p_data;
-    UINT16  len = 0;
+    uint8_t *p = p_data;
+    uint16_t len = 0;
 #if BTM_MAX_LOC_BD_NAME_LEN > 0
-    UINT16  name_size;
-    UINT8   name_type = BTM_EIR_SHORTENED_LOCAL_NAME_TYPE;
+    uint16_t name_size;
+    uint8_t name_type = BTM_EIR_SHORTENED_LOCAL_NAME_TYPE;
 #endif
 
     if (p_data && max_len >= BTM_OOB_MANDATORY_SIZE)
@@ -1777,7 +1777,7 @@
         /* now optional part */
 
         /* add Hash C */
-        UINT16 delta = BTM_OOB_HASH_C_SIZE + 2;
+        uint16_t delta = BTM_OOB_HASH_C_SIZE + 2;
         if (max_len >= delta)
         {
             *p++ = BTM_OOB_HASH_C_SIZE + 1;
@@ -1813,7 +1813,7 @@
         if (name_size > strlen(btm_cb.cfg.bd_name))
         {
             name_type = BTM_EIR_COMPLETE_LOCAL_NAME_TYPE;
-            name_size = (UINT16)strlen(btm_cb.cfg.bd_name);
+            name_size = (uint16_t)strlen(btm_cb.cfg.bd_name);
         }
         delta = name_size + 2;
         if (max_len >= delta)
@@ -1841,12 +1841,12 @@
 **
 ** Parameters:      bd_addr - address of the peer
 **
-** Returns          TRUE if BR/EDR Secure Connections are supported by both local
+** Returns          true if BR/EDR Secure Connections are supported by both local
 **                  and the remote device.
-**                  else FALSE.
+**                  else false.
 **
 *******************************************************************************/
-BOOLEAN BTM_BothEndsSupportSecureConnections(BD_ADDR bd_addr)
+bool    BTM_BothEndsSupportSecureConnections(BD_ADDR bd_addr)
 {
     return ((controller_get_interface()->supports_secure_connections()) &&
             (BTM_PeerSupportsSecureConnections(bd_addr)));
@@ -1861,20 +1861,20 @@
 **
 ** Parameters:      bd_addr - address of the peer
 **
-** Returns          TRUE if BR/EDR Secure Connections are supported by the peer,
-**                  else FALSE.
+** Returns          true if BR/EDR Secure Connections are supported by the peer,
+**                  else false.
 **
 *******************************************************************************/
-BOOLEAN BTM_PeerSupportsSecureConnections(BD_ADDR bd_addr)
+bool    BTM_PeerSupportsSecureConnections(BD_ADDR bd_addr)
 {
     tBTM_SEC_DEV_REC    *p_dev_rec;
 
     if ((p_dev_rec = btm_find_dev(bd_addr)) == NULL)
     {
-        BTM_TRACE_WARNING("%s: unknown BDA: %08x%04x", __FUNCTION__,
+        BTM_TRACE_WARNING("%s: unknown BDA: %08x%04x", __func__,
             (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;
     }
 
     return (p_dev_rec->remote_supports_secure_connections);
@@ -1895,13 +1895,13 @@
 **                  NULL, if the tag is not found.
 **
 *******************************************************************************/
-UINT8 * BTM_ReadOobData(UINT8 *p_data, UINT8 eir_tag, UINT8 *p_len)
+uint8_t * BTM_ReadOobData(uint8_t *p_data, uint8_t eir_tag, uint8_t *p_len)
 {
-    UINT8   *p = p_data;
-    UINT16  max_len;
-    UINT8   len, type;
-    UINT8   *p_ret = NULL;
-    UINT8   ret_len = 0;
+    uint8_t *p = p_data;
+    uint16_t max_len;
+    uint8_t len, type;
+    uint8_t *p_ret = NULL;
+    uint8_t ret_len = 0;
 
     if (p_data)
     {
@@ -1963,7 +1963,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void BTM_SetOutService(BD_ADDR bd_addr, UINT8 service_id, UINT32 mx_chan_id)
+void BTM_SetOutService(BD_ADDR bd_addr, uint8_t service_id, uint32_t mx_chan_id)
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
     tBTM_SEC_SERV_REC *p_serv_rec = &btm_cb.sec_serv_rec[0];
@@ -1994,20 +1994,20 @@
 **
 ** Function         btm_sec_is_upgrade_possible
 **
-** Description      This function returns TRUE if the existing link key
+** Description      This function returns true if the existing link key
 **                  can be upgraded or if the link key does not exist.
 **
-** Returns          BOOLEAN
+** Returns          bool
 **
 *******************************************************************************/
-static BOOLEAN btm_sec_is_upgrade_possible(tBTM_SEC_DEV_REC  *p_dev_rec, BOOLEAN is_originator)
+static bool    btm_sec_is_upgrade_possible(tBTM_SEC_DEV_REC  *p_dev_rec, bool    is_originator)
 {
-    UINT16              mtm_check = is_originator ? BTM_SEC_OUT_MITM : BTM_SEC_IN_MITM;
-    BOOLEAN             is_possible = TRUE;
+    uint16_t            mtm_check = is_originator ? BTM_SEC_OUT_MITM : BTM_SEC_IN_MITM;
+    bool                is_possible = true;
 
     if (p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_KNOWN)
     {
-        is_possible = FALSE;
+        is_possible = false;
         if(p_dev_rec->p_cur_service)
         {
             BTM_TRACE_DEBUG ("%s() id: %d, link_key_typet: %d, rmt_io_caps: %d, chk flags: 0x%x, flags: 0x%x",
@@ -2035,7 +2035,7 @@
             /* upgrade is possible: check if the application wants the upgrade.
              * If the application is configured to use a global MITM flag,
              * it probably would not want to upgrade the link key based on the security level database */
-            is_possible = TRUE;
+            is_possible = true;
         }
     }
     BTM_TRACE_DEBUG ("%s() is_possible: %d sec_flags: 0x%x", __func__, is_possible, p_dev_rec->sec_flags);
@@ -2052,7 +2052,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btm_sec_check_upgrade(tBTM_SEC_DEV_REC  *p_dev_rec, BOOLEAN is_originator)
+static void btm_sec_check_upgrade(tBTM_SEC_DEV_REC  *p_dev_rec, bool    is_originator)
 {
 
     BTM_TRACE_DEBUG ("%s()", __func__);
@@ -2061,7 +2061,7 @@
     if (!(p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_KNOWN))
         return;
 
-    if (btm_sec_is_upgrade_possible (p_dev_rec, is_originator) == TRUE)
+    if (btm_sec_is_upgrade_possible (p_dev_rec, is_originator) == true)
     {
         BTM_TRACE_DEBUG ("need upgrade!! sec_flags:0x%x", p_dev_rec->sec_flags);
         /* upgrade is possible: check if the application wants the upgrade.
@@ -2069,7 +2069,7 @@
          * it probably would not want to upgrade the link key based on the security level database */
         tBTM_SP_UPGRADE evt_data;
         memcpy (evt_data.bd_addr, p_dev_rec->bd_addr, BD_ADDR_LEN);
-        evt_data.upgrade = TRUE;
+        evt_data.upgrade = true;
         if (btm_cb.api.p_sp_callback)
             (*btm_cb.api.p_sp_callback) (BTM_SP_UPGRADE_EVT, (tBTM_SP_EVT_DATA *)&evt_data);
 
@@ -2096,7 +2096,7 @@
 **
 ** Parameters:      bd_addr       - Address of the peer device
 **                  psm           - L2CAP PSM
-**                  is_originator - TRUE if protocol above L2CAP originates
+**                  is_originator - true if protocol above L2CAP originates
 **                                  connection
 **                  p_callback    - Pointer to callback function called if
 **                                  this function returns PENDING after required
@@ -2105,26 +2105,26 @@
 ** Returns          tBTM_STATUS
 **
 *******************************************************************************/
-tBTM_STATUS btm_sec_l2cap_access_req (BD_ADDR bd_addr, UINT16 psm, UINT16 handle,
+tBTM_STATUS btm_sec_l2cap_access_req (BD_ADDR bd_addr, uint16_t psm, uint16_t handle,
                                       CONNECTION_TYPE conn_type,
                                       tBTM_SEC_CALLBACK *p_callback,
                                       void *p_ref_data)
 {
     tBTM_SEC_DEV_REC  *p_dev_rec;
     tBTM_SEC_SERV_REC *p_serv_rec;
-    UINT16         security_required;
-    UINT16         old_security_required;
-    BOOLEAN       old_is_originator;
+    uint16_t       security_required;
+    uint16_t       old_security_required;
+    bool          old_is_originator;
     tBTM_STATUS   rc = BTM_SUCCESS;
-    BOOLEAN       chk_acp_auth_done = FALSE;
-    BOOLEAN is_originator;
+    bool          chk_acp_auth_done = false;
+    bool    is_originator;
     tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR; /* should check PSM range in LE connection oriented L2CAP connection */
 
 #if (L2CAP_UCD_INCLUDED == TRUE)
     if (conn_type & CONNECTION_TYPE_ORIG_MASK)
-        is_originator = TRUE;
+        is_originator = true;
     else
-        is_originator = FALSE;
+        is_originator = false;
 
     BTM_TRACE_DEBUG ("%s() conn_type: 0x%x, 0x%x", __func__, conn_type, p_ref_data);
 #else
@@ -2224,16 +2224,16 @@
     }
 
     BTM_TRACE_DEBUG("%s: security_required 0x%04x, is_originator 0x%02x, psm  0x%04x",
-                    __FUNCTION__, security_required, is_originator, psm);
+                    __func__, security_required, is_originator, psm);
 
     if ((!is_originator) && (security_required & BTM_SEC_MODE4_LEVEL4))
     {
-        BOOLEAN local_supports_sc = controller_get_interface()->supports_secure_connections();
+        bool    local_supports_sc = controller_get_interface()->supports_secure_connections();
         /* acceptor receives L2CAP Channel Connect Request for Secure Connections Only service */
         if (!(local_supports_sc) || !(p_dev_rec->remote_supports_secure_connections))
         {
             BTM_TRACE_DEBUG("%s: SC only service, local_support_for_sc %d",
-                            "rmt_support_for_sc : %d -> fail pairing", __FUNCTION__,
+                            "rmt_support_for_sc : %d -> fail pairing", __func__,
                             local_supports_sc,
                             p_dev_rec->remote_supports_secure_connections);
             if (p_callback)
@@ -2257,7 +2257,7 @@
              btm_cb.security_mode == BTM_SEC_MODE_SERVICE ||
              btm_cb.security_mode == BTM_SEC_MODE_LINK) ||
             (BTM_SM4_KNOWN == p_dev_rec->sm4) || (BTM_SEC_IS_SM4(p_dev_rec->sm4) &&
-            (btm_sec_is_upgrade_possible(p_dev_rec, is_originator) == FALSE)))
+            (btm_sec_is_upgrade_possible(p_dev_rec, is_originator) == false)))
         {
             /* legacy mode - local is legacy or local is lisbon/peer is legacy
              * or SM4 with no possibility of link key upgrade */
@@ -2303,7 +2303,7 @@
             }
         }
 
-        btm_cb.sec_req_pending = TRUE;
+        btm_cb.sec_req_pending = true;
         return(BTM_CMD_STARTED);
     }
 
@@ -2325,7 +2325,7 @@
             else /* acceptor */
             {
                 /* SM4 to SM4: the acceptor needs to make sure the authentication is already done */
-                chk_acp_auth_done = TRUE;
+                chk_acp_auth_done = true;
                 /* SM4 to SM4 -> always authenticate & encrypt */
                 security_required |= (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_IN_ENCRYPT);
            }
@@ -2333,7 +2333,7 @@
         else if (!(BTM_SM4_KNOWN & p_dev_rec->sm4))
         {
             /* the remote features are not known yet */
-            BTM_TRACE_DEBUG("%s: (%s) remote features unknown!!sec_flags:0x%02x", __FUNCTION__,
+            BTM_TRACE_DEBUG("%s: (%s) remote features unknown!!sec_flags:0x%02x", __func__,
                             (is_originator) ? "initiator" : "acceptor", p_dev_rec->sec_flags);
 
             p_dev_rec->sm4 |= BTM_SM4_REQ_PEND;
@@ -2352,9 +2352,9 @@
 
 #if (L2CAP_UCD_INCLUDED == TRUE)
     if ( conn_type & CONNECTION_TYPE_CONNLESS_MASK )
-        p_dev_rec->is_ucd = TRUE;
+        p_dev_rec->is_ucd = true;
     else
-        p_dev_rec->is_ucd = FALSE;
+        p_dev_rec->is_ucd = false;
 #endif
 
     /* If there are multiple service records used through the same PSM */
@@ -2448,7 +2448,7 @@
             }
             p_dev_rec->sec_flags &= ~(BTM_SEC_LINK_KEY_KNOWN | BTM_SEC_LINK_KEY_AUTHED |
                                       BTM_SEC_AUTHENTICATED);
-            BTM_TRACE_DEBUG ("%s: sec_flags:0x%x", __FUNCTION__, p_dev_rec->sec_flags);
+            BTM_TRACE_DEBUG ("%s: sec_flags:0x%x", __func__, p_dev_rec->sec_flags);
         }
         else
         {
@@ -2464,7 +2464,7 @@
     if ((rc = btm_sec_execute_procedure (p_dev_rec)) != BTM_CMD_STARTED)
     {
         p_dev_rec->p_callback = NULL;
-        (*p_callback) (bd_addr, transport, p_dev_rec->p_ref_data, (UINT8)rc);
+        (*p_callback) (bd_addr, transport, p_dev_rec->p_ref_data, (uint8_t)rc);
     }
 
     return(rc);
@@ -2480,7 +2480,7 @@
 **
 ** Parameters:      bd_addr       - Address of the peer device
 **                  psm           - L2CAP PSM
-**                  is_originator - TRUE if protocol above L2CAP originates
+**                  is_originator - true if protocol above L2CAP originates
 **                                  connection
 **                  mx_proto_id   - protocol ID of the multiplexer
 **                  mx_chan_id    - multiplexer channel to reach application
@@ -2493,15 +2493,15 @@
 ** Returns          BTM_CMD_STARTED
 **
 *******************************************************************************/
-tBTM_STATUS btm_sec_mx_access_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator,
-                                       UINT32 mx_proto_id, UINT32 mx_chan_id,
+tBTM_STATUS btm_sec_mx_access_request (BD_ADDR bd_addr, uint16_t psm, bool    is_originator,
+                                       uint32_t mx_proto_id, uint32_t mx_chan_id,
                                        tBTM_SEC_CALLBACK *p_callback, void *p_ref_data)
 {
     tBTM_SEC_DEV_REC  *p_dev_rec;
     tBTM_SEC_SERV_REC *p_serv_rec;
     tBTM_STATUS        rc;
-    UINT16             security_required;
-    BOOLEAN transport   = FALSE;/* should check PSM range in LE connection oriented L2CAP connection */
+    uint16_t           security_required;
+    bool    transport   = false;/* should check PSM range in LE connection oriented L2CAP connection */
 
     BTM_TRACE_DEBUG ("%s() is_originator: %d", __func__, is_originator);
     /* Find or get oldest record */
@@ -2545,7 +2545,7 @@
              btm_cb.security_mode == BTM_SEC_MODE_SERVICE ||
              btm_cb.security_mode == BTM_SEC_MODE_LINK) ||
             (BTM_SM4_KNOWN == p_dev_rec->sm4) || (BTM_SEC_IS_SM4(p_dev_rec->sm4) &&
-            (btm_sec_is_upgrade_possible(p_dev_rec, is_originator) == FALSE)))
+            (btm_sec_is_upgrade_possible(p_dev_rec, is_originator) == false)))
         {
             /* legacy mode - local is legacy or local is lisbon/peer is legacy
              * or SM4 with no possibility of link key upgrade */
@@ -2585,13 +2585,13 @@
 
         if (rc == BTM_SUCCESS)
         {
-            BTM_TRACE_EVENT("%s: allow to bypass, checking authorization", __FUNCTION__);
+            BTM_TRACE_EVENT("%s: allow to bypass, checking authorization", __func__);
             /* the security in BTM_SEC_IN_FLAGS is fullfilled so far, check the requirements in */
             /* btm_sec_execute_procedure */
             if ((is_originator && (p_serv_rec->security_flags & BTM_SEC_OUT_AUTHORIZE)) ||
                 (!is_originator && (p_serv_rec->security_flags & BTM_SEC_IN_AUTHORIZE)))
             {
-                BTM_TRACE_EVENT("%s: still need authorization", __FUNCTION__);
+                BTM_TRACE_EVENT("%s: still need authorization", __func__);
                 rc = BTM_CMD_STARTED;
             }
         }
@@ -2600,12 +2600,12 @@
         /* the new security request */
         if (p_dev_rec->sec_state != BTM_SEC_STATE_IDLE)
         {
-            BTM_TRACE_EVENT("%s: There is a pending security procedure", __FUNCTION__);
+            BTM_TRACE_EVENT("%s: There is a pending security procedure", __func__);
             rc = BTM_CMD_STARTED;
         }
         if (rc == BTM_CMD_STARTED)
         {
-            BTM_TRACE_EVENT("%s: call btm_sec_queue_mx_request", __FUNCTION__);
+            BTM_TRACE_EVENT("%s: call btm_sec_queue_mx_request", __func__);
             btm_sec_queue_mx_request (bd_addr, psm,  is_originator, mx_proto_id,
                                       mx_chan_id, p_callback, p_ref_data);
         }
@@ -2614,11 +2614,11 @@
             /* access granted */
              if (p_callback)
             {
-                (*p_callback) (bd_addr, transport, p_ref_data, (UINT8)rc);
+                (*p_callback) (bd_addr, transport, p_ref_data, (uint8_t)rc);
             }
         }
 
-        BTM_TRACE_EVENT("%s: return with rc = 0x%02x in delayed state %s", __FUNCTION__, rc,
+        BTM_TRACE_EVENT("%s: return with rc = 0x%02x in delayed state %s", __func__, rc,
                           btm_pair_state_descr(btm_cb.pairing_state));
         return rc;
     }
@@ -2626,13 +2626,13 @@
     if ((!is_originator) && ((security_required & BTM_SEC_MODE4_LEVEL4) ||
         (btm_cb.security_mode == BTM_SEC_MODE_SC)))
     {
-        BOOLEAN local_supports_sc = controller_get_interface()->supports_secure_connections();
+        bool    local_supports_sc = controller_get_interface()->supports_secure_connections();
         /* acceptor receives service connection establishment Request for */
         /* Secure Connections Only service */
         if (!(local_supports_sc) || !(p_dev_rec->remote_supports_secure_connections))
         {
             BTM_TRACE_DEBUG("%s: SC only service,local_support_for_sc %d,",
-                            "remote_support_for_sc %d: fail pairing",__FUNCTION__,
+                            "remote_support_for_sc %d: fail pairing",__func__,
                             local_supports_sc, p_dev_rec->remote_supports_secure_connections);
 
             if (p_callback)
@@ -2663,7 +2663,7 @@
 
                 p_dev_rec->sec_flags &= ~(BTM_SEC_LINK_KEY_KNOWN | BTM_SEC_LINK_KEY_AUTHED |
                                           BTM_SEC_AUTHENTICATED);
-                BTM_TRACE_DEBUG("%s: sec_flags:0x%x", __FUNCTION__, p_dev_rec->sec_flags);
+                BTM_TRACE_DEBUG("%s: sec_flags:0x%x", __func__, p_dev_rec->sec_flags);
             }
             else
             {
@@ -2692,7 +2692,7 @@
         if (p_callback)
         {
             p_dev_rec->p_callback = NULL;
-            (*p_callback) (bd_addr,transport, p_ref_data, (UINT8)rc);
+            (*p_callback) (bd_addr,transport, p_ref_data, (uint8_t)rc);
         }
     }
 
@@ -2709,7 +2709,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sec_conn_req (UINT8 *bda, UINT8 *dc)
+void btm_sec_conn_req (uint8_t *bda, uint8_t *dc)
 {
     tBTM_SEC_DEV_REC  *p_dev_rec = btm_find_dev (bda);
 
@@ -2734,7 +2734,7 @@
         }
     }
 
-#if BTM_ALLOW_CONN_IF_NONDISCOVER == FALSE
+#if (BTM_ALLOW_CONN_IF_NONDISCOVER == FALSE)
     /* If non-discoverable, only allow known devices to connect */
     if (btm_cb.btm_inq_vars.discoverable_mode == BTM_NON_DISCOVERABLE)
     {
@@ -2800,7 +2800,7 @@
     {
         /* for dedicated bonding in legacy mode, authentication happens at "link level"
          * btm_sec_connected is called with failed status.
-         * In theory, the code that handles is_pairing_device/TRUE should clean out security related code.
+         * In theory, the code that handles is_pairing_device/true should clean out security related code.
          * However, this function may clean out the security related flags and btm_sec_connected would not know
          * this function also needs to do proper clean up.
          */
@@ -2825,9 +2825,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_create_conn_cancel_complete (UINT8 *p)
+void btm_create_conn_cancel_complete (uint8_t *p)
 {
-    UINT8       status;
+    uint8_t     status;
 
     STREAM_TO_UINT8 (status, p);
     BTM_TRACE_EVENT ("btm_create_conn_cancel_complete(): in State: %s  status:%d",
@@ -2868,7 +2868,7 @@
         /* First, resubmit L2CAP requests */
         if (btm_cb.sec_req_pending)
         {
-            btm_cb.sec_req_pending = FALSE;
+            btm_cb.sec_req_pending = false;
             l2cu_resubmit_pending_sec_req (NULL);
         }
 
@@ -2886,7 +2886,7 @@
                 if (p_e->psm != 0)
                 {
                     BTM_TRACE_EVENT("%s PSM:0x%04x Is_Orig:%u mx_proto_id:%u mx_chan_id:%u",
-                                    __FUNCTION__, p_e->psm, p_e->is_orig,
+                                    __func__, p_e->psm, p_e->is_orig,
                                     p_e->mx_proto_id, p_e->mx_chan_id);
 
                     btm_sec_mx_access_request (p_e->bd_addr, p_e->psm, p_e->is_orig,
@@ -2915,7 +2915,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sec_init (UINT8 sec_mode)
+void btm_sec_init (uint8_t sec_mode)
 {
     btm_cb.security_mode = sec_mode;
     memset (btm_cb.pairing_bda, 0xff, BD_ADDR_LEN);
@@ -2954,7 +2954,7 @@
         /* set the default IO capabilities */
         btm_cb.devcb.loc_io_caps = BTM_LOCAL_IO_CAPS;
         /* add mx service to use no security */
-        BTM_SetSecurityLevel(FALSE, "RFC_MUX", BTM_SEC_SERVICE_RFC_MUX,
+        BTM_SetSecurityLevel(false, "RFC_MUX", BTM_SEC_SERVICE_RFC_MUX,
                              BTM_SEC_NONE, BT_PSM_RFCOMM, BTM_SEC_PROTO_RFCOMM, 0);
     }
     else
@@ -3013,7 +3013,7 @@
     }
 
     /* Make sure an L2cap link control block is available */
-    if (!p_lcb && (p_lcb = l2cu_allocate_lcb (p_dev_rec->bd_addr, TRUE, BT_TRANSPORT_BR_EDR)) == NULL)
+    if (!p_lcb && (p_lcb = l2cu_allocate_lcb (p_dev_rec->bd_addr, true, BT_TRANSPORT_BR_EDR)) == NULL)
     {
         BTM_TRACE_WARNING ("Security Manager: failed allocate LCB [%02x%02x%02x%02x%02x%02x]",
                             p_dev_rec->bd_addr[0], p_dev_rec->bd_addr[1], p_dev_rec->bd_addr[2],
@@ -3025,7 +3025,7 @@
     /* set up the control block to indicated dedicated bonding */
     btm_cb.pairing_flags |= BTM_PAIR_FLAGS_DISC_WHEN_DONE;
 
-    if (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == FALSE)
+    if (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == false)
     {
         BTM_TRACE_WARNING ("Security Manager: failed create  [%02x%02x%02x%02x%02x%02x]",
                             p_dev_rec->bd_addr[0], p_dev_rec->bd_addr[1], p_dev_rec->bd_addr[2],
@@ -3067,12 +3067,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT8 status)
+void btm_sec_rmt_name_request_complete (uint8_t *p_bd_addr, uint8_t *p_bd_name, uint8_t status)
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
     int              i;
     DEV_CLASS        dev_class;
-    UINT8            old_sec_state;
+    uint8_t          old_sec_state;
 
     BTM_TRACE_EVENT ("btm_sec_rmt_name_request_complete");
     if (((p_bd_addr == NULL) && !BTM_ACL_IS_CONNECTED(btm_cb.connecting_bda))
@@ -3100,7 +3100,7 @@
     */
 #if (BT_USE_TRACES == TRUE)
     if (!p_bd_name)
-        p_bd_name = (UINT8 *)"";
+        p_bd_name = (uint8_t *)"";
 
     if (p_dev_rec)
     {
@@ -3148,7 +3148,7 @@
         for (i = 0;i < BTM_SEC_MAX_RMT_NAME_CALLBACKS; i++)
         {
             if (btm_cb.p_rmt_name_callback[i] && p_bd_addr)
-                (*btm_cb.p_rmt_name_callback[i])(p_bd_addr, dev_class, (UINT8 *)"");
+                (*btm_cb.p_rmt_name_callback[i])(p_bd_addr, dev_class, (uint8_t *)"");
         }
 
         return;
@@ -3166,7 +3166,7 @@
             BTM_TRACE_EVENT ("%s() calling pin_callback", __func__);
             btm_cb.pairing_flags |= BTM_PAIR_FLAGS_PIN_REQD;
             (*btm_cb.api.p_pin_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class, p_bd_name,
-                    (p_dev_rec->p_cur_service==NULL) ? FALSE
+                    (p_dev_rec->p_cur_service==NULL) ? false
                      : (p_dev_rec->p_cur_service->security_flags & BTM_SEC_IN_MIN_16_DIGIT_PIN));
         }
 
@@ -3208,7 +3208,7 @@
                     p_dev_rec->sm4 |= BTM_SM4_KNOWN;
             }
 
-            BTM_TRACE_DEBUG("%s, SM4 Value: %x, Legacy:%d,IS SM4:%d, Unknown:%d",__FUNCTION__,
+            BTM_TRACE_DEBUG("%s, SM4 Value: %x, Legacy:%d,IS SM4:%d, Unknown:%d",__func__,
                 p_dev_rec->sm4, BTM_SEC_IS_SM4_LEGACY(p_dev_rec->sm4),
                 BTM_SEC_IS_SM4(p_dev_rec->sm4),BTM_SEC_IS_SM4_UNKNOWN(p_dev_rec->sm4));
 
@@ -3250,7 +3250,7 @@
         if (p_dev_rec->hci_handle == BTM_SEC_INVALID_HANDLE)
             return;
 
-        p_dev_rec->link_key_not_sent = FALSE;
+        p_dev_rec->link_key_not_sent = false;
         btm_send_link_key_notif(p_dev_rec);
 
         /* If its not us who perform authentication, we should tell stackserver */
@@ -3282,7 +3282,7 @@
     /* If get name failed, notify the waiting layer */
     if (status != HCI_SUCCESS)
     {
-        btm_sec_dev_rec_cback_event  (p_dev_rec, BTM_ERR_PROCESSING, FALSE);
+        btm_sec_dev_rec_cback_event  (p_dev_rec, BTM_ERR_PROCESSING, false);
         return;
     }
 
@@ -3293,14 +3293,14 @@
     }
 
     /* Remote Name succeeded, execute the next security procedure, if any */
-    status = (UINT8)btm_sec_execute_procedure (p_dev_rec);
+    status = (uint8_t)btm_sec_execute_procedure (p_dev_rec);
 
     /* If result is pending reply from the user or from the device is pending */
     if (status == BTM_CMD_STARTED)
         return;
 
     /* There is no next procedure or start of procedure failed, notify the waiting layer */
-    btm_sec_dev_rec_cback_event  (p_dev_rec, status, FALSE);
+    btm_sec_dev_rec_cback_event  (p_dev_rec, status, false);
 }
 
 /*******************************************************************************
@@ -3313,7 +3313,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sec_rmt_host_support_feat_evt (UINT8 *p)
+void btm_sec_rmt_host_support_feat_evt (uint8_t *p)
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
     BD_ADDR         bd_addr;        /* peer address */
@@ -3347,13 +3347,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_io_capabilities_req (UINT8 *p)
+void btm_io_capabilities_req (uint8_t *p)
 {
     tBTM_SP_IO_REQ  evt_data;
-    UINT8           err_code = 0;
+    uint8_t         err_code = 0;
     tBTM_SEC_DEV_REC *p_dev_rec;
-    BOOLEAN         is_orig = TRUE;
-    UINT8           callback_rc = BTM_SUCCESS;
+    bool            is_orig = true;
+    uint8_t         callback_rc = BTM_SUCCESS;
 
     STREAM_TO_BDADDR (evt_data.bd_addr, p);
 
@@ -3364,32 +3364,32 @@
     evt_data.oob_data = BTM_OOB_NONE;
     evt_data.auth_req = BTM_DEFAULT_AUTH_REQ;
 
-    BTM_TRACE_EVENT("%s: State: %s", __FUNCTION__, btm_pair_state_descr(btm_cb.pairing_state));
+    BTM_TRACE_EVENT("%s: State: %s", __func__, btm_pair_state_descr(btm_cb.pairing_state));
 
     p_dev_rec = btm_find_or_alloc_dev (evt_data.bd_addr);
 
-    BTM_TRACE_DEBUG("%s:Security mode: %d, Num Read Remote Feat pages: %d", __FUNCTION__,
+    BTM_TRACE_DEBUG("%s:Security mode: %d, Num Read Remote Feat pages: %d", __func__,
                       btm_cb.security_mode, p_dev_rec->num_read_pages);
 
     if ((btm_cb.security_mode == BTM_SEC_MODE_SC) && (p_dev_rec->num_read_pages == 0))
     {
         BTM_TRACE_EVENT("%s: Device security mode is SC only.",
-                         "To continue need to know remote features.", __FUNCTION__);
+                         "To continue need to know remote features.", __func__);
 
-        p_dev_rec->remote_features_needed = TRUE;
+        p_dev_rec->remote_features_needed = true;
         return;
     }
 
     p_dev_rec->sm4 |= BTM_SM4_TRUE;
 
     BTM_TRACE_EVENT("%s: State: %s  Flags: 0x%04x  p_cur_service: 0x%08x",
-                     __FUNCTION__, btm_pair_state_descr(btm_cb.pairing_state),
+                     __func__, btm_pair_state_descr(btm_cb.pairing_state),
                      btm_cb.pairing_flags, p_dev_rec->p_cur_service);
 
     if (p_dev_rec->p_cur_service)
     {
         BTM_TRACE_EVENT("%s: cur_service psm: 0x%04x, security_flags: 0x%04x",
-                         __FUNCTION__, p_dev_rec->p_cur_service->psm,
+                         __func__, p_dev_rec->p_cur_service->psm,
                          p_dev_rec->p_cur_service->security_flags);
     }
 
@@ -3403,7 +3403,7 @@
 
         /* received IO capability response already->acceptor */
         case BTM_PAIR_STATE_INCOMING_SSP:
-            is_orig = FALSE;
+            is_orig = false;
 
             if (btm_cb.pairing_flags & BTM_PAIR_FLAGS_PEER_STARTED_DD)
             {
@@ -3428,7 +3428,7 @@
         /* any other state is unexpected */
         default:
             err_code = HCI_ERR_HOST_BUSY_PAIRING;
-            BTM_TRACE_ERROR("%s: Unexpected Pairing state received %d", __FUNCTION__,
+            BTM_TRACE_ERROR("%s: Unexpected Pairing state received %d", __func__,
                              btm_cb.pairing_state);
             break;
     }
@@ -3436,17 +3436,17 @@
     if (btm_cb.pairing_disabled)
     {
         /* pairing is not allowed */
-        BTM_TRACE_DEBUG("%s: Pairing is not allowed -> fail pairing.", __FUNCTION__);
+        BTM_TRACE_DEBUG("%s: Pairing is not allowed -> fail pairing.", __func__);
         err_code = HCI_ERR_PAIRING_NOT_ALLOWED;
     }
     else if (btm_cb.security_mode == BTM_SEC_MODE_SC)
     {
-        BOOLEAN local_supports_sc = controller_get_interface()->supports_secure_connections();
+        bool    local_supports_sc = controller_get_interface()->supports_secure_connections();
         /* device in Secure Connections Only mode */
         if (!(local_supports_sc) || !(p_dev_rec->remote_supports_secure_connections))
         {
             BTM_TRACE_DEBUG("%s: SC only service, local_support_for_sc %d,",
-                            " remote_support_for_sc 0x%02x -> fail pairing", __FUNCTION__,
+                            " remote_support_for_sc 0x%02x -> fail pairing", __func__,
                             local_supports_sc, p_dev_rec->remote_supports_secure_connections);
 
             err_code = HCI_ERR_PAIRING_NOT_ALLOWED;
@@ -3526,7 +3526,7 @@
             /* SC only mode requires MITM for any service so let's set MITM bit */
             evt_data.auth_req |= BTM_AUTH_YN_BIT;
             BTM_TRACE_DEBUG("%s: for device in \"SC only\" mode set auth_req to 0x%02x",
-                             __FUNCTION__, evt_data.auth_req);
+                             __func__, evt_data.auth_req);
         }
 
         /* if the user does not indicate "reply later" by setting the oob_data to unknown */
@@ -3535,7 +3535,7 @@
         btm_cb.devcb.loc_io_caps    = evt_data.io_cap;
 
         BTM_TRACE_EVENT("%s: State: %s  IO_CAP:%d oob_data:%d auth_req:%d",
-                         __FUNCTION__, btm_pair_state_descr(btm_cb.pairing_state), evt_data.io_cap,
+                         __func__, btm_pair_state_descr(btm_cb.pairing_state), evt_data.io_cap,
                          evt_data.oob_data, evt_data.auth_req);
 
         btsnd_hcic_io_cap_req_reply(evt_data.bd_addr, evt_data.io_cap,
@@ -3553,7 +3553,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_io_capabilities_rsp (UINT8 *p)
+void btm_io_capabilities_rsp (uint8_t *p)
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
     tBTM_SP_IO_RSP evt_data;
@@ -3619,11 +3619,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_proc_sp_req_evt (tBTM_SP_EVT event, UINT8 *p)
+void btm_proc_sp_req_evt (tBTM_SP_EVT event, uint8_t *p)
 {
     tBTM_STATUS status = BTM_ERR_PROCESSING;
     tBTM_SP_EVT_DATA evt_data;
-    UINT8               *p_bda = evt_data.cfm_req.bd_addr;
+    uint8_t             *p_bda = evt_data.cfm_req.bd_addr;
     tBTM_SEC_DEV_REC *p_dev_rec;
 
     /* All events start with bd_addr */
@@ -3651,7 +3651,7 @@
                 /* The device record must be allocated in the "IO cap exchange" step */
                 STREAM_TO_UINT32 (evt_data.cfm_req.num_val, p);
 
-                evt_data.cfm_req.just_works = TRUE;
+                evt_data.cfm_req.just_works = true;
 
                 /* process user confirm req in association with the auth_req param */
 #if (BTM_LOCAL_IO_CAPS == BTM_IO_CAP_IO)
@@ -3661,7 +3661,7 @@
                 {
                     /* Both devices are DisplayYesNo and one or both devices want to authenticate
                        -> use authenticated link key */
-                    evt_data.cfm_req.just_works = FALSE;
+                    evt_data.cfm_req.just_works = false;
                 }
 #endif
                 BTM_TRACE_DEBUG ("btm_proc_sp_req_evt()  just_works:%d, io loc:%d, rmt:%d, auth loc:%d, rmt:%d",
@@ -3700,7 +3700,7 @@
             }
             /* else BTM_NOT_AUTHORIZED means when the app wants to reject the req right now */
         }
-        else if ( (event == BTM_SP_CFM_REQ_EVT) && (evt_data.cfm_req.just_works == TRUE) )
+        else if ( (event == BTM_SP_CFM_REQ_EVT) && (evt_data.cfm_req.just_works == true) )
         {
             /* automatically reply with just works if no sp_cback */
             status = BTM_SUCCESS;
@@ -3725,7 +3725,7 @@
 
     if (BTM_SP_CFM_REQ_EVT == event)
     {
-        btsnd_hcic_user_conf_reply (p_bda, FALSE);
+        btsnd_hcic_user_conf_reply (p_bda, false);
     }
     else if (BTM_SP_KEY_NOTIF_EVT == event)
     {
@@ -3758,10 +3758,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void  btm_keypress_notif_evt (UINT8 *p)
+void  btm_keypress_notif_evt (uint8_t *p)
 {
     tBTM_SP_KEYPRESS    evt_data;
-    UINT8 *p_bda;
+    uint8_t *p_bda;
 
     /* parse & report BTM_SP_KEYPRESS_EVT */
     if (btm_cb.api.p_sp_callback)
@@ -3785,12 +3785,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_simple_pair_complete (UINT8 *p)
+void btm_simple_pair_complete (uint8_t *p)
 {
     tBTM_SP_COMPLT  evt_data;
     tBTM_SEC_DEV_REC *p_dev_rec;
-    UINT8           status;
-    BOOLEAN         disc = FALSE;
+    uint8_t         status;
+    bool            disc = false;
 
     status = *p++;
     STREAM_TO_BDADDR (evt_data.bd_addr, p);
@@ -3832,11 +3832,11 @@
             if (p_dev_rec->sec_state != BTM_SEC_STATE_AUTHENTICATING)
             {
                 /* the initiating side: will receive auth complete event. disconnect ACL at that time */
-                disc = TRUE;
+                disc = true;
             }
         }
         else
-            disc = TRUE;
+            disc = true;
     }
 
     /* Let the pairing state stay active, p_auth_complete_callback will report the failure */
@@ -3867,9 +3867,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_rem_oob_req (UINT8 *p)
+void btm_rem_oob_req (uint8_t *p)
 {
-    UINT8 *p_bda;
+    uint8_t *p_bda;
     tBTM_SP_RMT_OOB  evt_data;
     tBTM_SEC_DEV_REC *p_dev_rec;
     BT_OCTET16      c;
@@ -3892,7 +3892,7 @@
         btm_sec_change_pairing_state(BTM_PAIR_STATE_WAIT_LOCAL_OOB_RSP);
         if ((*btm_cb.api.p_sp_callback) (BTM_SP_RMT_OOB_EVT, (tBTM_SP_EVT_DATA *)&evt_data) == BTM_NOT_AUTHORIZED)
         {
-            BTM_RemoteOobDataReply(TRUE, p_bda, c, r);
+            BTM_RemoteOobDataReply(true, p_bda, c, r);
         }
         return;
     }
@@ -3912,10 +3912,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_read_local_oob_complete (UINT8 *p)
+void btm_read_local_oob_complete (uint8_t *p)
 {
     tBTM_SP_LOC_OOB evt_data;
-    UINT8           status = *p++;
+    uint8_t         status = *p++;
 
     BTM_TRACE_EVENT ("btm_read_local_oob_complete:%d", status);
     if (status == HCI_SUCCESS)
@@ -3941,7 +3941,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btm_sec_auth_collision (UINT16 handle)
+static void btm_sec_auth_collision (uint16_t handle)
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
 
@@ -3983,12 +3983,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sec_auth_complete (UINT16 handle, UINT8 status)
+void btm_sec_auth_complete (uint16_t handle, uint8_t status)
 {
-    UINT8            old_sm4;
+    uint8_t          old_sm4;
     tBTM_PAIRING_STATE  old_state   = btm_cb.pairing_state;
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
-    BOOLEAN             are_bonding = FALSE;
+    bool                are_bonding = false;
 
     /* Commenting out trace due to obf/compilation problems.
     */
@@ -4043,7 +4043,7 @@
     if ( (btm_cb.pairing_state != BTM_PAIR_STATE_IDLE)
          &&  (btm_cb.pairing_flags & BTM_PAIR_FLAGS_WE_STARTED_DD)
          &&  (memcmp (p_dev_rec->bd_addr, btm_cb.pairing_bda, BD_ADDR_LEN) == 0) )
-        are_bonding = TRUE;
+        are_bonding = true;
 
     if ( (btm_cb.pairing_state != BTM_PAIR_STATE_IDLE)
           &&  (memcmp (p_dev_rec->bd_addr, btm_cb.pairing_bda, BD_ADDR_LEN) == 0) )
@@ -4154,7 +4154,7 @@
             }
         }
 
-        btm_sec_dev_rec_cback_event (p_dev_rec, BTM_ERR_PROCESSING, FALSE);
+        btm_sec_dev_rec_cback_event (p_dev_rec, BTM_ERR_PROCESSING, false);
 
         if (btm_cb.pairing_flags & BTM_PAIR_FLAGS_DISC_WHEN_DONE)
         {
@@ -4178,7 +4178,7 @@
 
     /* If there is no next procedure, or procedure failed to start, notify the caller */
     if (status != BTM_CMD_STARTED)
-        btm_sec_dev_rec_cback_event (p_dev_rec, status, FALSE);
+        btm_sec_dev_rec_cback_event (p_dev_rec, status, false);
 }
 
 /*******************************************************************************
@@ -4191,12 +4191,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sec_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable)
+void btm_sec_encrypt_change (uint16_t handle, uint8_t status, uint8_t encr_enable)
 {
     tBTM_SEC_DEV_REC  *p_dev_rec = btm_find_dev_by_handle (handle);
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
     tACL_CONN       *p_acl = NULL;
-    UINT8           acl_idx = btm_handle_to_acl_index(handle);
+    uint8_t         acl_idx = btm_handle_to_acl_index(handle);
 #endif
     BTM_TRACE_EVENT ("Security Manager: encrypt_change status:%d State:%d, encr_enable = %d",
                       status, (p_dev_rec) ? p_dev_rec->sec_state : 0, encr_enable);
@@ -4243,7 +4243,7 @@
 
     BTM_TRACE_DEBUG ("after update p_dev_rec->sec_flags=0x%x", p_dev_rec->sec_flags );
 
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
     if (acl_idx != MAX_L2CAP_LINKS)
         p_acl = &btm_cb.acl_db[acl_idx];
 
@@ -4283,7 +4283,7 @@
                  && (p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_AUTHED))))
             {
                 /* BR/EDR is encrypted with LK that can be used to derive LE LTK */
-                p_dev_rec->new_encryption_key_is_p256 = FALSE;
+                p_dev_rec->new_encryption_key_is_p256 = false;
 
                 if (p_dev_rec->no_smp_on_br)
                 {
@@ -4335,15 +4335,15 @@
     /* If encryption setup failed, notify the waiting layer */
     if (status != HCI_SUCCESS)
     {
-        btm_sec_dev_rec_cback_event (p_dev_rec, BTM_ERR_PROCESSING, FALSE);
+        btm_sec_dev_rec_cback_event (p_dev_rec, BTM_ERR_PROCESSING, false);
         return;
     }
 
     /* Encryption setup succeeded, execute the next security procedure, if any */
-    status = (UINT8)btm_sec_execute_procedure (p_dev_rec);
+    status = (uint8_t)btm_sec_execute_procedure (p_dev_rec);
     /* If there is no next procedure, or procedure failed to start, notify the caller */
     if (status != BTM_CMD_STARTED)
-        btm_sec_dev_rec_cback_event (p_dev_rec, status, FALSE);
+        btm_sec_dev_rec_cback_event (p_dev_rec, status, false);
 }
 
 /*******************************************************************************
@@ -4386,13 +4386,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode)
+void btm_sec_connected (uint8_t *bda, uint16_t handle, uint8_t status, uint8_t enc_mode)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bda);
-    UINT8            res;
-    BOOLEAN          is_pairing_device = FALSE;
+    uint8_t          res;
+    bool             is_pairing_device = false;
     tACL_CONN        *p_acl_cb;
-    UINT8            bit_shift = 0;
+    uint8_t          bit_shift = 0;
 
     btm_acl_resubmit_page();
 
@@ -4439,7 +4439,7 @@
     else    /* Update the timestamp for this device */
     {
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         bit_shift = (handle == p_dev_rec->ble_hci_handle) ? 8 :0;
 #endif
         p_dev_rec->timestamp = btm_cb.dev_rec_count++;
@@ -4471,14 +4471,14 @@
                         btm_sec_change_pairing_state (BTM_PAIR_STATE_GET_REM_NAME);
                         BTM_ReadRemoteDeviceName(p_dev_rec->bd_addr, NULL, BT_TRANSPORT_BR_EDR);
                     }
-#if BTM_DISC_DURING_RS == TRUE
+#if (BTM_DISC_DURING_RS == TRUE)
                     p_dev_rec->rs_disc_pending   = BTM_SEC_RS_NOT_PENDING;     /* reset flag */
 #endif
                     return;
                 }
                 else
                 {
-                    l2cu_update_lcb_4_bonding(p_dev_rec->bd_addr, TRUE);
+                    l2cu_update_lcb_4_bonding(p_dev_rec->bd_addr, true);
                 }
             }
             /* always clear the pending flag */
@@ -4486,11 +4486,11 @@
         }
     }
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     p_dev_rec->device_type |= BT_DEVICE_TYPE_BREDR;
 #endif
 
-#if BTM_DISC_DURING_RS == TRUE
+#if (BTM_DISC_DURING_RS == TRUE)
     p_dev_rec->rs_disc_pending   = BTM_SEC_RS_NOT_PENDING;     /* reset flag */
 #endif
 
@@ -4535,7 +4535,7 @@
             return;
         }
 
-        is_pairing_device = TRUE;
+        is_pairing_device = true;
     }
 
     /* If connection was made to do bonding restore link security if changed */
@@ -4599,9 +4599,9 @@
 
         if (status == HCI_ERR_CONNECTION_TOUT || status == HCI_ERR_LMP_RESPONSE_TIMEOUT  ||
             status == HCI_ERR_UNSPECIFIED     || status == HCI_ERR_PAGE_TIMEOUT)
-            btm_sec_dev_rec_cback_event (p_dev_rec, BTM_DEVICE_TIMEOUT, FALSE);
+            btm_sec_dev_rec_cback_event (p_dev_rec, BTM_DEVICE_TIMEOUT, false);
         else
-            btm_sec_dev_rec_cback_event (p_dev_rec, BTM_ERR_PROCESSING, FALSE);
+            btm_sec_dev_rec_cback_event (p_dev_rec, BTM_ERR_PROCESSING, false);
 
         return;
     }
@@ -4613,7 +4613,7 @@
     {
         if (p_dev_rec->link_key_not_sent)
         {
-            p_dev_rec->link_key_not_sent = FALSE;
+            p_dev_rec->link_key_not_sent = false;
             btm_send_link_key_notif(p_dev_rec);
         }
 
@@ -4621,9 +4621,9 @@
 
         /* remember flag before it is initialized */
         if (btm_cb.pairing_flags & BTM_PAIR_FLAGS_WE_STARTED_DD)
-            res = TRUE;
+            res = true;
         else
-            res = FALSE;
+            res = false;
 
         if (btm_cb.api.p_auth_complete_callback)
             (*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
@@ -4635,7 +4635,7 @@
         if ( res )
         {
             /* Let l2cap start bond timer */
-            l2cu_update_lcb_4_bonding (p_dev_rec->bd_addr, TRUE);
+            l2cu_update_lcb_4_bonding (p_dev_rec->bd_addr, true);
         }
 
         return;
@@ -4650,7 +4650,7 @@
     if (p_acl_cb)
     {
         /* whatever is in btm_establish_continue() without reporting the BTM_BL_CONN_EVT event */
-#if (!defined(BTM_BYPASS_EXTRA_ACL_SETUP) || BTM_BYPASS_EXTRA_ACL_SETUP == FALSE)
+#if (BTM_BYPASS_EXTRA_ACL_SETUP == FALSE)
         /* For now there are a some devices that do not like sending */
         /* commands events and data at the same time. */
         /* Set the packet types to the default allowed by the device */
@@ -4680,7 +4680,7 @@
         p_dev_rec->sec_flags |= (BTM_SEC_16_DIGIT_PIN_AUTHED << bit_shift);
     }
 
-    p_dev_rec->link_key_changed = FALSE;
+    p_dev_rec->link_key_changed = false;
 
     /* After connection is established we perform security if we do not know */
     /* the name, or if we are originator because some procedure can have */
@@ -4689,7 +4689,7 @@
     if (!(p_dev_rec->sec_flags & BTM_SEC_NAME_KNOWN) || p_dev_rec->is_originator)
     {
         if ((res = btm_sec_execute_procedure (p_dev_rec)) != BTM_CMD_STARTED)
-            btm_sec_dev_rec_cback_event (p_dev_rec, res, FALSE);
+            btm_sec_dev_rec_cback_event (p_dev_rec, res, false);
     }
     return;
 }
@@ -4703,7 +4703,7 @@
 ** Returns          btm status
 **
 *******************************************************************************/
-tBTM_STATUS btm_sec_disconnect (UINT16 handle, UINT8 reason)
+tBTM_STATUS btm_sec_disconnect (uint16_t handle, uint8_t reason)
 {
     tBTM_SEC_DEV_REC  *p_dev_rec = btm_find_dev_by_handle (handle);
 
@@ -4737,16 +4737,16 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sec_disconnected (UINT16 handle, UINT8 reason)
+void btm_sec_disconnected (uint16_t handle, uint8_t reason)
 {
     tBTM_SEC_DEV_REC  *p_dev_rec = btm_find_dev_by_handle (handle);
-    UINT8             old_pairing_flags = btm_cb.pairing_flags;
+    uint8_t           old_pairing_flags = btm_cb.pairing_flags;
     int               result = HCI_ERR_AUTH_FAILURE;
     tBTM_SEC_CALLBACK   *p_callback = NULL;
     tBT_TRANSPORT      transport = BT_TRANSPORT_BR_EDR;
 
     /* If page was delayed for disc complete, can do it now */
-    btm_cb.discing = FALSE;
+    btm_cb.discing = false;
 
     btm_acl_resubmit_page();
 
@@ -4757,7 +4757,7 @@
 
     p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING;     /* reset flag */
 
-#if BTM_DISC_DURING_RS == TRUE
+#if (BTM_DISC_DURING_RS == TRUE)
     LOG_INFO(LOG_TAG, "%s clearing pending flag handle:%d reason:%d", __func__, handle, reason);
     p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING;     /* reset flag */
 #endif
@@ -4797,7 +4797,7 @@
         }
     }
 
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
     btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, p_dev_rec->bd_addr, HCI_SUCCESS);
     /* see sec_flags processing in btm_acl_removed */
 
@@ -4815,7 +4815,7 @@
                 | BTM_SEC_ROLE_SWITCHED | BTM_SEC_16_DIGIT_PIN_AUTHED);
     }
 
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
     if (p_dev_rec->sec_state == BTM_SEC_STATE_DISCONNECTING_BOTH)
     {
         p_dev_rec->sec_state = (transport == BT_TRANSPORT_LE) ?
@@ -4849,11 +4849,11 @@
 ** Returns          Pointer to the record or NULL
 **
 *******************************************************************************/
-void btm_sec_link_key_notification (UINT8 *p_bda, UINT8 *p_link_key, UINT8 key_type)
+void btm_sec_link_key_notification (uint8_t *p_bda, uint8_t *p_link_key, uint8_t key_type)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev (p_bda);
-    BOOLEAN         we_are_bonding = FALSE;
-    BOOLEAN         ltk_derived_lk  = FALSE;
+    bool            we_are_bonding = false;
+    bool            ltk_derived_lk  = false;
 
     BTM_TRACE_EVENT ("btm_sec_link_key_notification()  BDA:%04x%08x, TYPE: %d",
                       (p_bda[0]<<8)+p_bda[1], (p_bda[2]<<24)+(p_bda[3]<<16)+(p_bda[4]<<8)+p_bda[5],
@@ -4862,7 +4862,7 @@
     if ((key_type >= BTM_LTK_DERIVED_LKEY_OFFSET + BTM_LKEY_TYPE_COMBINATION) &&
         (key_type <= BTM_LTK_DERIVED_LKEY_OFFSET + BTM_LKEY_TYPE_AUTH_COMB_P_256))
     {
-        ltk_derived_lk = TRUE;
+        ltk_derived_lk = true;
         key_type -= BTM_LTK_DERIVED_LKEY_OFFSET;
     }
     /* If connection was made to do bonding restore link security if changed */
@@ -4893,7 +4893,7 @@
          && (memcmp (btm_cb.pairing_bda, p_bda, BD_ADDR_LEN) == 0) )
     {
         if (btm_cb.pairing_flags & BTM_PAIR_FLAGS_WE_STARTED_DD)
-            we_are_bonding = TRUE;
+            we_are_bonding = true;
         else
             btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
     }
@@ -4904,7 +4904,7 @@
         if (btm_cb.api.p_link_key_callback)
         {
                 BTM_TRACE_DEBUG ("%s() Save LTK derived LK (key_type = %d)",
-                                  __FUNCTION__, p_dev_rec->link_key_type);
+                                  __func__, p_dev_rec->link_key_type);
                 (*btm_cb.api.p_link_key_callback) (p_bda, p_dev_rec->dev_class,
                                                    p_dev_rec->sec_bd_name,
                                                    p_link_key, p_dev_rec->link_key_type);
@@ -4915,7 +4915,7 @@
         if ((p_dev_rec->link_key_type == BTM_LKEY_TYPE_UNAUTH_COMB_P_256) ||
             (p_dev_rec->link_key_type == BTM_LKEY_TYPE_AUTH_COMB_P_256))
         {
-             p_dev_rec->new_encryption_key_is_p256 = TRUE;
+             p_dev_rec->new_encryption_key_is_p256 = true;
              BTM_TRACE_DEBUG ("%s set new_encr_key_256 to %d",
                                __func__, p_dev_rec->new_encryption_key_is_p256);
         }
@@ -4931,7 +4931,7 @@
                           (p_bda[0]<<24) + (p_bda[1]<<16) + (p_bda[2]<<8) + p_bda[3],
                           (p_bda[4] << 8) + p_bda[5], key_type);
 
-        p_dev_rec->link_key_not_sent = TRUE;
+        p_dev_rec->link_key_not_sent = true;
 
         /* If it is for bonding nothing else will follow, so we need to start name resolution */
         if (we_are_bonding)
@@ -4987,7 +4987,7 @@
 ** Returns          Pointer to the record or NULL
 **
 *******************************************************************************/
-void btm_sec_link_key_request (UINT8 *p_bda)
+void btm_sec_link_key_request (uint8_t *p_bda)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev (p_bda);
 
@@ -5036,7 +5036,7 @@
 #else
     tBTM_AUTH_REQ   auth_req = BTM_AUTH_AP_YES;
 #endif
-    UINT8   name[2];
+    uint8_t name[2];
 
 /* Coverity: FALSE-POSITIVE error from Coverity tool. Please do NOT remove following comment. */
 /* coverity[UNUSED_VALUE] pointer p_dev_rec is actually used several times... This is a Coverity false-positive, i.e. a fake issue.
@@ -5074,7 +5074,7 @@
             break;
 
         case BTM_PAIR_STATE_WAIT_NUMERIC_CONFIRM:
-            btsnd_hcic_user_conf_reply (p_cb->pairing_bda, FALSE);
+            btsnd_hcic_user_conf_reply (p_cb->pairing_bda, false);
             /* btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE); */
             break;
 
@@ -5151,7 +5151,7 @@
 ** Returns          Pointer to the record or NULL
 **
 *******************************************************************************/
-void btm_sec_pin_code_request (UINT8 *p_bda)
+void btm_sec_pin_code_request (uint8_t *p_bda)
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
     tBTM_CB          *p_cb = &btm_cb;
@@ -5257,7 +5257,7 @@
             btm_cb.pairing_flags |= BTM_PAIR_FLAGS_PIN_REQD;
             if (p_cb->api.p_pin_callback) {
                 (*p_cb->api.p_pin_callback) (p_bda, p_dev_rec->dev_class, p_dev_rec->sec_bd_name,
-                        (p_dev_rec->p_cur_service == NULL) ? FALSE
+                        (p_dev_rec->p_cur_service == NULL) ? false
                                 : (p_dev_rec->p_cur_service->security_flags
                                    & BTM_SEC_IN_MIN_16_DIGIT_PIN));
             }
@@ -5281,7 +5281,7 @@
                 btm_cb.pairing_flags |= BTM_PAIR_FLAGS_PIN_REQD;
                 if (p_cb->api.p_pin_callback)
                     (*p_cb->api.p_pin_callback) (p_bda, p_dev_rec->dev_class,
-                            p_dev_rec->sec_bd_name, (p_dev_rec->p_cur_service == NULL) ? FALSE
+                            p_dev_rec->sec_bd_name, (p_dev_rec->p_cur_service == NULL) ? false
                                     : (p_dev_rec->p_cur_service->security_flags
                                        & BTM_SEC_IN_MIN_16_DIGIT_PIN));
             }
@@ -5300,7 +5300,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btm_sec_update_clock_offset (UINT16 handle, UINT16 clock_offset)
+void btm_sec_update_clock_offset (uint16_t handle, uint16_t clock_offset)
 {
     tBTM_SEC_DEV_REC  *p_dev_rec;
     tBTM_INQ_INFO     *p_inq_info;
@@ -5375,7 +5375,7 @@
 
 #if (L2CAP_UCD_INCLUDED == TRUE)
         /* if incoming UCD packet, discard it */
-        if ( !p_dev_rec->is_originator && (p_dev_rec->is_ucd == TRUE ))
+        if ( !p_dev_rec->is_originator && (p_dev_rec->is_ucd == true ))
             return(BTM_FAILED_ON_SECURITY);
 #endif
 
@@ -5416,7 +5416,7 @@
     {
 #if (L2CAP_UCD_INCLUDED == TRUE)
         /* if incoming UCD packet, discard it */
-        if ( !p_dev_rec->is_originator && (p_dev_rec->is_ucd == TRUE ))
+        if ( !p_dev_rec->is_originator && (p_dev_rec->is_ucd == true ))
             return(BTM_FAILED_ON_SECURITY);
 #endif
 
@@ -5433,7 +5433,7 @@
         (p_dev_rec->link_key_type != BTM_LKEY_TYPE_AUTH_COMB_P_256))
     {
         BTM_TRACE_EVENT("%s: Security Manager: SC only service, but link key type is 0x%02x -",
-                        "security failure", __FUNCTION__, p_dev_rec->link_key_type);
+                        "security failure", __func__, p_dev_rec->link_key_type);
         return (BTM_FAILED_ON_SECURITY);
     }
 
@@ -5447,10 +5447,10 @@
                           p_dev_rec->p_cur_service->service_id,
                           (BTM_SEC_IS_SERVICE_TRUSTED(p_dev_rec->trusted_mask,
                                                       p_dev_rec->p_cur_service->service_id)));
-        if ((btm_sec_are_all_trusted(p_dev_rec->trusted_mask) == FALSE) &&
+        if ((btm_sec_are_all_trusted(p_dev_rec->trusted_mask) == false) &&
             (p_dev_rec->p_cur_service->service_id < BTM_SEC_MAX_SERVICES) &&
             (BTM_SEC_IS_SERVICE_TRUSTED(p_dev_rec->trusted_mask,
-                                        p_dev_rec->p_cur_service->service_id) == FALSE))
+                                        p_dev_rec->p_cur_service->service_id) == false))
         {
             BTM_TRACE_EVENT ("Security Manager: Start authorization");
             return(btm_sec_start_authorization (p_dev_rec));
@@ -5476,12 +5476,12 @@
 **
 ** Description      This function is called to start get name procedure
 **
-** Returns          TRUE if started
+** Returns          true if started
 **
 *******************************************************************************/
-static BOOLEAN btm_sec_start_get_name (tBTM_SEC_DEV_REC *p_dev_rec)
+static bool    btm_sec_start_get_name (tBTM_SEC_DEV_REC *p_dev_rec)
 {
-    UINT8 tempstate = p_dev_rec->sec_state;
+    uint8_t tempstate = p_dev_rec->sec_state;
 
     p_dev_rec->sec_state = BTM_SEC_STATE_GETTING_NAME;
 
@@ -5491,10 +5491,10 @@
                                 0, NULL)) != BTM_CMD_STARTED)
     {
         p_dev_rec->sec_state = tempstate;
-        return(FALSE);
+        return(false);
     }
 
-    return(TRUE);
+    return(true);
 }
 
 /*******************************************************************************
@@ -5503,10 +5503,10 @@
 **
 ** Description      This function is called to start authentication
 **
-** Returns          TRUE if started
+** Returns          true if started
 **
 *******************************************************************************/
-static BOOLEAN btm_sec_start_authentication (tBTM_SEC_DEV_REC *p_dev_rec)
+static bool    btm_sec_start_authentication (tBTM_SEC_DEV_REC *p_dev_rec)
 {
     p_dev_rec->sec_state = BTM_SEC_STATE_AUTHENTICATING;
 
@@ -5519,16 +5519,16 @@
 **
 ** Description      This function is called to start encryption
 **
-** Returns          TRUE if started
+** Returns          true if started
 **
 *******************************************************************************/
-static BOOLEAN btm_sec_start_encryption (tBTM_SEC_DEV_REC *p_dev_rec)
+static bool    btm_sec_start_encryption (tBTM_SEC_DEV_REC *p_dev_rec)
 {
-    if (!btsnd_hcic_set_conn_encrypt (p_dev_rec->hci_handle, TRUE))
-        return(FALSE);
+    if (!btsnd_hcic_set_conn_encrypt (p_dev_rec->hci_handle, true))
+        return(false);
 
     p_dev_rec->sec_state = BTM_SEC_STATE_ENCRYPTING;
-    return(TRUE);
+    return(true);
 }
 
 /*******************************************************************************
@@ -5537,14 +5537,14 @@
 **
 ** Description      This function is called to start authorization
 **
-** Returns          TRUE if started
+** Returns          true if started
 **
 *******************************************************************************/
-static UINT8 btm_sec_start_authorization (tBTM_SEC_DEV_REC *p_dev_rec)
+static uint8_t btm_sec_start_authorization (tBTM_SEC_DEV_REC *p_dev_rec)
 {
-    UINT8    result;
-    UINT8   *p_service_name = NULL;
-    UINT8    service_id;
+    uint8_t  result;
+    uint8_t *p_service_name = NULL;
+    uint8_t  service_id;
 
     if ((p_dev_rec->sec_flags & BTM_SEC_NAME_KNOWN)
         || (p_dev_rec->hci_handle == BTM_SEC_INVALID_HANDLE))
@@ -5606,19 +5606,19 @@
 **
 ** Description      This function is called check if all services are trusted
 **
-** Returns          TRUE if all are trusted, otherwise FALSE
+** Returns          true if all are trusted, otherwise false
 **
 *******************************************************************************/
-BOOLEAN btm_sec_are_all_trusted(UINT32 p_mask[])
+bool    btm_sec_are_all_trusted(uint32_t p_mask[])
 {
-    UINT32 trusted_inx;
+    uint32_t trusted_inx;
     for (trusted_inx = 0; trusted_inx < BTM_SEC_SERVICE_ARRAY_SIZE; trusted_inx++)
     {
         if (p_mask[trusted_inx] != BTM_SEC_TRUST_ALL)
-            return(FALSE);
+            return(false);
     }
 
-    return(TRUE);
+    return(true);
 }
 
 /*******************************************************************************
@@ -5631,18 +5631,18 @@
 ** Returns          Pointer to the record or NULL
 **
 *******************************************************************************/
-tBTM_SEC_SERV_REC *btm_sec_find_first_serv (CONNECTION_TYPE conn_type, UINT16 psm)
+tBTM_SEC_SERV_REC *btm_sec_find_first_serv (CONNECTION_TYPE conn_type, uint16_t psm)
 {
     tBTM_SEC_SERV_REC *p_serv_rec = &btm_cb.sec_serv_rec[0];
     int i;
-    BOOLEAN is_originator;
+    bool    is_originator;
 
 #if (L2CAP_UCD_INCLUDED == TRUE)
 
     if ( conn_type & CONNECTION_TYPE_ORIG_MASK )
-        is_originator = TRUE;
+        is_originator = true;
     else
-        is_originator = FALSE;
+        is_originator = false;
 #else
     is_originator = conn_type;
 #endif
@@ -5702,8 +5702,8 @@
 ** Returns          Pointer to the record or NULL
 **
 *******************************************************************************/
-static tBTM_SEC_SERV_REC *btm_sec_find_mx_serv (UINT8 is_originator, UINT16 psm,
-                                                UINT32 mx_proto_id, UINT32 mx_chan_id)
+static tBTM_SEC_SERV_REC *btm_sec_find_mx_serv (uint8_t is_originator, uint16_t psm,
+                                                uint32_t mx_proto_id, uint32_t mx_chan_id)
 {
     tBTM_SEC_SERV_REC *p_out_serv = btm_cb.p_out_serv;
     tBTM_SEC_SERV_REC *p_serv_rec = &btm_cb.sec_serv_rec[0];
@@ -5754,7 +5754,7 @@
     if (status != BTM_CMD_STARTED)
     {
         /* There is no next procedure or start of procedure failed, notify the waiting layer */
-        btm_sec_dev_rec_cback_event (btm_cb.p_collided_dev_rec, status, FALSE);
+        btm_sec_dev_rec_cback_event (btm_cb.p_collided_dev_rec, status, false);
     }
 }
 
@@ -5787,7 +5787,7 @@
 **                  otherwise, the trusted mask
 **
 *******************************************************************************/
-UINT32 * BTM_ReadTrustedMask (BD_ADDR bd_addr)
+uint32_t * BTM_ReadTrustedMask (BD_ADDR bd_addr)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
     if (p_dev_rec != NULL)
@@ -5810,14 +5810,14 @@
 {
     if (btm_cb.security_mode_changed)
     {
-        btm_cb.security_mode_changed = FALSE;
+        btm_cb.security_mode_changed = false;
         BTM_TRACE_DEBUG("%s() Auth enable -> %d", __func__, (btm_cb.security_mode == BTM_SEC_MODE_LINK));
-        btsnd_hcic_write_auth_enable ((UINT8)(btm_cb.security_mode == BTM_SEC_MODE_LINK));
+        btsnd_hcic_write_auth_enable ((uint8_t)(btm_cb.security_mode == BTM_SEC_MODE_LINK));
     }
 
     if (btm_cb.pin_type_changed)
     {
-        btm_cb.pin_type_changed = FALSE;
+        btm_cb.pin_type_changed = false;
         btsnd_hcic_write_pin_type (btm_cb.cfg.pin_type);
     }
 }
@@ -5826,7 +5826,7 @@
 bool is_sec_state_equal(void *data, void *context)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = data;
-    UINT8 *state = context;
+    uint8_t *state = context;
 
     if (p_dev_rec->sec_state == *state)
         return false;
@@ -5844,7 +5844,7 @@
 ** Returns          Pointer to the record or NULL
 **
 *******************************************************************************/
-tBTM_SEC_DEV_REC *btm_sec_find_dev_by_sec_state (UINT8 state)
+tBTM_SEC_DEV_REC *btm_sec_find_dev_by_sec_state (uint8_t state)
 {
     list_node_t *n = list_foreach(btm_cb.sec_dev_rec, is_sec_state_equal, &state);
     if (n)
@@ -5878,7 +5878,7 @@
         btm_cb.pin_code_len  = 0;
 
         /* Make sure the the lcb shows we are not bonding */
-        l2cu_update_lcb_4_bonding (btm_cb.pairing_bda, FALSE);
+        l2cu_update_lcb_4_bonding (btm_cb.pairing_bda, false);
 
         btm_restore_mode();
         btm_sec_check_pending_reqs();
@@ -5890,7 +5890,7 @@
     {
         /* If transitioning out of idle, mark the lcb as bonding */
         if (old_state == BTM_PAIR_STATE_IDLE)
-            l2cu_update_lcb_4_bonding (btm_cb.pairing_bda, TRUE);
+            l2cu_update_lcb_4_bonding (btm_cb.pairing_bda, true);
 
         alarm_set_on_queue(btm_cb.pairing_timer,
                            BTM_SEC_TIMEOUT_VALUE * 1000,
@@ -5944,7 +5944,7 @@
 ** Parameters:      void
 **
 *******************************************************************************/
-void btm_sec_dev_rec_cback_event (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 res, BOOLEAN is_le_transport)
+void btm_sec_dev_rec_cback_event (tBTM_SEC_DEV_REC *p_dev_rec, uint8_t res, bool    is_le_transport)
 {
     tBTM_SEC_CALLBACK   *p_callback = p_dev_rec->p_callback;
 
@@ -5952,7 +5952,7 @@
     {
         p_dev_rec->p_callback = NULL;
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         if (is_le_transport)
            (*p_callback) (p_dev_rec->ble.pseudo_addr, BT_TRANSPORT_LE, p_dev_rec->p_ref_data, res);
         else
@@ -5970,8 +5970,8 @@
 ** Description      Return state description for tracing
 **
 *******************************************************************************/
-static BOOLEAN btm_sec_queue_mx_request (BD_ADDR bd_addr,  UINT16 psm,  BOOLEAN is_orig,
-                                         UINT32 mx_proto_id, UINT32 mx_chan_id,
+static bool    btm_sec_queue_mx_request (BD_ADDR bd_addr,  uint16_t psm,  bool    is_orig,
+                                         uint32_t mx_proto_id, uint32_t mx_chan_id,
                                          tBTM_SEC_CALLBACK *p_callback, void *p_ref_data)
 {
     tBTM_SEC_QUEUE_ENTRY *p_e = (tBTM_SEC_QUEUE_ENTRY *)osi_malloc(sizeof(tBTM_SEC_QUEUE_ENTRY));
@@ -5992,14 +5992,14 @@
 
     fixed_queue_enqueue(btm_cb.sec_pending_q, p_e);
 
-    return TRUE;
+    return true;
 }
 
-static BOOLEAN btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC  *p_dev_rec)
+static bool    btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC  *p_dev_rec)
 {
-    UINT8 major = (UINT8)(p_dev_rec->dev_class[1] & BTM_COD_MAJOR_CLASS_MASK);
-    UINT8 minor = (UINT8)(p_dev_rec->dev_class[2] & BTM_COD_MINOR_CLASS_MASK);
-    BOOLEAN rv = FALSE;
+    uint8_t major = (uint8_t)(p_dev_rec->dev_class[1] & BTM_COD_MAJOR_CLASS_MASK);
+    uint8_t minor = (uint8_t)(p_dev_rec->dev_class[2] & BTM_COD_MINOR_CLASS_MASK);
+    bool    rv = false;
 
     if ((major == BTM_COD_MAJOR_AUDIO)
         &&  ((minor == BTM_COD_MINOR_CONFM_HANDSFREE) || (minor == BTM_COD_MINOR_CAR_AUDIO)) )
@@ -6007,13 +6007,13 @@
         BTM_TRACE_EVENT ("%s() Skipping pre-fetch PIN for carkit COD Major: 0x%02x Minor: 0x%02x",
             __func__, major, minor);
 
-        if (btm_cb.security_mode_changed == FALSE)
+        if (btm_cb.security_mode_changed == false)
         {
-            btm_cb.security_mode_changed = TRUE;
+            btm_cb.security_mode_changed = true;
 #ifdef APPL_AUTH_WRITE_EXCEPTION
             if(!(APPL_AUTH_WRITE_EXCEPTION)(p_dev_rec->bd_addr))
 #endif
-                btsnd_hcic_write_auth_enable (TRUE);
+                btsnd_hcic_write_auth_enable (true);
         }
     }
     else
@@ -6034,13 +6034,13 @@
                 if (btm_bda_to_acl(p_dev_rec->bd_addr, BT_TRANSPORT_BR_EDR) == NULL)
                 btm_cb.pairing_flags |= BTM_PAIR_FLAGS_PIN_REQD;
                 (btm_cb.api.p_pin_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
-                        p_dev_rec->sec_bd_name, (p_dev_rec->p_cur_service == NULL) ? FALSE
+                        p_dev_rec->sec_bd_name, (p_dev_rec->p_cur_service == NULL) ? false
                                 : (p_dev_rec->p_cur_service->security_flags
                                    & BTM_SEC_IN_MIN_16_DIGIT_PIN));
             }
         }
 
-        rv = TRUE;
+        rv = true;
     }
 
     return rv;
@@ -6057,9 +6057,9 @@
 **                  changed via the BTM_SecSetAuthPayloadTimeout() function.
 **
 *******************************************************************************/
-void btm_sec_auth_payload_tout (UINT8 *p, UINT16 hci_evt_len)
+void btm_sec_auth_payload_tout (uint8_t *p, uint16_t hci_evt_len)
 {
-    UINT16 handle;
+    uint16_t handle;
 
     STREAM_TO_UINT16 (handle, p);
     handle = HCID_GET_HANDLE (handle);
@@ -6076,7 +6076,7 @@
 **                  process pending.
 **
 *******************************************************************************/
-static BOOLEAN btm_sec_queue_encrypt_request (BD_ADDR bd_addr, tBT_TRANSPORT transport,
+static bool    btm_sec_queue_encrypt_request (BD_ADDR bd_addr, tBT_TRANSPORT transport,
                                          tBTM_SEC_CALLBACK *p_callback, void *p_ref_data,
                                          tBTM_BLE_SEC_ACT sec_act)
 {
@@ -6091,7 +6091,7 @@
     memcpy(p_e->bd_addr, bd_addr, BD_ADDR_LEN);
     fixed_queue_enqueue(btm_cb.sec_pending_q, p_e);
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -6107,7 +6107,7 @@
 void btm_sec_set_peer_sec_caps(tACL_CONN *p_acl_cb, tBTM_SEC_DEV_REC *p_dev_rec)
 {
     BD_ADDR     rem_bd_addr;
-    UINT8       *p_rem_bd_addr;
+    uint8_t     *p_rem_bd_addr;
 
     if ((btm_cb.security_mode == BTM_SEC_MODE_SP ||
          btm_cb.security_mode == BTM_SEC_MODE_SP_DEBUG ||
@@ -6121,21 +6121,21 @@
     else
     {
         p_dev_rec->sm4 = BTM_SM4_KNOWN;
-        p_dev_rec->remote_supports_secure_connections = FALSE;
+        p_dev_rec->remote_supports_secure_connections = false;
     }
 
-    BTM_TRACE_API("%s: sm4: 0x%02x, rmt_support_for_secure_connections %d", __FUNCTION__,
+    BTM_TRACE_API("%s: sm4: 0x%02x, rmt_support_for_secure_connections %d", __func__,
                   p_dev_rec->sm4, p_dev_rec->remote_supports_secure_connections);
 
     if (p_dev_rec->remote_features_needed)
     {
         BTM_TRACE_EVENT("%s: Now device in SC Only mode, waiting for peer remote features!",
-                        __FUNCTION__);
-        p_rem_bd_addr = (UINT8*) rem_bd_addr;
+                        __func__);
+        p_rem_bd_addr = (uint8_t*) rem_bd_addr;
         BDADDR_TO_STREAM(p_rem_bd_addr, p_dev_rec->bd_addr);
-        p_rem_bd_addr = (UINT8*) rem_bd_addr;
+        p_rem_bd_addr = (uint8_t*) rem_bd_addr;
         btm_io_capabilities_req(p_rem_bd_addr);
-        p_dev_rec->remote_features_needed = FALSE;
+        p_dev_rec->remote_features_needed = false;
     }
 }
 
@@ -6146,17 +6146,17 @@
 ** Description      This function is called to check if the service corresponding
 **                  to PSM is security mode 4 level 0 service.
 **
-** Returns          TRUE if the service is security mode 4 level 0 service
+** Returns          true if the service is security mode 4 level 0 service
 **
 *******************************************************************************/
-static BOOLEAN btm_sec_is_serv_level0(UINT16 psm)
+static bool    btm_sec_is_serv_level0(uint16_t psm)
 {
     if (psm == BT_PSM_SDP)
     {
-        BTM_TRACE_DEBUG("%s: PSM: 0x%04x -> mode 4 level 0 service", __FUNCTION__, psm);
-        return TRUE;
+        BTM_TRACE_DEBUG("%s: PSM: 0x%04x -> mode 4 level 0 service", __func__, psm);
+        return true;
     }
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -6170,25 +6170,25 @@
 **
 *******************************************************************************/
 static void btm_sec_check_pending_enc_req (tBTM_SEC_DEV_REC  *p_dev_rec, tBT_TRANSPORT transport,
-                                            UINT8 encr_enable)
+                                            uint8_t encr_enable)
 {
     if (fixed_queue_is_empty(btm_cb.sec_pending_q))
         return;
 
-    UINT8 res = encr_enable ? BTM_SUCCESS : BTM_ERR_PROCESSING;
+    uint8_t res = encr_enable ? BTM_SUCCESS : BTM_ERR_PROCESSING;
     list_t *list = fixed_queue_get_list(btm_cb.sec_pending_q);
     for (const list_node_t *node = list_begin(list); node != list_end(list); ) {
         tBTM_SEC_QUEUE_ENTRY *p_e = (tBTM_SEC_QUEUE_ENTRY *)list_node(node);
         node = list_next(node);
 
         if (memcmp(p_e->bd_addr, p_dev_rec->bd_addr, BD_ADDR_LEN) == 0 && p_e->psm == 0
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             && p_e->transport == transport
 #endif
             )
         {
             if (encr_enable == 0 || transport == BT_TRANSPORT_BR_EDR
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
                 || p_e->sec_act == BTM_BLE_SEC_ENCRYPT
                 || p_e->sec_act == BTM_BLE_SEC_ENCRYPT_NO_MITM
                 || (p_e->sec_act == BTM_BLE_SEC_ENCRYPT_MITM && p_dev_rec->sec_flags
@@ -6214,9 +6214,9 @@
 **                  connections only mode.
 **
 *******************************************************************************/
-static UINT16 btm_sec_set_serv_level4_flags(UINT16 cur_security, BOOLEAN is_originator)
+static uint16_t btm_sec_set_serv_level4_flags(uint16_t cur_security, bool    is_originator)
 {
-    UINT16  sec_level4_flags = is_originator ? BTM_SEC_OUT_LEVEL4_FLAGS : BTM_SEC_IN_LEVEL4_FLAGS;
+    uint16_t sec_level4_flags = is_originator ? BTM_SEC_OUT_LEVEL4_FLAGS : BTM_SEC_IN_LEVEL4_FLAGS;
 
     return cur_security | sec_level4_flags;
 }
@@ -6236,7 +6236,7 @@
 {
 
     BTM_TRACE_DEBUG ("%s() Clearing BLE Keys", __func__);
-#if (SMP_INCLUDED== TRUE)
+#if (SMP_INCLUDED == TRUE)
     p_dev_rec->ble.key_type = BTM_LE_KEY_NONE;
     memset (&p_dev_rec->ble.keys, 0, sizeof(tBTM_SEC_BLE_KEYS));
 
@@ -6252,14 +6252,14 @@
 **
 ** Description       Is the specified device is a bonded device
 **
-** Returns          TRUE - dev is bonded
+** Returns          true - dev is bonded
 **
 *******************************************************************************/
-BOOLEAN btm_sec_is_a_bonded_dev (BD_ADDR bda)
+bool    btm_sec_is_a_bonded_dev (BD_ADDR bda)
 {
 
     tBTM_SEC_DEV_REC *p_dev_rec= btm_find_dev (bda);
-    BOOLEAN is_bonded= FALSE;
+    bool    is_bonded= false;
 
     if (p_dev_rec &&
 #if (SMP_INCLUDED == TRUE)
@@ -6269,7 +6269,7 @@
 #endif
          (p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_KNOWN)))
     {
-        is_bonded = TRUE;
+        is_bonded = true;
     }
     BTM_TRACE_DEBUG ("%s() is_bonded=%d", __func__, is_bonded);
     return(is_bonded);
@@ -6281,17 +6281,17 @@
 **
 ** Description       Is the specified device is dual mode or LE only device
 **
-** Returns          TRUE - dev is a dual mode
+** Returns          true - dev is a dual mode
 **
 *******************************************************************************/
-BOOLEAN btm_sec_is_le_capable_dev (BD_ADDR bda)
+bool    btm_sec_is_le_capable_dev (BD_ADDR bda)
 {
     tBTM_SEC_DEV_REC *p_dev_rec= btm_find_dev (bda);
-    BOOLEAN le_capable = FALSE;
+    bool    le_capable = false;
 
-#if (BLE_INCLUDED== TRUE)
+#if (BLE_INCLUDED == TRUE)
     if (p_dev_rec && (p_dev_rec->device_type & BT_DEVICE_TYPE_BLE) == BT_DEVICE_TYPE_BLE)
-        le_capable  = TRUE;
+        le_capable  = true;
 #endif
     return le_capable;
 }
@@ -6305,30 +6305,30 @@
 **                  Is called when authentication for dedicated bonding is
 **                  successfully completed.
 **
-** Returns          TRUE - if SMP BR connection can be used (the link key is
+** Returns          true - if SMP BR connection can be used (the link key is
 **                         generated from P-256 and the peer supports Security
 **                         Manager over BR).
 **
 *******************************************************************************/
-static BOOLEAN btm_sec_use_smp_br_chnl(tBTM_SEC_DEV_REC *p_dev_rec)
+static bool    btm_sec_use_smp_br_chnl(tBTM_SEC_DEV_REC *p_dev_rec)
 {
-    UINT32  ext_feat;
-    UINT8   chnl_mask[L2CAP_FIXED_CHNL_ARRAY_SIZE];
+    uint32_t ext_feat;
+    uint8_t chnl_mask[L2CAP_FIXED_CHNL_ARRAY_SIZE];
 
     BTM_TRACE_DEBUG ("%s() link_key_type = 0x%x", __func__,
                       p_dev_rec->link_key_type);
 
     if ((p_dev_rec->link_key_type != BTM_LKEY_TYPE_UNAUTH_COMB_P_256) &&
         (p_dev_rec->link_key_type != BTM_LKEY_TYPE_AUTH_COMB_P_256))
-         return FALSE;
+         return false;
 
     if (!L2CA_GetPeerFeatures (p_dev_rec->bd_addr, &ext_feat, chnl_mask))
-        return FALSE;
+        return false;
 
     if (!(chnl_mask[0] & L2CAP_FIXED_CHNL_SMP_BR_BIT))
-        return FALSE;
+        return false;
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -6338,10 +6338,10 @@
 ** Description      The function checks if the device is BR/EDR master after
 **                  pairing is completed.
 **
-** Returns          TRUE - if the device is master.
+** Returns          true - if the device is master.
 **
 *******************************************************************************/
-static BOOLEAN btm_sec_is_master(tBTM_SEC_DEV_REC *p_dev_rec)
+static bool    btm_sec_is_master(tBTM_SEC_DEV_REC *p_dev_rec)
 {
     tACL_CONN *p= btm_bda_to_acl(p_dev_rec->bd_addr, BT_TRANSPORT_BR_EDR);
     return (p && (p->link_role == BTM_ROLE_MASTER));
diff --git a/stack/btu/btu_hcif.c b/stack/btu/btu_hcif.c
index ade7a9b..40e3a99 100644
--- a/stack/btu/btu_hcif.c
+++ b/stack/btu/btu_hcif.c
@@ -49,80 +49,80 @@
 #include "btu.h"
 extern fixed_queue_t *btu_hci_msg_queue;
 
-extern void btm_process_cancel_complete(UINT8 status, UINT8 mode);
-extern void btm_ble_test_command_complete(UINT8 *p);
+extern void btm_process_cancel_complete(uint8_t status, uint8_t mode);
+extern void btm_ble_test_command_complete(uint8_t *p);
 
 /********************************************************************************/
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
-static void btu_hcif_inquiry_comp_evt (UINT8 *p);
-static void btu_hcif_inquiry_result_evt (UINT8 *p);
-static void btu_hcif_inquiry_rssi_result_evt (UINT8 *p);
-static void btu_hcif_extended_inquiry_result_evt (UINT8 *p);
+static void btu_hcif_inquiry_comp_evt (uint8_t *p);
+static void btu_hcif_inquiry_result_evt (uint8_t *p);
+static void btu_hcif_inquiry_rssi_result_evt (uint8_t *p);
+static void btu_hcif_extended_inquiry_result_evt (uint8_t *p);
 
-static void btu_hcif_connection_comp_evt (UINT8 *p);
-static void btu_hcif_connection_request_evt (UINT8 *p);
-static void btu_hcif_disconnection_comp_evt (UINT8 *p);
-static void btu_hcif_authentication_comp_evt (UINT8 *p);
-static void btu_hcif_rmt_name_request_comp_evt (UINT8 *p, UINT16 evt_len);
-static void btu_hcif_encryption_change_evt (UINT8 *p);
-static void btu_hcif_read_rmt_features_comp_evt (UINT8 *p);
-static void btu_hcif_read_rmt_ext_features_comp_evt (UINT8 *p);
-static void btu_hcif_read_rmt_version_comp_evt (UINT8 *p);
-static void btu_hcif_qos_setup_comp_evt (UINT8 *p);
+static void btu_hcif_connection_comp_evt (uint8_t *p);
+static void btu_hcif_connection_request_evt (uint8_t *p);
+static void btu_hcif_disconnection_comp_evt (uint8_t *p);
+static void btu_hcif_authentication_comp_evt (uint8_t *p);
+static void btu_hcif_rmt_name_request_comp_evt (uint8_t *p, uint16_t evt_len);
+static void btu_hcif_encryption_change_evt (uint8_t *p);
+static void btu_hcif_read_rmt_features_comp_evt (uint8_t *p);
+static void btu_hcif_read_rmt_ext_features_comp_evt (uint8_t *p);
+static void btu_hcif_read_rmt_version_comp_evt (uint8_t *p);
+static void btu_hcif_qos_setup_comp_evt (uint8_t *p);
 static void btu_hcif_command_complete_evt (BT_HDR *response, void *context);
 static void btu_hcif_command_status_evt (uint8_t status, BT_HDR *command, void *context);
-static void btu_hcif_hardware_error_evt (UINT8 *p);
+static void btu_hcif_hardware_error_evt (uint8_t *p);
 static void btu_hcif_flush_occured_evt (void);
-static void btu_hcif_role_change_evt (UINT8 *p);
-static void btu_hcif_num_compl_data_pkts_evt (UINT8 *p);
-static void btu_hcif_mode_change_evt (UINT8 *p);
-static void btu_hcif_pin_code_request_evt (UINT8 *p);
-static void btu_hcif_link_key_request_evt (UINT8 *p);
-static void btu_hcif_link_key_notification_evt (UINT8 *p);
+static void btu_hcif_role_change_evt (uint8_t *p);
+static void btu_hcif_num_compl_data_pkts_evt (uint8_t *p);
+static void btu_hcif_mode_change_evt (uint8_t *p);
+static void btu_hcif_pin_code_request_evt (uint8_t *p);
+static void btu_hcif_link_key_request_evt (uint8_t *p);
+static void btu_hcif_link_key_notification_evt (uint8_t *p);
 static void btu_hcif_loopback_command_evt (void);
 static void btu_hcif_data_buf_overflow_evt (void);
 static void btu_hcif_max_slots_changed_evt (void);
-static void btu_hcif_read_clock_off_comp_evt (UINT8 *p);
+static void btu_hcif_read_clock_off_comp_evt (uint8_t *p);
 static void btu_hcif_conn_pkt_type_change_evt (void);
-static void btu_hcif_qos_violation_evt (UINT8 *p);
+static void btu_hcif_qos_violation_evt (uint8_t *p);
 static void btu_hcif_page_scan_mode_change_evt (void);
 static void btu_hcif_page_scan_rep_mode_chng_evt (void);
-static void btu_hcif_esco_connection_comp_evt(UINT8 *p);
-static void btu_hcif_esco_connection_chg_evt(UINT8 *p);
+static void btu_hcif_esco_connection_comp_evt(uint8_t *p);
+static void btu_hcif_esco_connection_chg_evt(uint8_t *p);
 
 /* Simple Pairing Events */
-static void btu_hcif_host_support_evt (UINT8 *p);
-static void btu_hcif_io_cap_request_evt (UINT8 *p);
-static void btu_hcif_io_cap_response_evt (UINT8 *p);
-static void btu_hcif_user_conf_request_evt (UINT8 *p);
-static void btu_hcif_user_passkey_request_evt (UINT8 *p);
-static void btu_hcif_user_passkey_notif_evt (UINT8 *p);
-static void btu_hcif_keypress_notif_evt (UINT8 *p);
-static void btu_hcif_rem_oob_request_evt (UINT8 *p);
+static void btu_hcif_host_support_evt (uint8_t *p);
+static void btu_hcif_io_cap_request_evt (uint8_t *p);
+static void btu_hcif_io_cap_response_evt (uint8_t *p);
+static void btu_hcif_user_conf_request_evt (uint8_t *p);
+static void btu_hcif_user_passkey_request_evt (uint8_t *p);
+static void btu_hcif_user_passkey_notif_evt (uint8_t *p);
+static void btu_hcif_keypress_notif_evt (uint8_t *p);
+static void btu_hcif_rem_oob_request_evt (uint8_t *p);
 
-static void btu_hcif_simple_pair_complete_evt (UINT8 *p);
-    #if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
+static void btu_hcif_simple_pair_complete_evt (uint8_t *p);
+    #if L2CAP_NON_FLUSHABLE_PB_INCLUDED == true
 static void btu_hcif_enhanced_flush_complete_evt (void);
     #endif
 
-    #if (BTM_SSR_INCLUDED == TRUE)
-static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len);
+    #if (BTM_SSR_INCLUDED == true)
+static void btu_hcif_ssr_evt (uint8_t *p, uint16_t evt_len);
     #endif /* BTM_SSR_INCLUDED == TRUE */
 
-    #if BLE_INCLUDED == TRUE
-static void btu_ble_ll_conn_complete_evt (UINT8 *p, UINT16 evt_len);
-static void btu_ble_process_adv_pkt (UINT8 *p);
-static void btu_ble_read_remote_feat_evt (UINT8 *p);
-static void btu_ble_ll_conn_param_upd_evt (UINT8 *p, UINT16 evt_len);
-static void btu_ble_proc_ltk_req (UINT8 *p);
-static void btu_hcif_encryption_key_refresh_cmpl_evt (UINT8 *p);
-static void btu_ble_data_length_change_evt (UINT8 *p, UINT16 evt_len);
+    #if BLE_INCLUDED == true
+static void btu_ble_ll_conn_complete_evt (uint8_t *p, uint16_t evt_len);
+static void btu_ble_process_adv_pkt (uint8_t *p);
+static void btu_ble_read_remote_feat_evt (uint8_t *p);
+static void btu_ble_ll_conn_param_upd_evt (uint8_t *p, uint16_t evt_len);
+static void btu_ble_proc_ltk_req (uint8_t *p);
+static void btu_hcif_encryption_key_refresh_cmpl_evt (uint8_t *p);
+static void btu_ble_data_length_change_evt (uint8_t *p, uint16_t evt_len);
 #if (BLE_LLT_INCLUDED == TRUE)
-static void btu_ble_rc_param_req_evt(UINT8 *p);
+static void btu_ble_rc_param_req_evt(uint8_t *p);
 #endif
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
-static void btu_ble_proc_enhanced_conn_cmpl (UINT8 *p, UINT16 evt_len);
+#if (BLE_PRIVACY_SPT == TRUE)
+static void btu_ble_proc_enhanced_conn_cmpl (uint8_t *p, uint16_t evt_len);
 #endif
 
     #endif
@@ -137,12 +137,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
+void btu_hcif_process_event (UNUSED_ATTR uint8_t controller_id, BT_HDR *p_msg)
 {
-    UINT8   *p = (UINT8 *)(p_msg + 1) + p_msg->offset;
-    UINT8   hci_evt_code, hci_evt_len;
-#if BLE_INCLUDED == TRUE
-    UINT8   ble_sub_code;
+    uint8_t *p = (uint8_t *)(p_msg + 1) + p_msg->offset;
+    uint8_t hci_evt_code, hci_evt_len;
+#if (BLE_INCLUDED == TRUE)
+    uint8_t ble_sub_code;
 #endif
     STREAM_TO_UINT8  (hci_evt_code, p);
     STREAM_TO_UINT8  (hci_evt_len, p);
@@ -179,7 +179,7 @@
         case HCI_ENCRYPTION_CHANGE_EVT:
             btu_hcif_encryption_change_evt (p);
             break;
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         case HCI_ENCRYPTION_KEY_REFRESH_COMP_EVT:
             btu_hcif_encryption_key_refresh_cmpl_evt(p);
             break;
@@ -290,7 +290,7 @@
         case HCI_KEYPRESS_NOTIFY_EVT:
             btu_hcif_keypress_notif_evt (p);
             break;
-#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
+#if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
         case HCI_ENHANCED_FLUSH_COMPLETE_EVT:
             btu_hcif_enhanced_flush_complete_evt ();
             break;
@@ -319,7 +319,7 @@
                 case HCI_BLE_LTK_REQ_EVT: /* received only at slave device */
                     btu_ble_proc_ltk_req(p);
                     break;
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
                 case HCI_BLE_ENHANCED_CONN_COMPLETE_EVT:
                     btu_ble_proc_enhanced_conn_cmpl(p, hci_evt_len);
                     break;
@@ -350,7 +350,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void btu_hcif_send_cmd (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_buf)
+void btu_hcif_send_cmd (UNUSED_ATTR uint8_t controller_id, BT_HDR *p_buf)
 {
     if (!p_buf)
       return;
@@ -364,7 +364,7 @@
     // Eww...horrible hackery here
     /* If command was a VSC, then extract command_complete callback */
     if ((opcode & HCI_GRP_VENDOR_SPECIFIC) == HCI_GRP_VENDOR_SPECIFIC
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         || (opcode == HCI_BLE_RAND)
         || (opcode == HCI_BLE_ENCRYPT)
 #endif
@@ -378,7 +378,7 @@
       btu_hcif_command_status_evt,
       vsc_callback);
 
-#if (defined(HCILP_INCLUDED) && HCILP_INCLUDED == TRUE)
+#if (HCILP_INCLUDED == TRUE)
     btu_check_bt_sleep ();
 #endif
 }
@@ -392,9 +392,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_inquiry_comp_evt (UINT8 *p)
+static void btu_hcif_inquiry_comp_evt (uint8_t *p)
 {
-    UINT8   status;
+    uint8_t status;
 
     STREAM_TO_UINT8    (status, p);
 
@@ -411,7 +411,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_inquiry_result_evt (UINT8 *p)
+static void btu_hcif_inquiry_result_evt (uint8_t *p)
 {
     /* Store results in the cache */
     btm_process_inq_results (p, BTM_INQ_RESULT_STANDARD);
@@ -426,7 +426,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_inquiry_rssi_result_evt (UINT8 *p)
+static void btu_hcif_inquiry_rssi_result_evt (uint8_t *p)
 {
     /* Store results in the cache */
     btm_process_inq_results (p, BTM_INQ_RESULT_WITH_RSSI);
@@ -441,7 +441,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_extended_inquiry_result_evt (UINT8 *p)
+static void btu_hcif_extended_inquiry_result_evt (uint8_t *p)
 {
     /* Store results in the cache */
     btm_process_inq_results (p, BTM_INQ_RESULT_EXTENDED);
@@ -456,14 +456,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_connection_comp_evt (UINT8 *p)
+static void btu_hcif_connection_comp_evt (uint8_t *p)
 {
-    UINT8       status;
-    UINT16      handle;
+    uint8_t     status;
+    uint16_t    handle;
     BD_ADDR     bda;
-    UINT8       link_type;
-    UINT8       enc_mode;
-#if BTM_SCO_INCLUDED == TRUE
+    uint8_t     link_type;
+    uint8_t     enc_mode;
+#if (BTM_SCO_INCLUDED == TRUE)
     tBTM_ESCO_DATA  esco_data;
 #endif
 
@@ -481,7 +481,7 @@
 
         l2c_link_hci_conn_comp (status, handle, bda);
     }
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
     else
     {
         memset(&esco_data, 0, sizeof(tBTM_ESCO_DATA));
@@ -501,11 +501,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_connection_request_evt (UINT8 *p)
+static void btu_hcif_connection_request_evt (uint8_t *p)
 {
     BD_ADDR     bda;
     DEV_CLASS   dc;
-    UINT8       link_type;
+    uint8_t     link_type;
 
     STREAM_TO_BDADDR   (bda, p);
     STREAM_TO_DEVCLASS (dc, p);
@@ -517,7 +517,7 @@
     {
         btm_sec_conn_req (bda, dc);
     }
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
     else
     {
         btm_sco_conn_req (bda, dc, link_type);
@@ -534,10 +534,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_disconnection_comp_evt (UINT8 *p)
+static void btu_hcif_disconnection_comp_evt (uint8_t *p)
 {
-    UINT16  handle;
-    UINT8   reason;
+    uint16_t handle;
+    uint8_t reason;
 
     ++p;
     STREAM_TO_UINT16 (handle, p);
@@ -545,7 +545,7 @@
 
     handle = HCID_GET_HANDLE (handle);
 
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
     /* If L2CAP doesn't know about it, send it to SCO */
     if (!l2c_link_hci_disc_comp (handle, reason))
         btm_sco_removed (handle, reason);
@@ -566,10 +566,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_authentication_comp_evt (UINT8 *p)
+static void btu_hcif_authentication_comp_evt (uint8_t *p)
 {
-    UINT8   status;
-    UINT16  handle;
+    uint8_t status;
+    uint16_t handle;
 
     STREAM_TO_UINT8  (status, p);
     STREAM_TO_UINT16 (handle, p);
@@ -586,9 +586,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_rmt_name_request_comp_evt (UINT8 *p, UINT16 evt_len)
+static void btu_hcif_rmt_name_request_comp_evt (uint8_t *p, uint16_t evt_len)
 {
-    UINT8   status;
+    uint8_t status;
     BD_ADDR bd_addr;
 
     STREAM_TO_UINT8 (status, p);
@@ -610,11 +610,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_encryption_change_evt (UINT8 *p)
+static void btu_hcif_encryption_change_evt (uint8_t *p)
 {
-    UINT8   status;
-    UINT16  handle;
-    UINT8   encr_enable;
+    uint8_t status;
+    uint16_t handle;
+    uint8_t encr_enable;
 
     STREAM_TO_UINT8  (status, p);
     STREAM_TO_UINT16 (handle, p);
@@ -633,7 +633,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_read_rmt_features_comp_evt (UINT8 *p)
+static void btu_hcif_read_rmt_features_comp_evt (uint8_t *p)
 {
     btm_read_remote_features_complete(p);
 }
@@ -647,11 +647,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_read_rmt_ext_features_comp_evt (UINT8 *p)
+static void btu_hcif_read_rmt_ext_features_comp_evt (uint8_t *p)
 {
-    UINT8 *p_cur = p;
-    UINT8 status;
-    UINT16 handle;
+    uint8_t *p_cur = p;
+    uint8_t status;
+    uint16_t handle;
 
     STREAM_TO_UINT8 (status, p_cur);
 
@@ -673,7 +673,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_read_rmt_version_comp_evt (UINT8 *p)
+static void btu_hcif_read_rmt_version_comp_evt (uint8_t *p)
 {
     btm_read_remote_version_complete (p);
 }
@@ -687,10 +687,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_qos_setup_comp_evt (UINT8 *p)
+static void btu_hcif_qos_setup_comp_evt (uint8_t *p)
 {
-    UINT8 status;
-    UINT16 handle;
+    uint8_t status;
+    uint16_t handle;
     FLOW_SPEC flow;
 
     STREAM_TO_UINT8 (status, p);
@@ -714,13 +714,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_esco_connection_comp_evt (UINT8 *p)
+static void btu_hcif_esco_connection_comp_evt (uint8_t *p)
 {
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
     tBTM_ESCO_DATA  data;
-    UINT16          handle;
+    uint16_t        handle;
     BD_ADDR         bda;
-    UINT8           status;
+    uint8_t         status;
 
     STREAM_TO_UINT8 (status, p);
     STREAM_TO_UINT16 (handle, p);
@@ -747,15 +747,15 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_esco_connection_chg_evt (UINT8 *p)
+static void btu_hcif_esco_connection_chg_evt (uint8_t *p)
 {
-#if BTM_SCO_INCLUDED == TRUE
-    UINT16  handle;
-    UINT16  tx_pkt_len;
-    UINT16  rx_pkt_len;
-    UINT8   status;
-    UINT8   tx_interval;
-    UINT8   retrans_window;
+#if (BTM_SCO_INCLUDED == TRUE)
+    uint16_t handle;
+    uint16_t tx_pkt_len;
+    uint16_t rx_pkt_len;
+    uint8_t status;
+    uint8_t tx_interval;
+    uint8_t retrans_window;
 
     STREAM_TO_UINT8 (status, p);
     STREAM_TO_UINT16 (handle, p);
@@ -779,7 +779,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_len,
+static void btu_hcif_hdl_command_complete (uint16_t opcode, uint8_t *p, uint16_t evt_len,
                                            void *p_cplt_cback)
 {
     switch (opcode)
@@ -809,7 +809,7 @@
             break;
 
         case HCI_READ_TRANSMIT_POWER_LEVEL:
-            btm_read_tx_power_complete(p, FALSE);
+            btm_read_tx_power_complete(p, false);
             break;
 
         case HCI_CREATE_CONNECTION_CANCEL:
@@ -844,7 +844,7 @@
             break;
 
         case HCI_BLE_READ_ADV_CHNL_TX_POWER:
-            btm_read_tx_power_complete(p, TRUE);
+            btm_read_tx_power_complete(p, true);
             break;
 
         case HCI_BLE_WRITE_ADV_ENABLE:
@@ -861,7 +861,7 @@
             btm_ble_test_command_complete(p);
             break;
 
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
+#if (BLE_PRIVACY_SPT == TRUE)
         case HCI_BLE_ADD_DEV_RESOLVING_LIST:
             btm_ble_add_resolving_list_entry_complete(p, evt_len);
             break;
@@ -942,12 +942,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_cmd,
+static void btu_hcif_hdl_command_status (uint16_t opcode, uint8_t status, uint8_t *p_cmd,
                                          void *p_vsc_status_cback)
 {
     BD_ADDR         bd_addr;
-    UINT16          handle;
-#if BTM_SCO_INCLUDED == TRUE
+    uint16_t        handle;
+#if (BTM_SCO_INCLUDED == TRUE)
     tBTM_ESCO_DATA  esco_data;
 #endif
 
@@ -955,7 +955,7 @@
     {
         case HCI_EXIT_SNIFF_MODE:
         case HCI_EXIT_PARK_MODE:
-#if BTM_SCO_WAKE_PARKED_LINK == TRUE
+#if (BTM_SCO_WAKE_PARKED_LINK == TRUE)
             if (status != HCI_SUCCESS)
             {
                 /* Allow SCO initiation to continue if waiting for change mode event */
@@ -1042,16 +1042,16 @@
 
                     case HCI_SET_CONN_ENCRYPTION:
                         /* Device refused to start encryption.  That should be treated as encryption failure. */
-                        btm_sec_encrypt_change (BTM_INVALID_HCI_HANDLE, status, FALSE);
+                        btm_sec_encrypt_change (BTM_INVALID_HCI_HANDLE, status, false);
                         break;
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
                     case HCI_BLE_CREATE_LL_CONN:
                         btm_ble_create_ll_conn_complete(status);
                         break;
 #endif
 
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
                     case HCI_SETUP_ESCO_CONNECTION:
                         /* read handle out of stored command */
                         if (p_cmd != NULL)
@@ -1069,7 +1069,7 @@
 #endif
 
 /* This is commented out until an upper layer cares about returning event
-#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
+#if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
             case HCI_ENHANCED_FLUSH:
                 break;
 #endif
@@ -1140,7 +1140,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_hardware_error_evt (UINT8 *p)
+static void btu_hcif_hardware_error_evt (uint8_t *p)
 {
     HCI_TRACE_ERROR("Ctlr H/w error event - code:0x%x", *p);
 
@@ -1174,11 +1174,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_role_change_evt (UINT8 *p)
+static void btu_hcif_role_change_evt (uint8_t *p)
 {
-    UINT8       status;
+    uint8_t     status;
     BD_ADDR     bda;
-    UINT8       role;
+    uint8_t     role;
 
     STREAM_TO_UINT8 (status, p);
     STREAM_TO_BDADDR (bda, p);
@@ -1197,7 +1197,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_num_compl_data_pkts_evt (UINT8 *p)
+static void btu_hcif_num_compl_data_pkts_evt (uint8_t *p)
 {
     /* Process for L2CAP and SCO */
     l2c_link_process_num_completed_pkts (p);
@@ -1215,24 +1215,24 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_mode_change_evt (UINT8 *p)
+static void btu_hcif_mode_change_evt (uint8_t *p)
 {
-    UINT8       status;
-    UINT16      handle;
-    UINT8       current_mode;
-    UINT16      interval;
+    uint8_t     status;
+    uint16_t    handle;
+    uint8_t     current_mode;
+    uint16_t    interval;
 
     STREAM_TO_UINT8 (status, p);
 
     STREAM_TO_UINT16 (handle, p);
     STREAM_TO_UINT8 (current_mode, p);
     STREAM_TO_UINT16 (interval, p);
-#if BTM_SCO_WAKE_PARKED_LINK == TRUE
+#if (BTM_SCO_WAKE_PARKED_LINK == TRUE)
     btm_sco_chk_pend_unpark (status, handle);
 #endif
     btm_pm_proc_mode_change (status, handle, current_mode, interval);
 
-#if (HID_DEV_INCLUDED == TRUE) && (HID_DEV_PM_INCLUDED == TRUE)
+#if (HID_DEV_INCLUDED == TRUE && HID_DEV_PM_INCLUDED == TRUE)
     hidd_pm_proc_mode_change( status, current_mode, interval ) ;
 #endif
 }
@@ -1246,8 +1246,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-    #if (BTM_SSR_INCLUDED == TRUE)
-static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len)
+    #if (BTM_SSR_INCLUDED == true)
+static void btu_hcif_ssr_evt (uint8_t *p, uint16_t evt_len)
 {
     btm_pm_proc_ssr_evt(p, evt_len);
 }
@@ -1262,7 +1262,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_pin_code_request_evt (UINT8 *p)
+static void btu_hcif_pin_code_request_evt (uint8_t *p)
 {
     BD_ADDR  bda;
 
@@ -1284,7 +1284,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_link_key_request_evt (UINT8 *p)
+static void btu_hcif_link_key_request_evt (uint8_t *p)
 {
     BD_ADDR  bda;
 
@@ -1301,11 +1301,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_link_key_notification_evt (UINT8 *p)
+static void btu_hcif_link_key_notification_evt (uint8_t *p)
 {
     BD_ADDR  bda;
     LINK_KEY key;
-    UINT8    key_type;
+    uint8_t  key_type;
 
     STREAM_TO_BDADDR (bda, p);
     STREAM_TO_ARRAY16 (key, p);
@@ -1362,11 +1362,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_read_clock_off_comp_evt (UINT8 *p)
+static void btu_hcif_read_clock_off_comp_evt (uint8_t *p)
 {
-    UINT8       status;
-    UINT16      handle;
-    UINT16      clock_offset;
+    uint8_t     status;
+    uint16_t    handle;
+    uint16_t    clock_offset;
 
     STREAM_TO_UINT8  (status, p);
 
@@ -1405,9 +1405,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_qos_violation_evt (UINT8 *p)
+static void btu_hcif_qos_violation_evt (uint8_t *p)
 {
-    UINT16   handle;
+    uint16_t handle;
 
     STREAM_TO_UINT16 (handle, p);
 
@@ -1455,7 +1455,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_host_support_evt (UINT8 *p)
+static void btu_hcif_host_support_evt (uint8_t *p)
 {
     btm_sec_rmt_host_support_feat_evt(p);
 }
@@ -1469,7 +1469,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_io_cap_request_evt (UINT8 *p)
+static void btu_hcif_io_cap_request_evt (uint8_t *p)
 {
     btm_io_capabilities_req(p);
 }
@@ -1483,7 +1483,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_io_cap_response_evt (UINT8 *p)
+static void btu_hcif_io_cap_response_evt (uint8_t *p)
 {
     btm_io_capabilities_rsp(p);
 }
@@ -1497,7 +1497,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_user_conf_request_evt (UINT8 *p)
+static void btu_hcif_user_conf_request_evt (uint8_t *p)
 {
     btm_proc_sp_req_evt(BTM_SP_CFM_REQ_EVT, p);
 }
@@ -1511,7 +1511,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_user_passkey_request_evt (UINT8 *p)
+static void btu_hcif_user_passkey_request_evt (uint8_t *p)
 {
     btm_proc_sp_req_evt(BTM_SP_KEY_REQ_EVT, p);
 }
@@ -1525,7 +1525,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_user_passkey_notif_evt (UINT8 *p)
+static void btu_hcif_user_passkey_notif_evt (uint8_t *p)
 {
     btm_proc_sp_req_evt(BTM_SP_KEY_NOTIF_EVT, p);
 }
@@ -1539,7 +1539,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_keypress_notif_evt (UINT8 *p)
+static void btu_hcif_keypress_notif_evt (uint8_t *p)
 {
     btm_keypress_notif_evt(p);
 }
@@ -1553,7 +1553,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_rem_oob_request_evt (UINT8 *p)
+static void btu_hcif_rem_oob_request_evt (uint8_t *p)
 {
     btm_rem_oob_req(p);
 }
@@ -1567,7 +1567,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void btu_hcif_simple_pair_complete_evt (UINT8 *p)
+static void btu_hcif_simple_pair_complete_evt (uint8_t *p)
 {
     btm_simple_pair_complete(p);
 }
@@ -1581,7 +1581,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
+#if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
 static void btu_hcif_enhanced_flush_complete_evt (void)
 {
 /* This is empty until an upper layer cares about returning event */
@@ -1594,12 +1594,12 @@
 /**********************************************
 ** BLE Events
 ***********************************************/
-#if (defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE)
-static void btu_hcif_encryption_key_refresh_cmpl_evt (UINT8 *p)
+#if (BLE_INCLUDED == TRUE)
+static void btu_hcif_encryption_key_refresh_cmpl_evt (uint8_t *p)
 {
-    UINT8   status;
-    UINT8   enc_enable = 0;
-    UINT16  handle;
+    uint8_t status;
+    uint8_t enc_enable = 0;
+    uint16_t handle;
 
     STREAM_TO_UINT8  (status, p);
     STREAM_TO_UINT16 (handle, p);
@@ -1609,33 +1609,33 @@
     btm_sec_encrypt_change (handle, status, enc_enable);
 }
 
-static void btu_ble_process_adv_pkt (UINT8 *p)
+static void btu_ble_process_adv_pkt (uint8_t *p)
 {
     HCI_TRACE_EVENT("btu_ble_process_adv_pkt");
 
     btm_ble_process_adv_pkt(p);
 }
 
-static void btu_ble_ll_conn_complete_evt ( UINT8 *p, UINT16 evt_len)
+static void btu_ble_ll_conn_complete_evt ( uint8_t *p, uint16_t evt_len)
 {
-    btm_ble_conn_complete(p, evt_len, FALSE);
+    btm_ble_conn_complete(p, evt_len, false);
 }
-#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
-static void btu_ble_proc_enhanced_conn_cmpl( UINT8 *p, UINT16 evt_len)
+#if (BLE_PRIVACY_SPT == TRUE)
+static void btu_ble_proc_enhanced_conn_cmpl( uint8_t *p, uint16_t evt_len)
 {
-    btm_ble_conn_complete(p, evt_len, TRUE);
+    btm_ble_conn_complete(p, evt_len, true);
 }
 #endif
-static void btu_ble_ll_conn_param_upd_evt (UINT8 *p, UINT16 evt_len)
+static void btu_ble_ll_conn_param_upd_evt (uint8_t *p, uint16_t evt_len)
 {
     /* LE connection update has completed successfully as a master. */
     /* We can enable the update request if the result is a success. */
     /* extract the HCI handle first */
-    UINT8   status;
-    UINT16  handle;
-    UINT16  interval;
-    UINT16  latency;
-    UINT16  timeout;
+    uint8_t status;
+    uint16_t handle;
+    uint16_t interval;
+    uint16_t latency;
+    uint16_t timeout;
 
     STREAM_TO_UINT8(status, p);
     STREAM_TO_UINT16(handle, p);
@@ -1646,34 +1646,34 @@
     l2cble_process_conn_update_evt(handle, status, interval, latency, timeout);
 }
 
-static void btu_ble_read_remote_feat_evt (UINT8 *p)
+static void btu_ble_read_remote_feat_evt (uint8_t *p)
 {
     btm_ble_read_remote_features_complete(p);
 }
 
-static void btu_ble_proc_ltk_req (UINT8 *p)
+static void btu_ble_proc_ltk_req (uint8_t *p)
 {
-    UINT16 ediv, handle;
-    UINT8   *pp;
+    uint16_t ediv, handle;
+    uint8_t *pp;
 
     STREAM_TO_UINT16(handle, p);
     pp = p + 8;
     STREAM_TO_UINT16(ediv, pp);
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
     btm_ble_ltk_request(handle, p, ediv);
 #endif
     /* This is empty until an upper layer cares about returning event */
 }
 
-static void btu_ble_data_length_change_evt(UINT8 *p, UINT16 evt_len)
+static void btu_ble_data_length_change_evt(uint8_t *p, uint16_t evt_len)
 {
-    UINT16 handle;
-    UINT16 tx_data_len;
-    UINT16 rx_data_len;
+    uint16_t handle;
+    uint16_t tx_data_len;
+    uint16_t rx_data_len;
 
     if (!controller_get_interface()->supports_ble_packet_extension())
     {
-        HCI_TRACE_WARNING("%s, request not supported", __FUNCTION__);
+        HCI_TRACE_WARNING("%s, request not supported", __func__);
         return;
     }
 
@@ -1688,11 +1688,11 @@
 /**********************************************
 ** End of BLE Events Handler
 ***********************************************/
-#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
-static void btu_ble_rc_param_req_evt(UINT8 *p)
+#if (BLE_LLT_INCLUDED == TRUE)
+static void btu_ble_rc_param_req_evt(uint8_t *p)
 {
-    UINT16 handle;
-    UINT16  int_min, int_max, latency, timeout;
+    uint16_t handle;
+    uint16_t int_min, int_max, latency, timeout;
 
     STREAM_TO_UINT16(handle, p);
     STREAM_TO_UINT16(int_min, p);
diff --git a/stack/btu/btu_init.c b/stack/btu/btu_init.c
index cbddd51..7692a39 100644
--- a/stack/btu/btu_init.c
+++ b/stack/btu/btu_init.c
@@ -37,7 +37,7 @@
 #if (BLE_INCLUDED == TRUE)
 #include "gatt_api.h"
 #include "gatt_int.h"
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
 #include "smp_int.h"
 #endif
 #endif
@@ -60,7 +60,7 @@
 thread_t *bt_workqueue_thread;
 static const char *BT_WORKQUEUE_NAME = "bt_workqueue";
 
-extern void PLATFORM_DisableHciTransport(UINT8 bDisable);
+extern void PLATFORM_DisableHciTransport(uint8_t bDisable);
 /*****************************************************************************
 **                          V A R I A B L E S                                *
 ******************************************************************************/
@@ -89,9 +89,9 @@
 
     sdp_init();
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     gatt_init();
-#if (defined(SMP_INCLUDED) && SMP_INCLUDED == TRUE)
+#if (SMP_INCLUDED == TRUE)
     SMP_Init();
 #endif
     btm_ble_init();
@@ -113,7 +113,7 @@
       /* Free the mandatory core stack components */
       l2c_free();
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
       gatt_free();
 #endif
 }
diff --git a/stack/btu/btu_task.c b/stack/btu/btu_task.c
index 8a6db35..cdbf735 100644
--- a/stack/btu/btu_task.c
+++ b/stack/btu/btu_task.c
@@ -47,25 +47,25 @@
 #include "port_ext.h"
 #include "sdpint.h"
 
-#if (defined(BNEP_INCLUDED) && BNEP_INCLUDED == TRUE)
+#if (BNEP_INCLUDED == TRUE)
 #include "bnep_int.h"
 #endif
 
-#if (defined(PAN_INCLUDED) && PAN_INCLUDED == TRUE)
+#if (PAN_INCLUDED == TRUE)
 #include "pan_int.h"
 #endif
 
-#if (defined(HID_HOST_INCLUDED) && HID_HOST_INCLUDED == TRUE )
+#if (HID_HOST_INCLUDED == TRUE)
 #include "hidh_int.h"
 #endif
 
-#if (defined(AVDT_INCLUDED) && AVDT_INCLUDED == TRUE)
+#if (AVDT_INCLUDED == TRUE)
 #include "avdt_int.h"
 #else
 extern void avdt_rcv_sync_info (BT_HDR *p_buf); /* this is for hci_test */
 #endif
 
-#if (defined(MCA_INCLUDED) && MCA_INCLUDED == TRUE)
+#if (MCA_INCLUDED == TRUE)
 #include "mca_api.h"
 #include "mca_defs.h"
 #include "mca_int.h"
@@ -119,7 +119,7 @@
     {
         case BTU_POST_TO_TASK_NO_GOOD_HORRIBLE_HACK: // TODO(zachoverflow): remove this
             ((post_to_task_hack_t *)(&p_msg->data[0]))->callback(p_msg);
-#if (defined(HCILP_INCLUDED) && HCILP_INCLUDED == TRUE)
+#if (HCILP_INCLUDED == TRUE)
             /* If the host receives events which it doesn't responsd to, */
             /* it should start an idle timer to enter sleep mode.        */
             btu_check_bt_sleep ();
@@ -136,16 +136,16 @@
             break;
 
         case BT_EVT_TO_BTU_HCI_SCO:
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
             btm_route_sco_data (p_msg);
             break;
 #endif
 
         case BT_EVT_TO_BTU_HCI_EVT:
-            btu_hcif_process_event ((UINT8)(p_msg->event & BT_SUB_EVT_MASK), p_msg);
+            btu_hcif_process_event ((uint8_t)(p_msg->event & BT_SUB_EVT_MASK), p_msg);
             osi_free(p_msg);
 
-#if (defined(HCILP_INCLUDED) && HCILP_INCLUDED == TRUE)
+#if (HCILP_INCLUDED == TRUE)
             /* If host receives events which it doesn't response to, */
             /* host should start idle timer to enter sleep mode.     */
             btu_check_bt_sleep ();
@@ -153,7 +153,7 @@
             break;
 
         case BT_EVT_TO_BTU_HCI_CMD:
-            btu_hcif_send_cmd ((UINT8)(p_msg->event & BT_SUB_EVT_MASK), p_msg);
+            btu_hcif_send_cmd ((uint8_t)(p_msg->event & BT_SUB_EVT_MASK), p_msg);
             break;
 
         default:
@@ -184,7 +184,7 @@
   /* Initialise platform trace levels at this point as BTE_InitStack() and bta_sys_init()
    * reset the control blocks and preset the trace level with XXX_INITIAL_TRACE_LEVEL
    */
-#if ( BT_USE_TRACES==TRUE )
+#if (BT_USE_TRACES == TRUE)
   module_init(get_module(BTE_LOGMSG_MODULE));
 #endif
 
@@ -209,7 +209,7 @@
   fixed_queue_unregister_dequeue(btu_hci_msg_queue);
   alarm_unregister_processing_queue(btu_general_alarm_queue);
 
-#if ( BT_USE_TRACES==TRUE )
+#if (BT_USE_TRACES == TRUE)
   module_clean_up(get_module(BTE_LOGMSG_MODULE));
 #endif
 
@@ -217,7 +217,7 @@
   btu_free_core();
 }
 
-#if (defined(HCILP_INCLUDED) && HCILP_INCLUDED == TRUE)
+#if (HCILP_INCLUDED == TRUE)
 /*******************************************************************************
 **
 ** Function         btu_check_bt_sleep
diff --git a/stack/gap/gap_api.c b/stack/gap/gap_api.c
index 5518efd..aaa1ae6 100644
--- a/stack/gap/gap_api.c
+++ b/stack/gap/gap_api.c
@@ -34,7 +34,7 @@
 ** Returns          The new or current trace level
 **
 *******************************************************************************/
-UINT8 GAP_SetTraceLevel (UINT8 new_level)
+uint8_t GAP_SetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         gap_cb.trace_level = new_level;
@@ -64,11 +64,11 @@
     gap_cb.trace_level = BT_TRACE_LEVEL_NONE;    /* No traces */
 #endif
 
-#if GAP_CONN_INCLUDED == TRUE
+#if (GAP_CONN_INCLUDED == TRUE)
     gap_conn_init();
 #endif
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     gap_attr_db_init();
 #endif
 }
diff --git a/stack/gap/gap_ble.c b/stack/gap/gap_ble.c
index 5dc6f2d..a17cf48 100644
--- a/stack/gap/gap_ble.c
+++ b/stack/gap/gap_ble.c
@@ -17,7 +17,7 @@
  ******************************************************************************/
 #include "bt_target.h"
 
-#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
+#if (BLE_INCLUDED == TRUE)
 
 #include "bt_utils.h"
 #include <string.h>
@@ -41,12 +41,12 @@
 #define GAP_ATTR_DB_SIZE      GATT_DB_MEM_SIZE(GAP_MAX_NUM_INC_SVR, GAP_MAX_CHAR_NUM, GAP_MAX_CHAR_VALUE_SIZE)
 #endif
 
-static void gap_ble_s_attr_request_cback (UINT16 conn_id, UINT32 trans_id, tGATTS_REQ_TYPE op_code, tGATTS_DATA *p_data);
+static void gap_ble_s_attr_request_cback (uint16_t conn_id, uint32_t trans_id, tGATTS_REQ_TYPE op_code, tGATTS_DATA *p_data);
 
 /* client connection callback */
-static void  gap_ble_c_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id, BOOLEAN connected,
+static void  gap_ble_c_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, uint16_t conn_id, bool    connected,
                                             tGATT_DISCONN_REASON reason, tGATT_TRANSPORT transport);
-static void  gap_ble_c_cmpl_cback (UINT16 conn_id, tGATTC_OPTYPE op, tGATT_STATUS status, tGATT_CL_COMPLETE *p_data);
+static void  gap_ble_c_cmpl_cback (uint16_t conn_id, tGATTC_OPTYPE op, tGATT_STATUS status, tGATT_CL_COMPLETE *p_data);
 
 static tGATT_CBACK gap_cback =
 {
@@ -72,7 +72,7 @@
 *******************************************************************************/
 tGAP_CLCB *gap_find_clcb_by_bd_addr(BD_ADDR bda)
 {
-    UINT8 i_clcb;
+    uint8_t i_clcb;
     tGAP_CLCB    *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= gap_cb.clcb; i_clcb < GAP_MAX_CL; i_clcb++, p_clcb++)
@@ -95,9 +95,9 @@
 ** Returns          total number of clcb found.
 **
 *******************************************************************************/
-tGAP_CLCB *gap_ble_find_clcb_by_conn_id(UINT16 conn_id)
+tGAP_CLCB *gap_ble_find_clcb_by_conn_id(uint16_t conn_id)
 {
-    UINT8 i_clcb;
+    uint8_t i_clcb;
     tGAP_CLCB    *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= gap_cb.clcb; i_clcb < GAP_MAX_CL; i_clcb++, p_clcb++)
@@ -122,7 +122,7 @@
 *******************************************************************************/
 tGAP_CLCB *gap_clcb_alloc (BD_ADDR bda)
 {
-    UINT8         i_clcb = 0;
+    uint8_t       i_clcb = 0;
     tGAP_CLCB    *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= gap_cb.clcb; i_clcb < GAP_MAX_CL; i_clcb++, p_clcb++)
@@ -131,7 +131,7 @@
         {
             fixed_queue_free(p_clcb->pending_req_q, NULL);
             memset(p_clcb, 0, sizeof(tGAP_CLCB));
-            p_clcb->in_use = TRUE;
+            p_clcb->in_use = true;
             memcpy (p_clcb->bda, bda, BD_ADDR_LEN);
             p_clcb->pending_req_q = fixed_queue_new(SIZE_MAX);
             break;
@@ -157,7 +157,7 @@
     {
          /* send callback to all pending requests if being removed*/
          if (p_q->p_cback != NULL)
-            (*p_q->p_cback)(FALSE, p_clcb->bda, 0, NULL);
+            (*p_q->p_cback)(false, p_clcb->bda, 0, NULL);
 
          osi_free(p_q);
     }
@@ -172,10 +172,10 @@
 **
 ** Description      The function enqueue a GAP client request
 **
-** Returns           TRUE is successul; FALSE otherwise
+** Returns           true is successul; false otherwise
 **
 *******************************************************************************/
-BOOLEAN gap_ble_enqueue_request (tGAP_CLCB *p_clcb, UINT16 uuid, tGAP_BLE_CMPL_CBACK *p_cback)
+bool    gap_ble_enqueue_request (tGAP_CLCB *p_clcb, uint16_t uuid, tGAP_BLE_CMPL_CBACK *p_cback)
 {
     tGAP_BLE_REQ *p_q = (tGAP_BLE_REQ *)osi_malloc(sizeof(tGAP_BLE_REQ));
 
@@ -183,7 +183,7 @@
     p_q->uuid = uuid;
     fixed_queue_enqueue(p_clcb->pending_req_q, p_q);
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -192,10 +192,10 @@
 **
 ** Description      The function dequeue a GAP client request if any
 **
-** Returns           TRUE is successul; FALSE otherwise
+** Returns           true is successul; false otherwise
 **
 *******************************************************************************/
-BOOLEAN gap_ble_dequeue_request (tGAP_CLCB *p_clcb, UINT16 * p_uuid, tGAP_BLE_CMPL_CBACK **p_cback)
+bool    gap_ble_dequeue_request (tGAP_CLCB *p_clcb, uint16_t * p_uuid, tGAP_BLE_CMPL_CBACK **p_cback)
 {
     tGAP_BLE_REQ *p_q = (tGAP_BLE_REQ *)fixed_queue_try_dequeue(p_clcb->pending_req_q);;
 
@@ -204,28 +204,28 @@
         *p_cback    = p_q->p_cback;
         *p_uuid     = p_q->uuid;
         osi_free(p_q);
-        return TRUE;
+        return true;
     }
 
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
 **   GAP Attributes Database Request callback
 *******************************************************************************/
-tGATT_STATUS gap_read_attr_value (UINT16 handle, tGATT_VALUE *p_value, BOOLEAN is_long)
+tGATT_STATUS gap_read_attr_value (uint16_t handle, tGATT_VALUE *p_value, bool    is_long)
 {
     tGAP_ATTR   *p_db_attr = gap_cb.gatt_attr;
-    UINT8       *p = p_value->value, i;
-    UINT16      offset = p_value->offset;
-    UINT8       *p_dev_name = NULL;
+    uint8_t     *p = p_value->value, i;
+    uint16_t    offset = p_value->offset;
+    uint8_t     *p_dev_name = NULL;
 
     for (i = 0; i < GAP_MAX_CHAR_NUM; i ++, p_db_attr ++)
     {
         if (handle == p_db_attr->handle)
         {
             if (p_db_attr->uuid != GATT_UUID_GAP_DEVICE_NAME &&
-                is_long == TRUE)
+                is_long == true)
                 return GATT_NOT_LONG;
 
             switch (p_db_attr->uuid)
@@ -235,7 +235,7 @@
                     if (strlen ((char *)p_dev_name) > GATT_MAX_ATTR_LEN)
                         p_value->len = GATT_MAX_ATTR_LEN;
                     else
-                        p_value->len = (UINT16)strlen ((char *)p_dev_name);
+                        p_value->len = (uint16_t)strlen ((char *)p_dev_name);
 
                     if (offset > p_value->len)
                         return GATT_INVALID_OFFSET;
@@ -300,10 +300,10 @@
 ** Returns          void.
 **
 *******************************************************************************/
-UINT8 gap_proc_write_req( tGATTS_REQ_TYPE type, tGATT_WRITE_REQ *p_data)
+uint8_t gap_proc_write_req( tGATTS_REQ_TYPE type, tGATT_WRITE_REQ *p_data)
 {
     tGAP_ATTR   *p_db_attr = gap_cb.gatt_attr;
-    UINT8   i;
+    uint8_t i;
     UNUSED(type);
 
     for (i = 0; i < GAP_MAX_CHAR_NUM; i ++, p_db_attr ++)
@@ -326,12 +326,12 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void gap_ble_s_attr_request_cback (UINT16 conn_id, UINT32 trans_id,
+void gap_ble_s_attr_request_cback (uint16_t conn_id, uint32_t trans_id,
                                    tGATTS_REQ_TYPE type, tGATTS_DATA *p_data)
 {
-    UINT8       status = GATT_INVALID_PDU;
+    uint8_t     status = GATT_INVALID_PDU;
     tGATTS_RSP  rsp_msg;
-    BOOLEAN     ignore = FALSE;
+    bool        ignore = false;
 
     GAP_TRACE_EVENT("gap_ble_s_attr_request_cback : recv type (0x%02x)", type);
 
@@ -347,19 +347,19 @@
         case GATTS_REQ_TYPE_WRITE_CHARACTERISTIC:
         case GATTS_REQ_TYPE_WRITE_DESCRIPTOR:
             if (!p_data->write_req.need_rsp)
-                ignore = TRUE;
+                ignore = true;
 
             status = gap_proc_write_req(type, &p_data->write_req);
             break;
 
         case GATTS_REQ_TYPE_WRITE_EXEC:
-            ignore = TRUE;
+            ignore = true;
             GAP_TRACE_EVENT("Ignore GATTS_REQ_TYPE_WRITE_EXEC"  );
             break;
 
         case GATTS_REQ_TYPE_MTU:
             GAP_TRACE_EVENT("Get MTU exchange new mtu size: %d", p_data->mtu);
-            ignore = TRUE;
+            ignore = true;
             break;
 
         default:
@@ -383,7 +383,7 @@
 void gap_attr_db_init(void)
 {
     tBT_UUID        app_uuid = {LEN_UUID_128,{0}};
-    UINT16          service_handle;
+    uint16_t        service_handle;
 
     /* Fill our internal UUID with a fixed pattern 0x82 */
     memset (&app_uuid.uu.uuid128, 0x82, LEN_UUID_128);
@@ -405,7 +405,7 @@
         {.type = BTGATT_DB_CHARACTERISTIC, .uuid = name_uuid, .properties = GATT_CHAR_PROP_BIT_READ, .permissions = GATT_PERM_READ},
         {.type = BTGATT_DB_CHARACTERISTIC, .uuid = icon_uuid, .properties = GATT_CHAR_PROP_BIT_READ, .permissions = GATT_PERM_READ},
         {.type = BTGATT_DB_CHARACTERISTIC, .uuid = addr_res_uuid, .properties = GATT_CHAR_PROP_BIT_READ, .permissions = GATT_PERM_READ}
-#if BTM_PERIPHERAL_ENABLED == TRUE       /* Only needed for peripheral testing */
+#if (BTM_PERIPHERAL_ENABLED == TRUE)       /* Only needed for peripheral testing */
         ,{.type = BTGATT_DB_CHARACTERISTIC, .uuid = pref_uuid, .properties = GATT_CHAR_PROP_BIT_READ, .permissions = GATT_PERM_READ}
 #endif
     };
@@ -426,7 +426,7 @@
     gap_cb.gatt_attr[2].handle = service[3].attribute_handle;
     gap_cb.gatt_attr[2].attr_value.addr_resolution = 0;
 
-#if BTM_PERIPHERAL_ENABLED == TRUE      /*  Only needed for peripheral testing */
+#if (BTM_PERIPHERAL_ENABLED == TRUE)     /*  Only needed for peripheral testing */
 
     gap_cb.gatt_attr[3].uuid = GATT_UUID_GAP_PREF_CONN_PARAM;
     gap_cb.gatt_attr[3].attr_value.conn_param.int_max = GAP_PREFER_CONN_INT_MAX; /* 6 */
@@ -446,10 +446,10 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void GAP_BleAttrDBUpdate(UINT16 attr_uuid, tGAP_BLE_ATTR_VALUE *p_value)
+void GAP_BleAttrDBUpdate(uint16_t attr_uuid, tGAP_BLE_ATTR_VALUE *p_value)
 {
     tGAP_ATTR  *p_db_attr = gap_cb.gatt_attr;
-    UINT8       i = 0;
+    uint8_t     i = 0;
 
     GAP_TRACE_EVENT("GAP_BleAttrDBUpdate attr_uuid=0x%04x", attr_uuid);
 
@@ -492,14 +492,14 @@
 **
 ** Description      utility function to send a read request for a GAP charactersitic
 **
-** Returns          TRUE if read started, else FALSE if GAP is busy
+** Returns          true if read started, else false if GAP is busy
 **
 *******************************************************************************/
-BOOLEAN gap_ble_send_cl_read_request(tGAP_CLCB *p_clcb)
+bool    gap_ble_send_cl_read_request(tGAP_CLCB *p_clcb)
 {
     tGATT_READ_PARAM        param;
-    UINT16                  uuid = 0;
-    BOOLEAN                 started = FALSE;
+    uint16_t                uuid = 0;
+    bool                    started = false;
 
     if (gap_ble_dequeue_request(p_clcb, &uuid, &p_clcb->p_cback))
     {
@@ -514,7 +514,7 @@
         if (GATTC_Read(p_clcb->conn_id, GATT_READ_BY_TYPE, &param) == GATT_SUCCESS)
         {
             p_clcb->cl_op_uuid = uuid;
-            started = TRUE;
+            started = true;
         }
     }
 
@@ -530,10 +530,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gap_ble_cl_op_cmpl(tGAP_CLCB *p_clcb, BOOLEAN status, UINT16 len, UINT8 *p_name)
+void gap_ble_cl_op_cmpl(tGAP_CLCB *p_clcb, bool    status, uint16_t len, uint8_t *p_name)
 {
     tGAP_BLE_CMPL_CBACK *p_cback = p_clcb->p_cback;
-    UINT16                  op = p_clcb->cl_op_uuid;
+    uint16_t                op = p_clcb->cl_op_uuid;
 
     GAP_TRACE_EVENT("gap_ble_cl_op_cmpl status: %d", status);
 
@@ -566,8 +566,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gap_ble_c_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
-                                     BOOLEAN connected, tGATT_DISCONN_REASON reason,
+static void gap_ble_c_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, uint16_t conn_id,
+                                     bool    connected, tGATT_DISCONN_REASON reason,
                                      tGATT_TRANSPORT transport)
 {
     tGAP_CLCB   *p_clcb = gap_find_clcb_by_bd_addr (bda);
@@ -580,14 +580,14 @@
         if (connected)
         {
             p_clcb->conn_id = conn_id;
-            p_clcb->connected = TRUE;
+            p_clcb->connected = true;
             /* start operation is pending */
             gap_ble_send_cl_read_request(p_clcb);
         }
         else
         {
-            p_clcb->connected = FALSE;
-            gap_ble_cl_op_cmpl(p_clcb, FALSE, 0, NULL);
+            p_clcb->connected = false;
+            gap_ble_cl_op_cmpl(p_clcb, false, 0, NULL);
             /* clean up clcb */
             gap_ble_dealloc_clcb(p_clcb);
         }
@@ -603,14 +603,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gap_ble_c_cmpl_cback (UINT16 conn_id, tGATTC_OPTYPE op, tGATT_STATUS status, tGATT_CL_COMPLETE *p_data)
+static void gap_ble_c_cmpl_cback (uint16_t conn_id, tGATTC_OPTYPE op, tGATT_STATUS status, tGATT_CL_COMPLETE *p_data)
 
 {
     tGAP_CLCB   *p_clcb = gap_ble_find_clcb_by_conn_id(conn_id);
-    UINT16      op_type;
-    UINT16      min, max, latency, tout;
-    UINT16      len;
-    UINT8       *pp;
+    uint16_t    op_type;
+    uint16_t    min, max, latency, tout;
+    uint16_t    len;
+    uint8_t     *pp;
 
     if (p_clcb == NULL)
         return;
@@ -624,7 +624,7 @@
 
     if (status != GATT_SUCCESS)
     {
-        gap_ble_cl_op_cmpl(p_clcb, FALSE, 0, NULL);
+        gap_ble_cl_op_cmpl(p_clcb, false, 0, NULL);
         return;
     }
 
@@ -643,19 +643,19 @@
 
             BTM_BleSetPrefConnParams (p_clcb->bda, min, max, latency, tout);
             /* release the connection here */
-            gap_ble_cl_op_cmpl(p_clcb, TRUE, 0, NULL);
+            gap_ble_cl_op_cmpl(p_clcb, true, 0, NULL);
             break;
 
         case GATT_UUID_GAP_DEVICE_NAME:
             GAP_TRACE_EVENT ("GATT_UUID_GAP_DEVICE_NAME");
-            len = (UINT16)strlen((char *)pp);
+            len = (uint16_t)strlen((char *)pp);
             if (len > GAP_CHAR_DEV_NAME_SIZE)
                 len = GAP_CHAR_DEV_NAME_SIZE;
-            gap_ble_cl_op_cmpl(p_clcb, TRUE, len, pp);
+            gap_ble_cl_op_cmpl(p_clcb, true, len, pp);
             break;
 
         case GATT_UUID_GAP_CENTRAL_ADDR_RESOL:
-            gap_ble_cl_op_cmpl(p_clcb, TRUE, 1, pp);
+            gap_ble_cl_op_cmpl(p_clcb, true, 1, pp);
             break;
     }
 }
@@ -667,13 +667,13 @@
 **
 ** Description      Start a process to read peer address resolution capability
 **
-** Returns          TRUE if request accepted
+** Returns          true if request accepted
 **
 *******************************************************************************/
-BOOLEAN gap_ble_accept_cl_operation(BD_ADDR peer_bda, UINT16 uuid, tGAP_BLE_CMPL_CBACK *p_cback)
+bool    gap_ble_accept_cl_operation(BD_ADDR peer_bda, uint16_t uuid, tGAP_BLE_CMPL_CBACK *p_cback)
 {
     tGAP_CLCB *p_clcb;
-    BOOLEAN started = FALSE;
+    bool    started = false;
 
     if (p_cback == NULL && uuid != GATT_UUID_GAP_PREF_CONN_PARAM)
         return(started);
@@ -688,15 +688,15 @@
     }
 
     GAP_TRACE_EVENT ("%s() - BDA: %08x%04x  cl_op_uuid: 0x%04x",
-                      __FUNCTION__,
+                      __func__,
                       (peer_bda[0]<<24)+(peer_bda[1]<<16)+(peer_bda[2]<<8)+peer_bda[3],
                       (peer_bda[4]<<8)+peer_bda[5], uuid);
 
     if (GATT_GetConnIdIfConnected(gap_cb.gatt_if, peer_bda, &p_clcb->conn_id, BT_TRANSPORT_LE))
-        p_clcb->connected = TRUE;
+        p_clcb->connected = true;
 
     /* hold the link here */
-    if (!GATT_Connect(gap_cb.gatt_if, p_clcb->bda, TRUE, BT_TRANSPORT_LE))
+    if (!GATT_Connect(gap_cb.gatt_if, p_clcb->bda, true, BT_TRANSPORT_LE))
         return started;
 
     /* enqueue the request */
@@ -705,7 +705,7 @@
     if (p_clcb->connected && p_clcb->cl_op_uuid == 0)
         started = gap_ble_send_cl_read_request(p_clcb);
     else /* wait for connection up or pending operation to finish */
-        started = TRUE;
+        started = true;
 
    return started;
 }
@@ -716,10 +716,10 @@
 ** Description      Start a process to read a connected peripheral's preferred
 **                  connection parameters
 **
-** Returns          TRUE if read started, else FALSE if GAP is busy
+** Returns          true if read started, else false if GAP is busy
 **
 *******************************************************************************/
-BOOLEAN GAP_BleReadPeerPrefConnParams (BD_ADDR peer_bda)
+bool    GAP_BleReadPeerPrefConnParams (BD_ADDR peer_bda)
 {
     return gap_ble_accept_cl_operation (peer_bda, GATT_UUID_GAP_PREF_CONN_PARAM, NULL);
 }
@@ -730,10 +730,10 @@
 **
 ** Description      Start a process to read a connected peripheral's device name.
 **
-** Returns          TRUE if request accepted
+** Returns          true if request accepted
 **
 *******************************************************************************/
-BOOLEAN GAP_BleReadPeerDevName (BD_ADDR peer_bda, tGAP_BLE_CMPL_CBACK *p_cback)
+bool    GAP_BleReadPeerDevName (BD_ADDR peer_bda, tGAP_BLE_CMPL_CBACK *p_cback)
 {
     return gap_ble_accept_cl_operation (peer_bda, GATT_UUID_GAP_DEVICE_NAME, p_cback);
 }
@@ -744,10 +744,10 @@
 **
 ** Description      Start a process to read peer address resolution capability
 **
-** Returns          TRUE if request accepted
+** Returns          true if request accepted
 **
 *******************************************************************************/
-BOOLEAN GAP_BleReadPeerAddressResolutionCap (BD_ADDR peer_bda, tGAP_BLE_CMPL_CBACK *p_cback)
+bool    GAP_BleReadPeerAddressResolutionCap (BD_ADDR peer_bda, tGAP_BLE_CMPL_CBACK *p_cback)
 {
     return gap_ble_accept_cl_operation(peer_bda, GATT_UUID_GAP_CENTRAL_ADDR_RESOL, p_cback);
 }
@@ -758,10 +758,10 @@
 **
 ** Description      Cancel reading a peripheral's device name.
 **
-** Returns          TRUE if request accepted
+** Returns          true if request accepted
 **
 *******************************************************************************/
-BOOLEAN GAP_BleCancelReadPeerDevName (BD_ADDR peer_bda)
+bool    GAP_BleCancelReadPeerDevName (BD_ADDR peer_bda)
 {
     tGAP_CLCB *p_clcb = gap_find_clcb_by_bd_addr (peer_bda);
 
@@ -772,21 +772,21 @@
     if (p_clcb == NULL)
     {
         GAP_TRACE_ERROR ("Cannot cancel current op is not get dev name");
-        return FALSE;
+        return false;
     }
 
     if (!p_clcb->connected)
     {
-        if (!GATT_CancelConnect(gap_cb.gatt_if, peer_bda, TRUE))
+        if (!GATT_CancelConnect(gap_cb.gatt_if, peer_bda, true))
         {
             GAP_TRACE_ERROR ("Cannot cancel where No connection id");
-            return FALSE;
+            return false;
         }
     }
 
-    gap_ble_cl_op_cmpl(p_clcb, FALSE, 0, NULL);
+    gap_ble_cl_op_cmpl(p_clcb, false, 0, NULL);
 
-    return(TRUE);
+    return(true);
 }
 
 #endif  /* BLE_INCLUDED */
diff --git a/stack/gap/gap_conn.c b/stack/gap/gap_conn.c
index 1ee2c97..b441d62 100644
--- a/stack/gap/gap_conn.c
+++ b/stack/gap/gap_conn.c
@@ -25,23 +25,23 @@
 #include "l2c_int.h"
 #include <string.h>
 #include "osi/include/mutex.h"
-#if GAP_CONN_INCLUDED == TRUE
+#if (GAP_CONN_INCLUDED == TRUE)
 #include "btm_int.h"
 
 /********************************************************************************/
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
-static void gap_connect_ind (BD_ADDR  bd_addr, UINT16 l2cap_cid, UINT16 psm, UINT8 l2cap_id);
-static void gap_connect_cfm (UINT16 l2cap_cid, UINT16 result);
-static void gap_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
-static void gap_config_cfm (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
-static void gap_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed);
-static void gap_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg);
-static void gap_congestion_ind (UINT16 lcid, BOOLEAN is_congested);
-static void gap_tx_complete_ind (UINT16 l2cap_cid, UINT16 sdu_sent);
+static void gap_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid, uint16_t psm, uint8_t l2cap_id);
+static void gap_connect_cfm (uint16_t l2cap_cid, uint16_t result);
+static void gap_config_ind (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
+static void gap_config_cfm (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
+static void gap_disconnect_ind (uint16_t l2cap_cid, bool    ack_needed);
+static void gap_data_ind (uint16_t l2cap_cid, BT_HDR *p_msg);
+static void gap_congestion_ind (uint16_t lcid, bool    is_congested);
+static void gap_tx_complete_ind (uint16_t l2cap_cid, uint16_t sdu_sent);
 
-static tGAP_CCB *gap_find_ccb_by_cid (UINT16 cid);
-static tGAP_CCB *gap_find_ccb_by_handle (UINT16 handle);
+static tGAP_CCB *gap_find_ccb_by_cid (uint16_t cid);
+static tGAP_CCB *gap_find_ccb_by_handle (uint16_t handle);
 static tGAP_CCB *gap_allocate_ccb (void);
 static void      gap_release_ccb (tGAP_CCB *p_ccb);
 static void      gap_checks_con_flags (tGAP_CCB *p_ccb);
@@ -57,7 +57,7 @@
 *******************************************************************************/
 void gap_conn_init (void)
 {
-#if AMP_INCLUDED == TRUE
+#if (AMP_INCLUDED == TRUE)
     gap_cb.conn.reg_info.pAMP_ConnectInd_Cb         = gap_connect_ind;
     gap_cb.conn.reg_info.pAMP_ConnectCfm_Cb         = gap_connect_cfm;
     gap_cb.conn.reg_info.pAMP_ConnectPnd_Cb         = NULL;
@@ -96,7 +96,7 @@
 **
 ** Description      This function is called to open an L2CAP connection.
 **
-** Parameters:      is_server   - If TRUE, the connection is not created
+** Parameters:      is_server   - If true, the connection is not created
 **                                but put into a "listen" mode waiting for
 **                                the remote side to connect.
 **
@@ -123,13 +123,13 @@
 ** Returns          handle of the connection if successful, else GAP_INVALID_HANDLE
 **
 *******************************************************************************/
-UINT16 GAP_ConnOpen (char *p_serv_name, UINT8 service_id, BOOLEAN is_server,
-                     BD_ADDR p_rem_bda, UINT16 psm, tL2CAP_CFG_INFO *p_cfg,
-                     tL2CAP_ERTM_INFO *ertm_info, UINT16 security, UINT8 chan_mode_mask,
+uint16_t GAP_ConnOpen (char *p_serv_name, uint8_t service_id, bool    is_server,
+                     BD_ADDR p_rem_bda, uint16_t psm, tL2CAP_CFG_INFO *p_cfg,
+                     tL2CAP_ERTM_INFO *ertm_info, uint16_t security, uint8_t chan_mode_mask,
                      tGAP_CONN_CALLBACK *p_cb, tBT_TRANSPORT transport)
 {
     tGAP_CCB    *p_ccb;
-    UINT16       cid;
+    uint16_t     cid;
 
     GAP_TRACE_EVENT ("GAP_CONN - Open Request");
 
@@ -145,7 +145,7 @@
     {
         /* the bd addr is not BT_BD_ANY, then a bd address was specified */
         if (memcmp (p_rem_bda, BT_BD_ANY, BD_ADDR_LEN))
-            p_ccb->rem_addr_specified = TRUE;
+            p_ccb->rem_addr_specified = true;
 
         memcpy (&p_ccb->rem_dev_address[0], p_rem_bda, BD_ADDR_LEN);
     }
@@ -178,7 +178,7 @@
     p_ccb->p_callback     = p_cb;
 
     /* If originator, use a dynamic PSM */
-#if AMP_INCLUDED == TRUE
+#if (AMP_INCLUDED == TRUE)
     if (!is_server)
         gap_cb.conn.reg_info.pAMP_ConnectInd_Cb  = NULL;
     else
@@ -217,7 +217,7 @@
 
     /* Register with Security Manager for the specific security level */
     p_ccb->service_id = service_id;
-    if (!BTM_SetSecurityLevel ((UINT8)!is_server, p_serv_name,
+    if (!BTM_SetSecurityLevel ((uint8_t)!is_server, p_serv_name,
                 p_ccb->service_id, security, p_ccb->psm, 0, 0))
     {
         GAP_TRACE_ERROR ("GAP_CONN - Security Error");
@@ -242,7 +242,7 @@
     /* optional FCR channel modes */
     if(ertm_info != NULL) {
         p_ccb->ertm_info.allowed_modes =
-            (chan_mode_mask) ? chan_mode_mask : (UINT8)L2CAP_FCR_CHAN_OPT_BASIC;
+            (chan_mode_mask) ? chan_mode_mask : (uint8_t)L2CAP_FCR_CHAN_OPT_BASIC;
     }
 
     if (is_server)
@@ -302,7 +302,7 @@
 **                  GAP_ERR_BAD_HANDLE  - invalid handle
 **
 *******************************************************************************/
-UINT16 GAP_ConnClose (UINT16 gap_handle)
+uint16_t GAP_ConnClose (uint16_t gap_handle)
 {
     tGAP_CCB    *p_ccb = gap_find_ccb_by_handle (gap_handle);
 
@@ -341,10 +341,10 @@
 **                  GAP_NO_DATA_AVAIL   - no data available
 **
 *******************************************************************************/
-UINT16 GAP_ConnReadData (UINT16 gap_handle, UINT8 *p_data, UINT16 max_len, UINT16 *p_len)
+uint16_t GAP_ConnReadData (uint16_t gap_handle, uint8_t *p_data, uint16_t max_len, uint16_t *p_len)
 {
     tGAP_CCB    *p_ccb = gap_find_ccb_by_handle (gap_handle);
-    UINT16      copy_len;
+    uint16_t    copy_len;
 
     if (!p_ccb)
         return (GAP_ERR_BAD_HANDLE);
@@ -367,7 +367,7 @@
         *p_len  += copy_len;
         if (p_data)
         {
-            memcpy (p_data, (UINT8 *)(p_buf + 1) + p_buf->offset, copy_len);
+            memcpy (p_data, (uint8_t *)(p_buf + 1) + p_buf->offset, copy_len);
             p_data += copy_len;
         }
 
@@ -401,7 +401,7 @@
 **
 **
 *******************************************************************************/
-int GAP_GetRxQueueCnt (UINT16 handle, UINT32 *p_rx_queue_count)
+int GAP_GetRxQueueCnt (uint16_t handle, uint32_t *p_rx_queue_count)
 {
     tGAP_CCB    *p_ccb;
     int         rc = BT_PASS;
@@ -442,7 +442,7 @@
 **                  GAP_NO_DATA_AVAIL   - no data available
 **
 *******************************************************************************/
-UINT16 GAP_ConnBTRead (UINT16 gap_handle, BT_HDR **pp_buf)
+uint16_t GAP_ConnBTRead (uint16_t gap_handle, BT_HDR **pp_buf)
 {
     tGAP_CCB    *p_ccb = gap_find_ccb_by_handle (gap_handle);
     BT_HDR      *p_buf;
@@ -484,7 +484,7 @@
 **                  GAP_CONGESTION          - system is congested
 **
 *******************************************************************************/
-UINT16 GAP_ConnWriteData (UINT16 gap_handle, UINT8 *p_data, UINT16 max_len, UINT16 *p_len)
+uint16_t GAP_ConnWriteData (uint16_t gap_handle, uint8_t *p_data, uint16_t max_len, uint16_t *p_len)
 {
     tGAP_CCB    *p_ccb = gap_find_ccb_by_handle (gap_handle);
     BT_HDR     *p_buf;
@@ -508,7 +508,7 @@
         p_buf->len = (p_ccb->rem_mtu_size < max_len) ? p_ccb->rem_mtu_size : max_len;
         p_buf->event = BT_EVT_TO_BTU_SP_DATA;
 
-        memcpy ((UINT8 *)(p_buf + 1) + p_buf->offset, p_data, p_buf->len);
+        memcpy ((uint8_t *)(p_buf + 1) + p_buf->offset, p_data, p_buf->len);
 
         *p_len  += p_buf->len;
         max_len -= p_buf->len;
@@ -530,11 +530,11 @@
 #else
     while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_ccb->tx_queue)) != NULL)
     {
-        UINT8 status = L2CA_DATA_WRITE (p_ccb->connection_id, p_buf);
+        uint8_t status = L2CA_DATA_WRITE (p_ccb->connection_id, p_buf);
 
         if (status == L2CAP_DW_CONGESTED)
         {
-            p_ccb->is_congested = TRUE;
+            p_ccb->is_congested = true;
             break;
         }
         else if (status != L2CAP_DW_SUCCESS)
@@ -558,7 +558,7 @@
 **                  GAP_ERR_BAD_HANDLE      - invalid handle
 **
 *******************************************************************************/
-UINT16 GAP_ConnReconfig (UINT16 gap_handle, tL2CAP_CFG_INFO *p_cfg)
+uint16_t GAP_ConnReconfig (uint16_t gap_handle, tL2CAP_CFG_INFO *p_cfg)
 {
     tGAP_CCB    *p_ccb = gap_find_ccb_by_handle (gap_handle);
 
@@ -596,14 +596,14 @@
 **                  GAP_ERR_BAD_HANDLE      - invalid handle
 **
 *******************************************************************************/
-UINT16 GAP_ConnSetIdleTimeout (UINT16 gap_handle, UINT16 timeout)
+uint16_t GAP_ConnSetIdleTimeout (uint16_t gap_handle, uint16_t timeout)
 {
     tGAP_CCB    *p_ccb;
 
     if ((p_ccb = gap_find_ccb_by_handle (gap_handle)) == NULL)
         return (GAP_ERR_BAD_HANDLE);
 
-    if (L2CA_SetIdleTimeout (p_ccb->connection_id, timeout, FALSE))
+    if (L2CA_SetIdleTimeout (p_ccb->connection_id, timeout, false))
         return (BT_PASS);
     else
         return (GAP_ERR_BAD_HANDLE);
@@ -624,7 +624,7 @@
 **                  GAP_ERR_BAD_HANDLE  - invalid handle
 **
 *******************************************************************************/
-UINT8 *GAP_ConnGetRemoteAddr (UINT16 gap_handle)
+uint8_t *GAP_ConnGetRemoteAddr (uint16_t gap_handle)
 {
     tGAP_CCB    *p_ccb = gap_find_ccb_by_handle (gap_handle);
 
@@ -653,10 +653,10 @@
 **
 ** Parameters:      handle      - Handle of the connection
 **
-** Returns          UINT16      - maximum size buffer that can be transmitted to the peer
+** Returns          uint16_t    - maximum size buffer that can be transmitted to the peer
 **
 *******************************************************************************/
-UINT16 GAP_ConnGetRemMtuSize (UINT16 gap_handle)
+uint16_t GAP_ConnGetRemMtuSize (uint16_t gap_handle)
 {
     tGAP_CCB    *p_ccb;
 
@@ -674,11 +674,11 @@
 **
 ** Parameters:      handle      - Handle of the connection
 **
-** Returns          UINT16      - The L2CAP channel id
+** Returns          uint16_t    - The L2CAP channel id
 **                  0, if error
 **
 *******************************************************************************/
-UINT16 GAP_ConnGetL2CAPCid (UINT16 gap_handle)
+uint16_t GAP_ConnGetL2CAPCid (uint16_t gap_handle)
 {
     tGAP_CCB    *p_ccb;
 
@@ -698,7 +698,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gap_tx_complete_ind (UINT16 l2cap_cid, UINT16 sdu_sent)
+void gap_tx_complete_ind (uint16_t l2cap_cid, uint16_t sdu_sent)
 {
     tGAP_CCB *p_ccb = gap_find_ccb_by_cid (l2cap_cid);
     if (p_ccb == NULL)
@@ -722,9 +722,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gap_connect_ind (BD_ADDR  bd_addr, UINT16 l2cap_cid, UINT16 psm, UINT8 l2cap_id)
+static void gap_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid, uint16_t psm, uint8_t l2cap_id)
 {
-    UINT16       xx;
+    uint16_t     xx;
     tGAP_CCB     *p_ccb;
 
     /* See if we have a CCB listening for the connection */
@@ -732,7 +732,7 @@
     {
         if ((p_ccb->con_state == GAP_CCB_STATE_LISTENING)
          && (p_ccb->psm == psm)
-         && ((p_ccb->rem_addr_specified == FALSE)
+         && ((p_ccb->rem_addr_specified == false)
            || (!memcmp (bd_addr, p_ccb->rem_dev_address, BD_ADDR_LEN))))
             break;
     }
@@ -813,7 +813,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gap_sec_check_complete (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, UINT8 res)
+static void gap_sec_check_complete (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, uint8_t res)
 {
     tGAP_CCB *p_ccb = (tGAP_CCB *)p_ref_data;
     UNUSED(bd_addr);
@@ -847,7 +847,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gap_connect_cfm (UINT16 l2cap_cid, UINT16 result)
+static void gap_connect_cfm (uint16_t l2cap_cid, uint16_t result)
 {
     tGAP_CCB    *p_ccb;
 
@@ -858,7 +858,7 @@
     /* initiate security process, if needed */
     if ( (p_ccb->con_flags & GAP_CCB_FLAGS_SEC_DONE) == 0 && p_ccb->transport != BT_TRANSPORT_LE)
     {
-        btm_sec_mx_access_request (p_ccb->rem_dev_address, p_ccb->psm, TRUE,
+        btm_sec_mx_access_request (p_ccb->rem_dev_address, p_ccb->psm, true,
                                    0, 0, &gap_sec_check_complete, p_ccb);
     }
 
@@ -907,10 +907,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gap_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
+static void gap_config_ind (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
 {
     tGAP_CCB    *p_ccb;
-    UINT16      local_mtu_size;
+    uint16_t    local_mtu_size;
 
     /* Find CCB based on CID */
     if ((p_ccb = gap_find_ccb_by_cid (l2cap_cid)) == NULL)
@@ -934,10 +934,10 @@
         p_ccb->rem_mtu_size = p_cfg->mtu;
 
     /* For now, always accept configuration from the other side */
-    p_cfg->flush_to_present = FALSE;
-    p_cfg->mtu_present      = FALSE;
+    p_cfg->flush_to_present = false;
+    p_cfg->mtu_present      = false;
     p_cfg->result           = L2CAP_CFG_OK;
-    p_cfg->fcs_present      = FALSE;
+    p_cfg->fcs_present      = false;
 
     L2CA_CONFIG_RSP (l2cap_cid, p_cfg);
 
@@ -957,7 +957,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gap_config_cfm (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
+static void gap_config_cfm (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
 {
     tGAP_CCB    *p_ccb;
 
@@ -995,7 +995,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gap_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed)
+static void gap_disconnect_ind (uint16_t l2cap_cid, bool    ack_needed)
 {
     tGAP_CCB    *p_ccb;
 
@@ -1022,7 +1022,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gap_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg)
+static void gap_data_ind (uint16_t l2cap_cid, BT_HDR *p_msg)
 {
     tGAP_CCB    *p_ccb;
 
@@ -1060,12 +1060,12 @@
 **                  data L2CAP congestion status changes
 **
 *******************************************************************************/
-static void gap_congestion_ind (UINT16 lcid, BOOLEAN is_congested)
+static void gap_congestion_ind (uint16_t lcid, bool    is_congested)
 {
     tGAP_CCB    *p_ccb;
-    UINT16       event;
+    uint16_t     event;
     BT_HDR      *p_buf;
-    UINT8        status;
+    uint8_t      status;
 
     GAP_TRACE_EVENT ("GAP_CONN - Rcvd L2CAP Is Congested (%d), CID: 0x%x",
                       is_congested, lcid);
@@ -1087,7 +1087,7 @@
 
             if (status == L2CAP_DW_CONGESTED)
             {
-                p_ccb->is_congested = TRUE;
+                p_ccb->is_congested = true;
                 break;
             }
             else if (status != L2CAP_DW_SUCCESS)
@@ -1107,9 +1107,9 @@
 ** Returns          the CCB address, or NULL if not found.
 **
 *******************************************************************************/
-static tGAP_CCB *gap_find_ccb_by_cid (UINT16 cid)
+static tGAP_CCB *gap_find_ccb_by_cid (uint16_t cid)
 {
-    UINT16       xx;
+    uint16_t     xx;
     tGAP_CCB     *p_ccb;
 
     /* Look through each connection control block */
@@ -1134,7 +1134,7 @@
 ** Returns          the CCB address, or NULL if not found.
 **
 *******************************************************************************/
-static tGAP_CCB *gap_find_ccb_by_handle (UINT16 handle)
+static tGAP_CCB *gap_find_ccb_by_handle (uint16_t handle)
 {
     tGAP_CCB     *p_ccb;
 
@@ -1163,7 +1163,7 @@
 *******************************************************************************/
 static tGAP_CCB *gap_allocate_ccb (void)
 {
-    UINT16       xx;
+    uint16_t     xx;
     tGAP_CCB     *p_ccb;
 
     /* Look through each connection control block for a free one */
@@ -1198,9 +1198,9 @@
 *******************************************************************************/
 static void gap_release_ccb (tGAP_CCB *p_ccb)
 {
-    UINT16       xx;
-    UINT16      psm = p_ccb->psm;
-    UINT8       service_id = p_ccb->service_id;
+    uint16_t     xx;
+    uint16_t    psm = p_ccb->psm;
+    uint8_t     service_id = p_ccb->service_id;
 
     /* Drop any buffers we may be holding */
     p_ccb->rx_queue_size = 0;
@@ -1244,7 +1244,7 @@
 ** Returns      None
 **
 *******************************************************************************/
-void gap_send_event (UINT16 gap_handle)
+void gap_send_event (uint16_t gap_handle)
 {
     BT_HDR *p_msg = (BT_HDR *)osi_malloc(BT_HDR_SIZE);
 
diff --git a/stack/gap/gap_int.h b/stack/gap/gap_int.h
index 96c0343..4d34db0 100644
--- a/stack/gap/gap_int.h
+++ b/stack/gap/gap_int.h
@@ -32,9 +32,9 @@
     void          *p_data;      /* Pointer to any data returned in callback */
     tGAP_CALLBACK *gap_cback;   /* Pointer to users callback function */
     tGAP_CALLBACK *gap_inq_rslt_cback; /* Used for inquiry results */
-    UINT16         event;       /* Passed back in the callback */
-    UINT8          index;       /* Index of this control block and callback */
-    BOOLEAN        in_use;      /* True when structure is allocated */
+    uint16_t       event;       /* Passed back in the callback */
+    uint8_t        index;       /* Index of this control block and callback */
+    bool           in_use;      /* True when structure is allocated */
 } tGAP_INFO;
 
 /* Define the control block for the FindAddrByName operation (Only 1 active at a time) */
@@ -43,7 +43,7 @@
     tGAP_CALLBACK           *p_cback;
     tBTM_INQ_INFO           *p_cur_inq; /* Pointer to the current inquiry database entry */
     tGAP_FINDADDR_RESULTS    results;
-    BOOLEAN                  in_use;
+    bool                     in_use;
 } tGAP_FINDADDR_CB;
 
 /* Define the GAP Connection Control Block.
@@ -56,29 +56,29 @@
 #define GAP_CCB_STATE_CFG_SETUP         3
 #define GAP_CCB_STATE_WAIT_SEC          4
 #define GAP_CCB_STATE_CONNECTED         5
-    UINT8             con_state;
+    uint8_t           con_state;
 
 #define GAP_CCB_FLAGS_IS_ORIG           0x01
 #define GAP_CCB_FLAGS_HIS_CFG_DONE      0x02
 #define GAP_CCB_FLAGS_MY_CFG_DONE       0x04
 #define GAP_CCB_FLAGS_SEC_DONE          0x08
 #define GAP_CCB_FLAGS_CONN_DONE         0x0E
-    UINT8             con_flags;
+    uint8_t           con_flags;
 
-    UINT8             service_id;           /* Used by BTM                          */
-    UINT16            gap_handle;           /* GAP handle                           */
-    UINT16            connection_id;        /* L2CAP CID                            */
-    BOOLEAN           rem_addr_specified;
-    UINT8             chan_mode_mask;       /* Supported channel modes (FCR)        */
+    uint8_t           service_id;           /* Used by BTM                          */
+    uint16_t          gap_handle;           /* GAP handle                           */
+    uint16_t          connection_id;        /* L2CAP CID                            */
+    bool              rem_addr_specified;
+    uint8_t           chan_mode_mask;       /* Supported channel modes (FCR)        */
     BD_ADDR           rem_dev_address;
-    UINT16            psm;
-    UINT16            rem_mtu_size;
+    uint16_t          psm;
+    uint16_t          rem_mtu_size;
 
-    BOOLEAN           is_congested;
+    bool              is_congested;
     fixed_queue_t     *tx_queue;            /* Queue of buffers waiting to be sent  */
     fixed_queue_t     *rx_queue;            /* Queue of buffers waiting to be read  */
 
-    UINT32            rx_queue_size;        /* Total data count in rx_queue         */
+    uint32_t          rx_queue_size;        /* Total data count in rx_queue         */
 
     tGAP_CONN_CALLBACK *p_callback;         /* Users callback function              */
 
@@ -91,7 +91,7 @@
 
 typedef struct
 {
-#if AMP_INCLUDED == TRUE
+#if (AMP_INCLUDED == TRUE)
     tAMP_APPL_INFO    reg_info;
 #else
     tL2CAP_APPL_INFO  reg_info;                     /* L2CAP Registration info */
@@ -100,13 +100,13 @@
 } tGAP_CONN;
 
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 #define GAP_MAX_CHAR_NUM          4
 
 typedef struct
 {
-    UINT16                  handle;
-    UINT16                  uuid;
+    uint16_t                handle;
+    uint16_t                uuid;
     tGAP_BLE_ATTR_VALUE     attr_value;
 }tGAP_ATTR;
 #endif
@@ -118,7 +118,7 @@
 
 typedef struct
 {
-    UINT16 uuid;
+    uint16_t uuid;
     tGAP_BLE_CMPL_CBACK *p_cback;
 } tGAP_BLE_REQ;
 
@@ -126,10 +126,10 @@
 {
     BD_ADDR                 bda;
     tGAP_BLE_CMPL_CBACK     *p_cback;
-    UINT16                  conn_id;
-    UINT16                  cl_op_uuid;
-    BOOLEAN                 in_use;
-    BOOLEAN                 connected;
+    uint16_t                conn_id;
+    uint16_t                cl_op_uuid;
+    bool                    in_use;
+    bool                    connected;
     fixed_queue_t           *pending_req_q;
 
 }tGAP_CLCB;
@@ -138,16 +138,16 @@
 {
     tGAP_INFO        blk[GAP_MAX_BLOCKS];
     tBTM_CMPL_CB    *btm_cback[GAP_MAX_BLOCKS];
-    UINT8            trace_level;
+    uint8_t          trace_level;
     tGAP_FINDADDR_CB findaddr_cb;   /* Contains the control block for finding a device addr */
     tBTM_INQ_INFO   *cur_inqptr;
 
-#if GAP_CONN_INCLUDED == TRUE
+#if (GAP_CONN_INCLUDED == TRUE)
     tGAP_CONN        conn;
 #endif
 
     /* LE GAP attribute database */
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     tGAP_ATTR               gatt_attr[GAP_MAX_CHAR_NUM];
     tGAP_CLCB               clcb[GAP_MAX_CL]; /* connection link*/
     tGATT_IF                gatt_if;
diff --git a/stack/gap/gap_utils.c b/stack/gap/gap_utils.c
index 6c8a05a..afdcf65 100644
--- a/stack/gap/gap_utils.c
+++ b/stack/gap/gap_utils.c
@@ -33,7 +33,7 @@
 tGAP_INFO *gap_allocate_cb (void)
 {
     tGAP_INFO     *p_cb = &gap_cb.blk[0];
-    UINT8        x;
+    uint8_t      x;
 
     for (x = 0; x < GAP_MAX_BLOCKS; x++, p_cb++)
     {
@@ -41,7 +41,7 @@
         {
             memset (p_cb, 0, sizeof (tGAP_INFO));
 
-            p_cb->in_use = TRUE;
+            p_cb->in_use = true;
             p_cb->index = x;
             p_cb->p_data = (void *)NULL;
             return (p_cb);
@@ -67,7 +67,7 @@
     if (p_cb)
     {
         p_cb->gap_cback = NULL;
-        p_cb->in_use = FALSE;
+        p_cb->in_use = false;
     }
 }
 
@@ -80,23 +80,23 @@
 **                  and check to see if the event waiting for is the command
 **                  requested.
 **
-** Returns          TRUE if already in use
-**                  FALSE if not busy
+** Returns          true if already in use
+**                  false if not busy
 **
 *******************************************************************************/
-BOOLEAN gap_is_service_busy (UINT16 request)
+bool    gap_is_service_busy (uint16_t request)
 {
     tGAP_INFO   *p_cb = &gap_cb.blk[0];
-    UINT8        x;
+    uint8_t      x;
 
     for (x = 0; x < GAP_MAX_BLOCKS; x++, p_cb++)
     {
         if (p_cb->in_use && p_cb->event == request)
-            return (TRUE);
+            return (true);
     }
 
     /* If here, service is not busy */
-    return (FALSE);
+    return (false);
 }
 
 
@@ -110,7 +110,7 @@
 ** Returns          GAP_UNKNOWN_BTM_STATUS is returned if not recognized
 **
 *******************************************************************************/
-UINT16 gap_convert_btm_status (tBTM_STATUS btm_status)
+uint16_t gap_convert_btm_status (tBTM_STATUS btm_status)
 {
     switch (btm_status)
     {
diff --git a/stack/gatt/att_protocol.c b/stack/gatt/att_protocol.c
index e096362..bef0982 100644
--- a/stack/gatt/att_protocol.c
+++ b/stack/gatt/att_protocol.c
@@ -24,7 +24,7 @@
 
 #include "bt_target.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
 #include "gatt_int.h"
 #include "l2c_api.h"
@@ -45,13 +45,13 @@
 ** Returns          None.
 **
 *******************************************************************************/
-BT_HDR *attp_build_mtu_cmd(UINT8 op_code, UINT16 rx_mtu)
+BT_HDR *attp_build_mtu_cmd(uint8_t op_code, uint16_t rx_mtu)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf =
         (BT_HDR *)osi_malloc(sizeof(BT_HDR) + GATT_HDR_SIZE + L2CAP_MIN_OFFSET);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, op_code);
     UINT16_TO_STREAM(p, rx_mtu);
 
@@ -69,12 +69,12 @@
 ** Returns          None.
 **
 *******************************************************************************/
-BT_HDR *attp_build_exec_write_cmd (UINT8 op_code, UINT8 flag)
+BT_HDR *attp_build_exec_write_cmd (uint8_t op_code, uint8_t flag)
 {
     BT_HDR      *p_buf = (BT_HDR *)osi_malloc(GATT_DATA_BUF_SIZE);
-    UINT8       *p;
+    uint8_t     *p;
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     p_buf->offset = L2CAP_MIN_OFFSET;
     p_buf->len = GATT_OP_CODE_SIZE;
@@ -99,12 +99,12 @@
 ** Returns          None.
 **
 *******************************************************************************/
-BT_HDR *attp_build_err_cmd(UINT8 cmd_code, UINT16 err_handle, UINT8 reason)
+BT_HDR *attp_build_err_cmd(uint8_t cmd_code, uint16_t err_handle, uint8_t reason)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) + L2CAP_MIN_OFFSET + 5);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, GATT_RSP_ERROR);
     UINT8_TO_STREAM(p, cmd_code);
     UINT16_TO_STREAM(p, err_handle);
@@ -125,12 +125,12 @@
 ** Returns          None.
 **
 *******************************************************************************/
-BT_HDR *attp_build_browse_cmd(UINT8 op_code, UINT16 s_hdl, UINT16 e_hdl, tBT_UUID uuid)
+BT_HDR *attp_build_browse_cmd(uint8_t op_code, uint16_t s_hdl, uint16_t e_hdl, tBT_UUID uuid)
 {
     const size_t payload_size = (GATT_OP_CODE_SIZE) + (GATT_START_END_HANDLE_SIZE) + (LEN_UUID_128);
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) + payload_size + L2CAP_MIN_OFFSET);
 
-    UINT8 *p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    uint8_t *p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     /* Describe the built message location and size */
     p_buf->offset = L2CAP_MIN_OFFSET;
     p_buf->len = GATT_OP_CODE_SIZE + 4;
@@ -152,14 +152,14 @@
 ** Returns          pointer to the command buffer.
 **
 *******************************************************************************/
-BT_HDR *attp_build_read_by_type_value_cmd (UINT16 payload_size, tGATT_FIND_TYPE_VALUE *p_value_type)
+BT_HDR *attp_build_read_by_type_value_cmd (uint16_t payload_size, tGATT_FIND_TYPE_VALUE *p_value_type)
 {
-    UINT8 *p;
-    UINT16 len = p_value_type->value_len;
+    uint8_t *p;
+    uint16_t len = p_value_type->value_len;
     BT_HDR *p_buf =
         (BT_HDR *)osi_malloc(sizeof(BT_HDR) + payload_size + L2CAP_MIN_OFFSET);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     p_buf->offset = L2CAP_MIN_OFFSET;
     p_buf->len = 5; /* opcode + s_handle + e_handle */
 
@@ -187,13 +187,13 @@
 ** Returns          None.
 **
 *******************************************************************************/
-BT_HDR *attp_build_read_multi_cmd(UINT16 payload_size, UINT16 num_handle, UINT16 *p_handle)
+BT_HDR *attp_build_read_multi_cmd(uint16_t payload_size, uint16_t num_handle, uint16_t *p_handle)
 {
-    UINT8 *p, i = 0;
+    uint8_t *p, i = 0;
     BT_HDR *p_buf =
         (BT_HDR *)osi_malloc(sizeof(BT_HDR) + num_handle * 2 + 1 + L2CAP_MIN_OFFSET);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     p_buf->offset = L2CAP_MIN_OFFSET;
     p_buf->len = 1;
 
@@ -215,13 +215,13 @@
 ** Returns          None.
 **
 *******************************************************************************/
-BT_HDR *attp_build_handle_cmd(UINT8 op_code, UINT16 handle, UINT16 offset)
+BT_HDR *attp_build_handle_cmd(uint8_t op_code, uint16_t handle, uint16_t offset)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf =
         (BT_HDR *)osi_malloc(sizeof(BT_HDR) + 5 + L2CAP_MIN_OFFSET);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     p_buf->offset = L2CAP_MIN_OFFSET;
 
     UINT8_TO_STREAM(p, op_code);
@@ -247,13 +247,13 @@
 ** Returns          None.
 **
 *******************************************************************************/
-BT_HDR *attp_build_opcode_cmd(UINT8 op_code)
+BT_HDR *attp_build_opcode_cmd(uint8_t op_code)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf =
         (BT_HDR *)osi_malloc(sizeof(BT_HDR) + 1 + L2CAP_MIN_OFFSET);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     p_buf->offset = L2CAP_MIN_OFFSET;
 
     UINT8_TO_STREAM(p, op_code);
@@ -271,14 +271,14 @@
 ** Returns          None.
 **
 *******************************************************************************/
-BT_HDR *attp_build_value_cmd (UINT16 payload_size, UINT8 op_code, UINT16 handle,
-                              UINT16 offset, UINT16 len, UINT8 *p_data)
+BT_HDR *attp_build_value_cmd (uint16_t payload_size, uint8_t op_code, uint16_t handle,
+                              uint16_t offset, uint16_t len, uint8_t *p_data)
 {
-    UINT8 *p, *pp, pair_len, *p_pair_len;
+    uint8_t *p, *pp, pair_len, *p_pair_len;
     BT_HDR *p_buf =
         (BT_HDR *)osi_malloc(sizeof(BT_HDR) + payload_size + L2CAP_MIN_OFFSET);
 
-    p = pp = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = pp = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, op_code);
     p_buf->offset = L2CAP_MIN_OFFSET;
     p_buf->len = 1;
@@ -326,18 +326,18 @@
 *******************************************************************************/
 tGATT_STATUS attp_send_msg_to_l2cap(tGATT_TCB *p_tcb, BT_HDR *p_toL2CAP)
 {
-    UINT16      l2cap_ret;
+    uint16_t    l2cap_ret;
 
 
     if (p_tcb->att_lcid == L2CAP_ATT_CID)
         l2cap_ret = L2CA_SendFixedChnlData (L2CAP_ATT_CID, p_tcb->peer_bda, p_toL2CAP);
     else
-        l2cap_ret = (UINT16) L2CA_DataWrite (p_tcb->att_lcid, p_toL2CAP);
+        l2cap_ret = (uint16_t) L2CA_DataWrite (p_tcb->att_lcid, p_toL2CAP);
 
     if (l2cap_ret == L2CAP_DW_FAILED)
     {
         GATT_TRACE_ERROR("ATT   failed to pass msg:0x%0x to L2CAP",
-            *((UINT8 *)(p_toL2CAP + 1) + p_toL2CAP->offset));
+            *((uint8_t *)(p_toL2CAP + 1) + p_toL2CAP->offset));
         return GATT_INTERNAL_ERROR;
     }
     else if (l2cap_ret == L2CAP_DW_CONGESTED)
@@ -355,10 +355,10 @@
 ** Description      Build ATT Server PDUs.
 **
 *******************************************************************************/
-BT_HDR *attp_build_sr_msg(tGATT_TCB *p_tcb, UINT8 op_code, tGATT_SR_MSG *p_msg)
+BT_HDR *attp_build_sr_msg(tGATT_TCB *p_tcb, uint8_t op_code, tGATT_SR_MSG *p_msg)
 {
     BT_HDR          *p_cmd = NULL;
-    UINT16          offset = 0;
+    uint16_t        offset = 0;
 
     switch (op_code)
     {
@@ -450,7 +450,7 @@
 **                  GATT_ERROR if command sending failure
 **
 *******************************************************************************/
-tGATT_STATUS attp_cl_send_cmd(tGATT_TCB *p_tcb, UINT16 clcb_idx, UINT8 cmd_code, BT_HDR *p_cmd)
+tGATT_STATUS attp_cl_send_cmd(tGATT_TCB *p_tcb, uint16_t clcb_idx, uint8_t cmd_code, BT_HDR *p_cmd)
 {
     tGATT_STATUS att_ret = GATT_SUCCESS;
 
@@ -469,7 +469,7 @@
                 if (cmd_code != GATT_HANDLE_VALUE_CONF && cmd_code != GATT_CMD_WRITE)
                 {
                     gatt_start_rsp_timer (clcb_idx);
-                    gatt_cmd_enq(p_tcb, clcb_idx, FALSE, cmd_code, NULL);
+                    gatt_cmd_enq(p_tcb, clcb_idx, false, cmd_code, NULL);
                 }
             }
             else
@@ -478,7 +478,7 @@
         else
         {
             att_ret = GATT_CMD_STARTED;
-            gatt_cmd_enq(p_tcb, clcb_idx, TRUE, cmd_code, p_cmd);
+            gatt_cmd_enq(p_tcb, clcb_idx, true, cmd_code, p_cmd);
         }
     }
     else
@@ -502,11 +502,11 @@
 **
 **
 *******************************************************************************/
-tGATT_STATUS attp_send_cl_msg (tGATT_TCB *p_tcb, UINT16 clcb_idx, UINT8 op_code, tGATT_CL_MSG *p_msg)
+tGATT_STATUS attp_send_cl_msg (tGATT_TCB *p_tcb, uint16_t clcb_idx, uint8_t op_code, tGATT_CL_MSG *p_msg)
 {
     tGATT_STATUS     status = GATT_NO_RESOURCES;
     BT_HDR          *p_cmd = NULL;
-    UINT16          offset = 0, handle;
+    uint16_t        offset = 0, handle;
 
     if (p_tcb != NULL)
     {
diff --git a/stack/gatt/gatt_api.c b/stack/gatt/gatt_api.c
index 96f603c..b0f22a0 100644
--- a/stack/gatt/gatt_api.c
+++ b/stack/gatt/gatt_api.c
@@ -24,7 +24,7 @@
 #include "bt_target.h"
 
 
-#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
+#if (BTA_GATT_INCLUDED == TRUE)
 
 #include "bt_common.h"
 #include <stdio.h>
@@ -54,7 +54,7 @@
 ** Returns          The new or current trace level
 **
 *******************************************************************************/
-UINT8 GATT_SetTraceLevel (UINT8 new_level)
+uint8_t GATT_SetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         gatt_cb.trace_level = new_level;
@@ -76,14 +76,14 @@
 **
 ** Parameter        p_hndl_range:   pointer to allocated handles information
 **
-** Returns          TRUE if handle range is added sucessfully; otherwise FALSE.
+** Returns          true if handle range is added sucessfully; otherwise false.
 **
 *******************************************************************************/
 
-BOOLEAN GATTS_AddHandleRange(tGATTS_HNDL_RANGE *p_hndl_range)
+bool    GATTS_AddHandleRange(tGATTS_HNDL_RANGE *p_hndl_range)
 {
     tGATT_HDL_LIST_ELEM *p_buf;
-    BOOLEAN status= FALSE;
+    bool    status= false;
 
     if ((p_buf = gatt_alloc_hdl_buffer()) != NULL)
     {
@@ -104,16 +104,16 @@
 **
 ** Parameter        p_cb_info : callback informaiton
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-BOOLEAN  GATTS_NVRegister (tGATT_APPL_INFO *p_cb_info)
+bool     GATTS_NVRegister (tGATT_APPL_INFO *p_cb_info)
 {
-    BOOLEAN status= FALSE;
+    bool    status= false;
     if (p_cb_info)
     {
         gatt_cb.cb_info = *p_cb_info;
-        status = TRUE;
+        status = true;
         gatt_init_srv_chg();
     }
 
@@ -168,7 +168,7 @@
     }
 }
 
-static UINT16 compute_service_size(btgatt_db_element_t *service, int count) {
+static uint16_t compute_service_size(btgatt_db_element_t *service, int count) {
     int db_size = 0;
     btgatt_db_element_t *el = service;
 
@@ -187,7 +187,7 @@
 }
 /*******************************************************************************
 **
-** Function         GATTS_CreateService
+** Function         GATTS_AddService
 **
 ** Description      This function is called to add GATT service.
 **
@@ -200,11 +200,11 @@
 **                  on error error status is returned.
 **
 *******************************************************************************/
-UINT16 GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t *service, int count) {
+uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t *service, int count) {
     tGATT_HDL_LIST_INFO     *p_list_info= &gatt_cb.hdl_list_info;
     tGATT_HDL_LIST_ELEM     *p_list=NULL;
-    UINT16                  s_hdl=0;
-    BOOLEAN                 save_hdl=FALSE;
+    uint16_t                s_hdl=0;
+    bool                    save_hdl=false;
     tGATT_REG              *p_reg = gatt_get_regcb(gatt_if);
     tBT_UUID     *p_app_uuid128;
 
@@ -222,7 +222,7 @@
 
     p_app_uuid128 = &p_reg->app_uuid128;
 
-    UINT16 num_handles = compute_service_size(service, count);
+    uint16_t num_handles = compute_service_size(service, count);
 
     if ( (svc_uuid.len == LEN_UUID_16) && (svc_uuid.uu.uuid16 == UUID_SERVCLASS_GATT_SERVER)) {
             s_hdl=  gatt_cb.hdl_cfg.gatt_start_hdl;
@@ -235,9 +235,9 @@
             s_hdl = p_list->asgn_range.e_handle + 1;
 
         if (s_hdl < gatt_cb.hdl_cfg.app_start_hdl)
-            s_hdl= gatt_cb.hdl_cfg.app_start_hdl;
+            s_hdl = gatt_cb.hdl_cfg.app_start_hdl;
 
-        save_hdl = TRUE;
+        save_hdl = true;
     }
 
     /* check for space */
@@ -262,7 +262,7 @@
 
     if (save_hdl) {
         if (gatt_cb.cb_info.p_nv_save_callback)
-            (*gatt_cb.cb_info.p_nv_save_callback)(TRUE, &p_list->asgn_range);
+            (*gatt_cb.cb_info.p_nv_save_callback)(true, &p_list->asgn_range);
     }
 
     if (!gatts_init_service_db(&p_list->svc_db, &svc_uuid, is_pri, s_hdl , num_handles))
@@ -315,11 +315,11 @@
         }
     }
 
-    tGATT_SR_REG            *p_sreg;
-    UINT8                    i_sreg;
-    tBT_UUID                *p_uuid;
+    tGATT_SR_REG *p_sreg;
+    uint8_t       i_sreg;
+    tBT_UUID     *p_uuid;
 
-    GATT_TRACE_API ("%s: service parsed correctly, now starting", __func__);
+    GATT_TRACE_API("%s: service parsed correctly, now starting", __func__);
 
     /*this is a new application servoce start */
     if ((i_sreg = gatt_sr_alloc_rcb(p_list)) ==  GATT_MAX_SR_PROFILES) {
@@ -340,8 +340,8 @@
 
     gatt_add_a_srv_to_list(&gatt_cb.srv_list_info, &gatt_cb.srv_list[i_sreg]);
 
-    GATT_TRACE_DEBUG ("%s: allocated i_sreg=%d ",__func__, i_sreg);
-    GATT_TRACE_DEBUG ("%s: s_hdl=%d e_hdl=%d type=0x%x sdp_hdl=0x%x", __func__,
+    GATT_TRACE_DEBUG("%s: allocated i_sreg=%d ",__func__, i_sreg);
+    GATT_TRACE_DEBUG("%s: s_hdl=%d e_hdl=%d type=0x%x sdp_hdl=0x%x", __func__,
                        p_sreg->s_hdl,p_sreg->e_hdl,
                        p_sreg->type,
                        p_sreg->sdp_handle);
@@ -361,15 +361,15 @@
 **                  p_svc_uuid    : service UUID
 **                  start_handle  : start handle of the service
 **
-** Returns          TRUE if operation succeed, FALSE if handle block was not found.
+** Returns          true if operation succeed, false if handle block was not found.
 **
 *******************************************************************************/
-BOOLEAN GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, UINT16 svc_inst)
+bool    GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, uint16_t svc_inst)
 {
 
     tGATT_HDL_LIST_INFO             *p_list_info= &gatt_cb.hdl_list_info;
     tGATT_HDL_LIST_ELEM             *p_list=NULL;
-    UINT8                           i_sreg;
+    uint8_t                           i_sreg;
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
     tBT_UUID *p_app_uuid128;
 
@@ -378,14 +378,14 @@
     if (p_reg == NULL)
     {
         GATT_TRACE_ERROR ("Applicaiton not foud");
-        return(FALSE);
+        return false;
     }
     p_app_uuid128 = &p_reg->app_uuid128;
 
     if ((p_list = gatt_find_hdl_buffer_by_app_id(p_app_uuid128, p_svc_uuid, svc_inst)) == NULL)
     {
         GATT_TRACE_ERROR ("No Service found");
-        return(FALSE);
+        return false;
     }
 
     gatt_proc_srv_chg();
@@ -402,12 +402,12 @@
 
     if ( (p_list->asgn_range.s_handle >= gatt_cb.hdl_cfg.app_start_hdl)
          && gatt_cb.cb_info.p_nv_save_callback)
-        (*gatt_cb.cb_info.p_nv_save_callback)(FALSE, &p_list->asgn_range);
+        (*gatt_cb.cb_info.p_nv_save_callback)(false, &p_list->asgn_range);
 
     gatt_remove_an_item_from_list(p_list_info, p_list);
     gatt_free_hdl_buffer(p_list);
 
-    return(TRUE);
+    return true;
 }
 
 /*******************************************************************************
@@ -421,9 +421,9 @@
 ** Returns          None.
 **
 *******************************************************************************/
-void GATTS_StopService (UINT16 service_handle)
+void GATTS_StopService (uint16_t service_handle)
 {
-    UINT8           ii = gatt_sr_find_i_rcb_by_handle(service_handle);
+    uint8_t         ii = gatt_sr_find_i_rcb_by_handle(service_handle);
 
     GATT_TRACE_API("GATTS_StopService %u", service_handle);
 
@@ -435,7 +435,7 @@
             SDP_DeleteRecord(gatt_cb.sr_reg[ii].sdp_handle);
         }
         gatt_remove_a_srv_from_list(&gatt_cb.srv_list_info, &gatt_cb.srv_list[ii]);
-        gatt_cb.srv_list[ii].in_use = FALSE;
+        gatt_cb.srv_list[ii].in_use = false;
         memset (&gatt_cb.sr_reg[ii], 0, sizeof(tGATT_SR_REG));
     }
     else
@@ -457,7 +457,7 @@
 ** Returns          GATT_SUCCESS if sucessfully sent or queued; otherwise error code.
 **
 *******************************************************************************/
-tGATT_STATUS GATTS_HandleValueIndication (UINT16 conn_id,  UINT16 attr_handle, UINT16 val_len, UINT8 *p_val)
+tGATT_STATUS GATTS_HandleValueIndication (uint16_t conn_id,  uint16_t attr_handle, uint16_t val_len, uint8_t *p_val)
 {
     tGATT_STATUS    cmd_status = GATT_NO_RESOURCES;
 
@@ -465,7 +465,7 @@
     BT_HDR          *p_msg;
     tGATT_VALUE     *p_buf;
     tGATT_IF         gatt_if = GATT_GET_GATT_IF(conn_id);
-    UINT8           tcb_idx = GATT_GET_TCB_IDX(conn_id);
+    uint8_t         tcb_idx = GATT_GET_TCB_IDX(conn_id);
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
     tGATT_TCB       *p_tcb = gatt_get_tcb_by_idx(tcb_idx);
 
@@ -529,14 +529,14 @@
 ** Returns          GATT_SUCCESS if sucessfully sent; otherwise error code.
 **
 *******************************************************************************/
-tGATT_STATUS GATTS_HandleValueNotification (UINT16 conn_id, UINT16 attr_handle,
-                                            UINT16 val_len, UINT8 *p_val)
+tGATT_STATUS GATTS_HandleValueNotification (uint16_t conn_id, uint16_t attr_handle,
+                                            uint16_t val_len, uint8_t *p_val)
 {
     tGATT_STATUS    cmd_sent = GATT_ILLEGAL_PARAMETER;
     BT_HDR          *p_buf;
     tGATT_VALUE     notif;
     tGATT_IF         gatt_if = GATT_GET_GATT_IF(conn_id);
-    UINT8           tcb_idx = GATT_GET_TCB_IDX(conn_id);
+    uint8_t         tcb_idx = GATT_GET_TCB_IDX(conn_id);
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
     tGATT_TCB       *p_tcb = gatt_get_tcb_by_idx(tcb_idx);
 
@@ -580,12 +580,12 @@
 ** Returns          GATT_SUCCESS if sucessfully sent; otherwise error code.
 **
 *******************************************************************************/
-tGATT_STATUS GATTS_SendRsp (UINT16 conn_id,  UINT32 trans_id,
+tGATT_STATUS GATTS_SendRsp (uint16_t conn_id,  uint32_t trans_id,
                             tGATT_STATUS status, tGATTS_RSP *p_msg)
 {
     tGATT_STATUS cmd_sent = GATT_ILLEGAL_PARAMETER;
     tGATT_IF         gatt_if = GATT_GET_GATT_IF(conn_id);
-    UINT8           tcb_idx = GATT_GET_TCB_IDX(conn_id);
+    uint8_t         tcb_idx = GATT_GET_TCB_IDX(conn_id);
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
     tGATT_TCB       *p_tcb = gatt_get_tcb_by_idx(tcb_idx);
 
@@ -634,11 +634,11 @@
 ** Returns          GATT_SUCCESS if command started successfully.
 **
 *******************************************************************************/
-tGATT_STATUS GATTC_ConfigureMTU (UINT16 conn_id, UINT16 mtu)
+tGATT_STATUS GATTC_ConfigureMTU (uint16_t conn_id, uint16_t mtu)
 {
-    UINT8           ret = GATT_NO_RESOURCES;
+    uint8_t         ret = GATT_NO_RESOURCES;
     tGATT_IF        gatt_if=GATT_GET_GATT_IF(conn_id);
-    UINT8           tcb_idx = GATT_GET_TCB_IDX(conn_id);
+    uint8_t         tcb_idx = GATT_GET_TCB_IDX(conn_id);
     tGATT_TCB       *p_tcb = gatt_get_tcb_by_idx(tcb_idx);
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
 
@@ -687,13 +687,13 @@
 ** Returns          GATT_SUCCESS if command received/sent successfully.
 **
 *******************************************************************************/
-tGATT_STATUS GATTC_Discover (UINT16 conn_id, tGATT_DISC_TYPE disc_type,
+tGATT_STATUS GATTC_Discover (uint16_t conn_id, tGATT_DISC_TYPE disc_type,
                              tGATT_DISC_PARAM *p_param)
 {
     tGATT_STATUS    status = GATT_SUCCESS;
     tGATT_CLCB      *p_clcb;
     tGATT_IF        gatt_if=GATT_GET_GATT_IF(conn_id);
-    UINT8           tcb_idx = GATT_GET_TCB_IDX(conn_id);
+    uint8_t         tcb_idx = GATT_GET_TCB_IDX(conn_id);
     tGATT_TCB       *p_tcb = gatt_get_tcb_by_idx(tcb_idx);
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
 
@@ -756,12 +756,12 @@
 ** Returns          GATT_SUCCESS if command started successfully.
 **
 *******************************************************************************/
-tGATT_STATUS GATTC_Read (UINT16 conn_id, tGATT_READ_TYPE type, tGATT_READ_PARAM *p_read)
+tGATT_STATUS GATTC_Read (uint16_t conn_id, tGATT_READ_TYPE type, tGATT_READ_PARAM *p_read)
 {
     tGATT_STATUS status = GATT_SUCCESS;
     tGATT_CLCB          *p_clcb;
     tGATT_IF            gatt_if=GATT_GET_GATT_IF(conn_id);
-    UINT8               tcb_idx = GATT_GET_TCB_IDX(conn_id);
+    uint8_t             tcb_idx = GATT_GET_TCB_IDX(conn_id);
     tGATT_TCB           *p_tcb = gatt_get_tcb_by_idx(tcb_idx);
     tGATT_REG           *p_reg = gatt_get_regcb(gatt_if);
 
@@ -800,7 +800,7 @@
                 /* copy multiple handles in CB */
                 tGATT_READ_MULTI *p_read_multi =
                     (tGATT_READ_MULTI *)osi_malloc(sizeof(tGATT_READ_MULTI));
-                p_clcb->p_attr_buf = (UINT8*)p_read_multi;
+                p_clcb->p_attr_buf = (uint8_t*)p_read_multi;
                 memcpy(p_read_multi, &p_read->read_multiple, sizeof(tGATT_READ_MULTI));
             case GATT_READ_BY_HANDLE:
             case GATT_READ_PARTIAL:
@@ -817,7 +817,7 @@
                 break;
         }
         /* start security check */
-        if (gatt_security_check_start(p_clcb) == FALSE)
+        if (gatt_security_check_start(p_clcb) == false)
         {
             status = GATT_NO_RESOURCES;
             gatt_clcb_dealloc(p_clcb);
@@ -844,13 +844,13 @@
 ** Returns          GATT_SUCCESS if command started successfully.
 **
 *******************************************************************************/
-tGATT_STATUS GATTC_Write (UINT16 conn_id, tGATT_WRITE_TYPE type, tGATT_VALUE *p_write)
+tGATT_STATUS GATTC_Write (uint16_t conn_id, tGATT_WRITE_TYPE type, tGATT_VALUE *p_write)
 {
     tGATT_STATUS status = GATT_SUCCESS;
     tGATT_CLCB      *p_clcb;
     tGATT_VALUE     *p;
     tGATT_IF        gatt_if=GATT_GET_GATT_IF(conn_id);
-    UINT8           tcb_idx = GATT_GET_TCB_IDX(conn_id);
+    uint8_t         tcb_idx = GATT_GET_TCB_IDX(conn_id);
     tGATT_TCB       *p_tcb = gatt_get_tcb_by_idx(tcb_idx);
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
 
@@ -873,7 +873,7 @@
         p_clcb->op_subtype = type;
         p_clcb->auth_req = p_write->auth_req;
 
-        p_clcb->p_attr_buf = (UINT8 *)osi_malloc(sizeof(tGATT_VALUE));
+        p_clcb->p_attr_buf = (uint8_t *)osi_malloc(sizeof(tGATT_VALUE));
         memcpy(p_clcb->p_attr_buf, (void *)p_write, sizeof(tGATT_VALUE));
 
         p = (tGATT_VALUE *)p_clcb->p_attr_buf;
@@ -882,7 +882,7 @@
             p->offset = 0;
         }
 
-        if (gatt_security_check_start(p_clcb) == FALSE) {
+        if (gatt_security_check_start(p_clcb) == false) {
             status = GATT_NO_RESOURCES;
         }
 
@@ -908,13 +908,13 @@
 ** Returns          GATT_SUCCESS if command started successfully.
 **
 *******************************************************************************/
-tGATT_STATUS GATTC_ExecuteWrite (UINT16 conn_id, BOOLEAN is_execute)
+tGATT_STATUS GATTC_ExecuteWrite (uint16_t conn_id, bool    is_execute)
 {
     tGATT_STATUS status = GATT_SUCCESS;
     tGATT_CLCB      *p_clcb;
     tGATT_EXEC_FLAG flag;
     tGATT_IF        gatt_if=GATT_GET_GATT_IF(conn_id);
-    UINT8           tcb_idx = GATT_GET_TCB_IDX(conn_id);
+    uint8_t         tcb_idx = GATT_GET_TCB_IDX(conn_id);
     tGATT_TCB       *p_tcb = gatt_get_tcb_by_idx(tcb_idx);
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
 
@@ -959,7 +959,7 @@
 ** Returns          GATT_SUCCESS if command started successfully.
 **
 *******************************************************************************/
-tGATT_STATUS GATTC_SendHandleValueConfirm (UINT16 conn_id, UINT16 handle)
+tGATT_STATUS GATTC_SendHandleValueConfirm (uint16_t conn_id, uint16_t handle)
 {
     tGATT_STATUS    ret = GATT_ILLEGAL_PARAMETER;
     tGATT_TCB     *p_tcb=gatt_get_tcb_by_idx(GATT_GET_TCB_IDX(conn_id));
@@ -1011,10 +1011,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void GATT_SetIdleTimeout (BD_ADDR bd_addr, UINT16 idle_tout, tBT_TRANSPORT transport)
+void GATT_SetIdleTimeout (BD_ADDR bd_addr, uint16_t idle_tout, tBT_TRANSPORT transport)
 {
     tGATT_TCB       *p_tcb;
-    BOOLEAN         status = FALSE;
+    bool            status = false;
 
     if ((p_tcb = gatt_find_tcb_by_addr (bd_addr, transport)) != NULL)
     {
@@ -1028,7 +1028,7 @@
         }
         else
         {
-            status = L2CA_SetIdleTimeout (p_tcb->att_lcid, idle_tout, FALSE);
+            status = L2CA_SetIdleTimeout (p_tcb->att_lcid, idle_tout, false);
         }
     }
 
@@ -1053,7 +1053,7 @@
 tGATT_IF GATT_Register (tBT_UUID *p_app_uuid128, tGATT_CBACK *p_cb_info)
 {
     tGATT_REG    *p_reg;
-    UINT8        i_gatt_if=0;
+    uint8_t      i_gatt_if=0;
     tGATT_IF     gatt_if=0;
 
     GATT_TRACE_API("%s", __func__);
@@ -1078,7 +1078,7 @@
             gatt_if            =
             p_reg->gatt_if     = (tGATT_IF)i_gatt_if;
             p_reg->app_cb      = *p_cb_info;
-            p_reg->in_use      = TRUE;
+            p_reg->in_use      = true;
 
             GATT_TRACE_API("%s: allocated gatt_if=%d", __func__, gatt_if);
             return gatt_if;
@@ -1107,7 +1107,7 @@
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
     tGATT_TCB       *p_tcb;
     tGATT_CLCB       *p_clcb;
-    UINT8           i, ii, j;
+    uint8_t         i, ii, j;
     tGATT_SR_REG    *p_sreg;
 
     GATT_TRACE_API ("GATT_Deregister gatt_if=%d", gatt_if);
@@ -1142,7 +1142,7 @@
         {
             if (gatt_get_ch_state(p_tcb) != GATT_CH_CLOSE)
             {
-                gatt_update_app_use_link_flag(gatt_if, p_tcb,  FALSE, TRUE);
+                gatt_update_app_use_link_flag(gatt_if, p_tcb,  false, true);
             }
 
             for (j = 0, p_clcb= &gatt_cb.clcb[j]; j < GATT_CL_MAX_LCB; j++, p_clcb++)
@@ -1161,8 +1161,8 @@
 
     gatt_deregister_bgdev_list(gatt_if);
     /* update the listen mode */
-#if (defined(BLE_PERIPHERAL_MODE_SUPPORT) && (BLE_PERIPHERAL_MODE_SUPPORT == TRUE))
-    GATT_Listen(gatt_if, FALSE, NULL);
+#if (BLE_PERIPHERAL_MODE_SUPPORT == TRUE)
+    GATT_Listen(gatt_if, false, NULL);
 #endif
 
     memset (p_reg, 0, sizeof(tGATT_REG));
@@ -1187,8 +1187,8 @@
     tGATT_REG   *p_reg;
     tGATT_TCB   *p_tcb;
     BD_ADDR     bda;
-    UINT8       start_idx, found_idx;
-    UINT16      conn_id;
+    uint8_t     start_idx, found_idx;
+    uint16_t    conn_id;
     tGATT_TRANSPORT transport ;
 
     GATT_TRACE_API ("GATT_StartIf gatt_if=%d", gatt_if);
@@ -1201,7 +1201,7 @@
             if (p_reg->app_cb.p_conn_cb && p_tcb)
             {
                 conn_id = GATT_CREATE_CONN_ID(p_tcb->tcb_idx, gatt_if);
-                (*p_reg->app_cb.p_conn_cb)(gatt_if, bda, conn_id, TRUE, 0, transport);
+                (*p_reg->app_cb.p_conn_cb)(gatt_if, bda, conn_id, true, 0, transport);
             }
             start_idx = ++found_idx;
         }
@@ -1220,13 +1220,13 @@
 **                  bd_addr: peer device address.
 **                  is_direct: is a direct conenection or a background auto connection
 **
-** Returns          TRUE if connection started; FALSE if connection start failure.
+** Returns          true if connection started; false if connection start failure.
 **
 *******************************************************************************/
-BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct, tBT_TRANSPORT transport)
+bool    GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, bool    is_direct, tBT_TRANSPORT transport)
 {
     tGATT_REG    *p_reg;
-    BOOLEAN status = FALSE;
+    bool    status = false;
 
     GATT_TRACE_API ("GATT_Connect gatt_if=%d", gatt_if);
 
@@ -1234,7 +1234,7 @@
     if ((p_reg = gatt_get_regcb(gatt_if)) == NULL)
     {
         GATT_TRACE_ERROR("GATT_Connect - gatt_if =%d is not registered", gatt_if);
-        return(FALSE);
+        return(false);
     }
 
     if (is_direct)
@@ -1242,7 +1242,7 @@
     else
     {
         if (transport == BT_TRANSPORT_LE)
-        status = gatt_update_auto_connect_dev(gatt_if,TRUE, bd_addr, TRUE);
+        status = gatt_update_auto_connect_dev(gatt_if,true, bd_addr, true);
         else
         {
             GATT_TRACE_ERROR("Unsupported transport for background connection");
@@ -1264,22 +1264,22 @@
 **                          typically used for direct connection cancellation.
 **                  bd_addr: peer device address.
 **
-** Returns          TRUE if connection started; FALSE if connection start failure.
+** Returns          true if connection started; false if connection start failure.
 **
 *******************************************************************************/
-BOOLEAN GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct){
+bool    GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr, bool    is_direct){
     tGATT_REG     *p_reg;
     tGATT_TCB     *p_tcb;
-    BOOLEAN       status = TRUE;
+    bool          status = true;
     tGATT_IF      temp_gatt_if;
-    UINT8         start_idx, found_idx;
+    uint8_t       start_idx, found_idx;
 
     GATT_TRACE_API ("GATT_CancelConnect gatt_if=%d", gatt_if);
 
     if ((gatt_if != 0) && ((p_reg = gatt_get_regcb(gatt_if)) == NULL))
     {
         GATT_TRACE_ERROR("GATT_CancelConnect - gatt_if =%d is not registered", gatt_if);
-        return(FALSE);
+        return(false);
     }
 
     if (is_direct)
@@ -1301,7 +1301,7 @@
             else
             {
                 GATT_TRACE_ERROR("GATT_CancelConnect - no app found");
-                status = FALSE;
+                status = false;
             }
         }
         else
@@ -1321,7 +1321,7 @@
             else
             {
                 GATT_TRACE_ERROR("GATT_CancelConnect -no app associated with the bg device for unconditional removal");
-                status = FALSE;
+                status = false;
             }
         }
         else
@@ -1345,12 +1345,12 @@
 ** Returns          GATT_SUCCESS if disconnected.
 **
 *******************************************************************************/
-tGATT_STATUS GATT_Disconnect (UINT16 conn_id)
+tGATT_STATUS GATT_Disconnect (uint16_t conn_id)
 {
     tGATT_STATUS    ret = GATT_ILLEGAL_PARAMETER;
     tGATT_TCB       *p_tcb=NULL;
     tGATT_IF        gatt_if=GATT_GET_GATT_IF(conn_id);
-    UINT8          tcb_idx = GATT_GET_TCB_IDX(conn_id);
+    uint8_t        tcb_idx = GATT_GET_TCB_IDX(conn_id);
 
     GATT_TRACE_API ("GATT_Disconnect conn_id=%d ", conn_id);
 
@@ -1358,7 +1358,7 @@
 
     if (p_tcb)
     {
-        gatt_update_app_use_link_flag(gatt_if, p_tcb, FALSE, TRUE);
+        gatt_update_app_use_link_flag(gatt_if, p_tcb, false, true);
         ret = GATT_SUCCESS;
     }
     return ret;
@@ -1376,18 +1376,18 @@
 **                   p_gatt_if: applicaiton interface (output)
 **                   bd_addr: peer device address. (output)
 **
-** Returns          TRUE the ligical link information is found for conn_id
+** Returns          true the ligical link information is found for conn_id
 **
 *******************************************************************************/
-BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if, BD_ADDR bd_addr,
+bool    GATT_GetConnectionInfor(uint16_t conn_id, tGATT_IF *p_gatt_if, BD_ADDR bd_addr,
                                 tBT_TRANSPORT *p_transport)
 {
 
     tGATT_IF        gatt_if = GATT_GET_GATT_IF(conn_id);
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
-    UINT8           tcb_idx = GATT_GET_TCB_IDX(conn_id);
+    uint8_t         tcb_idx = GATT_GET_TCB_IDX(conn_id);
     tGATT_TCB       *p_tcb= gatt_get_tcb_by_idx(tcb_idx);
-    BOOLEAN         status=FALSE;
+    bool            status=false;
 
     GATT_TRACE_API ("GATT_GetConnectionInfor conn_id=%d", conn_id);
 
@@ -1396,7 +1396,7 @@
         memcpy(bd_addr, p_tcb->peer_bda, BD_ADDR_LEN);
         *p_gatt_if = gatt_if;
         *p_transport = p_tcb->transport;
-        status = TRUE;
+        status = true;
     }
     return status;
 }
@@ -1414,20 +1414,20 @@
 **                   p_conn_id: connection id  (output)
 **                   transport: transport option
 **
-** Returns          TRUE the logical link is connected
+** Returns          true the logical link is connected
 **
 *******************************************************************************/
-BOOLEAN GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr, UINT16 *p_conn_id,
+bool    GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr, uint16_t *p_conn_id,
                                   tBT_TRANSPORT transport)
 {
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
     tGATT_TCB       *p_tcb= gatt_find_tcb_by_addr(bd_addr, transport);
-    BOOLEAN         status=FALSE;
+    bool            status=false;
 
     if (p_reg && p_tcb && (gatt_get_ch_state(p_tcb) == GATT_CH_OPEN) )
     {
         *p_conn_id = GATT_CREATE_CONN_ID(p_tcb->tcb_idx, gatt_if);
-        status = TRUE;
+        status = true;
     }
 
     GATT_TRACE_API ("GATT_GetConnIdIfConnected status=%d", status);
@@ -1447,10 +1447,10 @@
 **                             listen to all device connection.
 **                  start: start or stop listening.
 **
-** Returns          TRUE if advertisement is started; FALSE if adv start failure.
+** Returns          true if advertisement is started; false if adv start failure.
 **
 *******************************************************************************/
-BOOLEAN GATT_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr)
+bool    GATT_Listen (tGATT_IF gatt_if, bool    start, BD_ADDR_PTR bd_addr)
 {
     tGATT_REG    *p_reg;
 
@@ -1460,12 +1460,12 @@
     if ((p_reg = gatt_get_regcb(gatt_if)) == NULL)
     {
         GATT_TRACE_ERROR("GATT_Listen - gatt_if =%d is not registered", gatt_if);
-        return(FALSE);
+        return(false);
     }
 
     if (bd_addr != NULL)
     {
-        gatt_update_auto_connect_dev(gatt_if,start, bd_addr, FALSE);
+        gatt_update_auto_connect_dev(gatt_if,start, bd_addr, false);
     }
     else
     {
diff --git a/stack/gatt/gatt_attr.c b/stack/gatt/gatt_attr.c
index e2d01a6..b485aee 100644
--- a/stack/gatt/gatt_attr.c
+++ b/stack/gatt/gatt_attr.c
@@ -30,7 +30,7 @@
 #include "gatt_int.h"
 #include "btcore/include/uuid.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
 #define GATTP_MAX_NUM_INC_SVR       0
 #define GATTP_MAX_CHAR_NUM          2
@@ -41,12 +41,12 @@
 #define GATTP_ATTR_DB_SIZE      GATT_DB_MEM_SIZE(GATTP_MAX_NUM_INC_SVR, GATTP_MAX_CHAR_NUM, GATTP_MAX_CHAR_VALUE_SIZE)
 #endif
 
-static void gatt_request_cback(UINT16 conn_id, UINT32 trans_id, UINT8 op_code, tGATTS_DATA *p_data);
-static void gatt_connect_cback(tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id, BOOLEAN connected,
+static void gatt_request_cback(uint16_t conn_id, uint32_t trans_id, uint8_t op_code, tGATTS_DATA *p_data);
+static void gatt_connect_cback(tGATT_IF gatt_if, BD_ADDR bda, uint16_t conn_id, bool    connected,
               tGATT_DISCONN_REASON reason, tBT_TRANSPORT transport);
-static void gatt_disc_res_cback(UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_DISC_RES *p_data);
-static void gatt_disc_cmpl_cback(UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_STATUS status);
-static void gatt_cl_op_cmpl_cback(UINT16 conn_id, tGATTC_OPTYPE op, tGATT_STATUS status,
+static void gatt_disc_res_cback(uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_DISC_RES *p_data);
+static void gatt_disc_cmpl_cback(uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_STATUS status);
+static void gatt_cl_op_cmpl_cback(uint16_t conn_id, tGATTC_OPTYPE op, tGATT_STATUS status,
               tGATT_CL_COMPLETE *p_data);
 
 static void gatt_cl_start_config_ccc(tGATT_PROFILE_CLCB *p_clcb);
@@ -72,9 +72,9 @@
 ** Returns          Connection ID
 **
 *******************************************************************************/
-UINT16 gatt_profile_find_conn_id_by_bd_addr(BD_ADDR remote_bda)
+uint16_t gatt_profile_find_conn_id_by_bd_addr(BD_ADDR remote_bda)
 {
-    UINT16 conn_id = GATT_INVALID_CONN_ID;
+    uint16_t conn_id = GATT_INVALID_CONN_ID;
     GATT_GetConnIdIfConnected (gatt_cb.gatt_if, remote_bda, &conn_id, BT_TRANSPORT_LE);
     return conn_id;
 }
@@ -88,9 +88,9 @@
 ** Returns          Pointer to the found link conenction control block.
 **
 *******************************************************************************/
-static tGATT_PROFILE_CLCB *gatt_profile_find_clcb_by_conn_id(UINT16 conn_id)
+static tGATT_PROFILE_CLCB *gatt_profile_find_clcb_by_conn_id(uint16_t conn_id)
 {
-    UINT8 i_clcb;
+    uint8_t i_clcb;
     tGATT_PROFILE_CLCB    *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= gatt_cb.profile_clcb; i_clcb < GATT_MAX_APPS; i_clcb++, p_clcb++)
@@ -113,7 +113,7 @@
 *******************************************************************************/
 static tGATT_PROFILE_CLCB *gatt_profile_find_clcb_by_bd_addr(BD_ADDR bda, tBT_TRANSPORT transport)
 {
-    UINT8 i_clcb;
+    uint8_t i_clcb;
     tGATT_PROFILE_CLCB    *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= gatt_cb.profile_clcb; i_clcb < GATT_MAX_APPS; i_clcb++, p_clcb++)
@@ -135,18 +135,18 @@
 ** Returns           NULL if not found. Otherwise pointer to the connection link block.
 **
 *******************************************************************************/
-tGATT_PROFILE_CLCB *gatt_profile_clcb_alloc (UINT16 conn_id, BD_ADDR bda, tBT_TRANSPORT tranport)
+tGATT_PROFILE_CLCB *gatt_profile_clcb_alloc (uint16_t conn_id, BD_ADDR bda, tBT_TRANSPORT tranport)
 {
-    UINT8                   i_clcb = 0;
+    uint8_t                 i_clcb = 0;
     tGATT_PROFILE_CLCB      *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= gatt_cb.profile_clcb; i_clcb < GATT_MAX_APPS; i_clcb++, p_clcb++)
     {
         if (!p_clcb->in_use)
         {
-            p_clcb->in_use      = TRUE;
+            p_clcb->in_use      = true;
             p_clcb->conn_id     = conn_id;
-            p_clcb->connected   = TRUE;
+            p_clcb->connected   = true;
             p_clcb->transport   = tranport;
             memcpy (p_clcb->bda, bda, BD_ADDR_LEN);
             break;
@@ -181,12 +181,12 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void gatt_request_cback (UINT16 conn_id, UINT32 trans_id, tGATTS_REQ_TYPE type,
+static void gatt_request_cback (uint16_t conn_id, uint32_t trans_id, tGATTS_REQ_TYPE type,
                                         tGATTS_DATA *p_data)
 {
-    UINT8       status = GATT_INVALID_PDU;
+    uint8_t     status = GATT_INVALID_PDU;
     tGATTS_RSP   rsp_msg ;
-    BOOLEAN     ignore = FALSE;
+    bool        ignore = false;
 
     memset(&rsp_msg, 0, sizeof(tGATTS_RSP));
 
@@ -204,13 +204,13 @@
 
         case GATTS_REQ_TYPE_WRITE_EXEC:
         case GATT_CMD_WRITE:
-            ignore = TRUE;
+            ignore = true;
             GATT_TRACE_EVENT("Ignore GATT_REQ_EXEC_WRITE/WRITE_CMD" );
             break;
 
         case GATTS_REQ_TYPE_MTU:
             GATT_TRACE_EVENT("Get MTU exchange new mtu size: %d", p_data->mtu);
-            ignore = TRUE;
+            ignore = true;
             break;
 
         default:
@@ -232,8 +232,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
-                                        BOOLEAN connected, tGATT_DISCONN_REASON reason,
+static void gatt_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, uint16_t conn_id,
+                                        bool    connected, tGATT_DISCONN_REASON reason,
                                         tBT_TRANSPORT transport)
 {
     UNUSED(gatt_if);
@@ -250,7 +250,7 @@
         if (p_clcb == NULL)
             return;
 
-        p_clcb->connected = TRUE;
+        p_clcb->connected = true;
         p_clcb->ccc_stage = GATT_SVC_CHANGED_SERVICE;
         gatt_cl_start_config_ccc(p_clcb);
     } else {
@@ -269,7 +269,7 @@
 void gatt_profile_db_init (void)
 {
     tBT_UUID          app_uuid = {LEN_UUID_128, {0}};
-    UINT16            service_handle = 0;
+    uint16_t          service_handle = 0;
 
     /* Fill our internal UUID with a fixed pattern 0x81 */
     memset (&app_uuid.uu.uuid128, 0x81, LEN_UUID_128);
@@ -307,7 +307,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_disc_res_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_DISC_RES *p_data)
+static void gatt_disc_res_cback (uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_DISC_RES *p_data)
 {
     tGATT_PROFILE_CLCB *p_clcb = gatt_profile_find_clcb_by_conn_id(conn_id);
 
@@ -345,7 +345,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_disc_cmpl_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_STATUS status)
+static void gatt_disc_cmpl_cback (uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_STATUS status)
 {
     tGATT_PROFILE_CLCB *p_clcb = gatt_profile_find_clcb_by_conn_id(conn_id);
 
@@ -371,7 +371,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_cl_op_cmpl_cback (UINT16 conn_id, tGATTC_OPTYPE op,
+static void gatt_cl_op_cmpl_cback (uint16_t conn_id, tGATTC_OPTYPE op,
                                    tGATT_STATUS status, tGATT_CL_COMPLETE *p_data)
 {
     UNUSED(conn_id);
@@ -394,7 +394,7 @@
     tGATT_DISC_PARAM    srvc_disc_param;
     tGATT_VALUE         ccc_value;
 
-    GATT_TRACE_DEBUG("%s() - stage: %d", __FUNCTION__, p_clcb->ccc_stage);
+    GATT_TRACE_DEBUG("%s() - stage: %d", __func__, p_clcb->ccc_stage);
 
     memset (&srvc_disc_param, 0 , sizeof(tGATT_DISC_PARAM));
     memset (&ccc_value, 0 , sizeof(tGATT_VALUE));
@@ -441,7 +441,7 @@
 ** Returns          none
 **
 *******************************************************************************/
-void GATT_ConfigServiceChangeCCC (BD_ADDR remote_bda, BOOLEAN enable, tBT_TRANSPORT transport)
+void GATT_ConfigServiceChangeCCC (BD_ADDR remote_bda, bool    enable, tBT_TRANSPORT transport)
 {
     tGATT_PROFILE_CLCB   *p_clcb = gatt_profile_find_clcb_by_bd_addr (remote_bda, transport);
 
@@ -453,10 +453,10 @@
 
     if (GATT_GetConnIdIfConnected (gatt_cb.gatt_if, remote_bda, &p_clcb->conn_id, transport))
     {
-        p_clcb->connected = TRUE;
+        p_clcb->connected = true;
     }
     /* hold the link here */
-    GATT_Connect(gatt_cb.gatt_if, remote_bda, TRUE, transport);
+    GATT_Connect(gatt_cb.gatt_if, remote_bda, true, transport);
     p_clcb->ccc_stage = GATT_SVC_CHANGED_CONNECTING;
 
     if (!p_clcb->connected)
diff --git a/stack/gatt/gatt_auth.c b/stack/gatt/gatt_auth.c
index 27dceb6..fb3d9b8 100644
--- a/stack/gatt/gatt_auth.c
+++ b/stack/gatt/gatt_auth.c
@@ -24,7 +24,7 @@
 #include "bt_target.h"
 #include "bt_utils.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 #include <string.h>
 #include "bt_common.h"
 
@@ -38,21 +38,21 @@
 **
 ** Description      This function sign the data for write command.
 **
-** Returns          TRUE if encrypted, otherwise FALSE.
+** Returns          true if encrypted, otherwise false.
 **
 *******************************************************************************/
-static BOOLEAN gatt_sign_data (tGATT_CLCB *p_clcb)
+static bool    gatt_sign_data (tGATT_CLCB *p_clcb)
 {
     tGATT_VALUE         *p_attr = (tGATT_VALUE *)p_clcb->p_attr_buf;
-    UINT8               *p_data = NULL, *p;
-    UINT16              payload_size = p_clcb->p_tcb->payload_size;
-    BOOLEAN             status = FALSE;
-    UINT8                *p_signature;
+    uint8_t             *p_data = NULL, *p;
+    uint16_t            payload_size = p_clcb->p_tcb->payload_size;
+    bool                status = false;
+    uint8_t              *p_signature;
 
     /* do not need to mark channel securoty activity for data signing */
     gatt_set_sec_act(p_clcb->p_tcb, GATT_SEC_OK);
 
-    p_data = (UINT8 *)osi_malloc(p_attr->len + 3); /* 3 = 2 byte handle + opcode */
+    p_data = (uint8_t *)osi_malloc(p_attr->len + 3); /* 3 = 2 byte handle + opcode */
 
     p = p_data;
     UINT8_TO_STREAM(p, GATT_SIGN_CMD_WRITE);
@@ -66,7 +66,7 @@
     p_signature = p_attr->value + p_attr->len;
     if (BTM_BleDataSignature(p_clcb->p_tcb->peer_bda,
                              p_data,
-                             (UINT16)(p_attr->len + 3), /* 3 = 2 byte handle + opcode */
+                             (uint16_t)(p_attr->len + 3), /* 3 = 2 byte handle + opcode */
                              p_signature)) {
         p_attr->len += BTM_BLE_AUTH_SIGN_LEN;
         gatt_set_ch_state(p_clcb->p_tcb, GATT_CH_OPEN);
@@ -92,10 +92,10 @@
 *******************************************************************************/
 void gatt_verify_signature(tGATT_TCB *p_tcb, BT_HDR *p_buf)
 {
-    UINT16  cmd_len;
-    UINT8   op_code;
-    UINT8   *p, *p_orig = (UINT8 *)(p_buf + 1) + p_buf->offset;
-    UINT32  counter;
+    uint16_t cmd_len;
+    uint8_t op_code;
+    uint8_t *p, *p_orig = (uint8_t *)(p_buf + 1) + p_buf->offset;
+    uint32_t counter;
 
     if (p_buf->len < GATT_AUTH_SIGN_LEN + 4) {
         GATT_TRACE_ERROR("%s: Data length %u less than expected %u",
@@ -109,7 +109,7 @@
     if (BTM_BleVerifySignature(p_tcb->peer_bda, p_orig, cmd_len, counter, p))
     {
         STREAM_TO_UINT8(op_code, p_orig);
-        gatt_server_handle_client_req (p_tcb, op_code, (UINT16)(p_buf->len - 1), p_orig);
+        gatt_server_handle_client_req (p_tcb, op_code, (uint16_t)(p_buf->len - 1), p_orig);
     }
     else
     {
@@ -128,7 +128,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void gatt_sec_check_complete(BOOLEAN sec_check_ok, tGATT_CLCB   *p_clcb, UINT8 sec_act)
+void gatt_sec_check_complete(bool    sec_check_ok, tGATT_CLCB   *p_clcb, uint8_t sec_act)
 {
     if (p_clcb && p_clcb->p_tcb &&
         fixed_queue_is_empty(p_clcb->p_tcb->pending_enc_clcb)) {
@@ -160,8 +160,8 @@
 void gatt_enc_cmpl_cback(BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, tBTM_STATUS result)
 {
     tGATT_TCB   *p_tcb;
-    UINT8       sec_flag;
-    BOOLEAN     status = FALSE;
+    uint8_t     sec_flag;
+    bool        status = false;
     UNUSED(p_ref_data);
 
     GATT_TRACE_DEBUG("gatt_enc_cmpl_cback");
@@ -182,12 +182,12 @@
 
                     if (sec_flag & BTM_SEC_FLAG_LKEY_AUTHED)
                     {
-                        status = TRUE;
+                        status = true;
                     }
                 }
                 else
                 {
-                    status = TRUE;
+                    status = true;
                 }
             }
             gatt_sec_check_complete(status, p_buf->p_clcb, p_tcb->sec_act);
@@ -230,7 +230,7 @@
 void gatt_notify_enc_cmpl(BD_ADDR bd_addr)
 {
     tGATT_TCB   *p_tcb;
-    UINT8        i = 0;
+    uint8_t      i = 0;
 
     if ((p_tcb = gatt_find_tcb_by_addr(bd_addr, BT_TRANSPORT_LE)) != NULL)
     {
@@ -314,13 +314,13 @@
 tGATT_SEC_ACTION gatt_determine_sec_act(tGATT_CLCB *p_clcb )
 {
     tGATT_SEC_ACTION    act = GATT_SEC_OK;
-    UINT8               sec_flag;
+    uint8_t             sec_flag;
     tGATT_TCB           *p_tcb = p_clcb->p_tcb;
     tGATT_AUTH_REQ      auth_req = p_clcb->auth_req;
-    BOOLEAN             is_link_encrypted= FALSE;
-    BOOLEAN             is_link_key_known=FALSE;
-    BOOLEAN             is_key_mitm=FALSE;
-    UINT8               key_type;
+    bool                is_link_encrypted= false;
+    bool                is_link_key_known=false;
+    bool                is_key_mitm=false;
+    uint8_t             key_type;
     tBTM_BLE_SEC_REQ_ACT    sec_act = BTM_LE_SEC_NONE;
 
     if (auth_req == GATT_AUTH_REQ_NONE )
@@ -338,12 +338,12 @@
     if (sec_flag & (BTM_SEC_FLAG_ENCRYPTED| BTM_SEC_FLAG_LKEY_KNOWN))
     {
         if (sec_flag & BTM_SEC_FLAG_ENCRYPTED)
-            is_link_encrypted = TRUE;
+            is_link_encrypted = true;
 
-        is_link_key_known = TRUE;
+        is_link_key_known = true;
 
         if (sec_flag & BTM_SEC_FLAG_LKEY_AUTHED)
-            is_key_mitm = TRUE;
+            is_key_mitm = true;
     }
 
     /* first check link key upgrade required or not */
@@ -418,7 +418,7 @@
 tGATT_STATUS gatt_get_link_encrypt_status(tGATT_TCB *p_tcb)
 {
     tGATT_STATUS    encrypt_status = GATT_NOT_ENCRYPTED;
-    UINT8           sec_flag=0;
+    uint8_t         sec_flag=0;
 
     BTM_GetSecurityFlagsByTransport(p_tcb->peer_bda, &sec_flag, p_tcb->transport);
 
@@ -440,12 +440,12 @@
 **
 ** Description      Convert GATT security action enum into equivalent BTM BLE security action enum
 **
-** Returns          BOOLEAN TRUE - conversation is successful
+** Returns          bool    true - conversation is successful
 **
 *******************************************************************************/
-static BOOLEAN gatt_convert_sec_action(tGATT_SEC_ACTION gatt_sec_act, tBTM_BLE_SEC_ACT *p_btm_sec_act )
+static bool    gatt_convert_sec_action(tGATT_SEC_ACTION gatt_sec_act, tBTM_BLE_SEC_ACT *p_btm_sec_act )
 {
-    BOOLEAN status = TRUE;
+    bool    status = true;
     switch (gatt_sec_act)
     {
         case GATT_SEC_ENCRYPT:
@@ -458,7 +458,7 @@
             *p_btm_sec_act = BTM_BLE_SEC_ENCRYPT_MITM;
             break;
         default:
-            status = FALSE;
+            status = false;
             break;
     }
 
@@ -470,15 +470,15 @@
 **
 ** Description      check link security.
 **
-** Returns          TRUE if encrypted, otherwise FALSE.
+** Returns          true if encrypted, otherwise false.
 **
 *******************************************************************************/
-BOOLEAN gatt_security_check_start(tGATT_CLCB *p_clcb)
+bool    gatt_security_check_start(tGATT_CLCB *p_clcb)
 {
     tGATT_TCB           *p_tcb = p_clcb->p_tcb;
     tGATT_SEC_ACTION    gatt_sec_act;
     tBTM_BLE_SEC_ACT    btm_ble_sec_act;
-    BOOLEAN             status = TRUE;
+    bool                status = true;
     tBTM_STATUS         btm_status;
     tGATT_SEC_ACTION    sec_act_old =  gatt_get_sec_act(p_tcb);
 
@@ -505,7 +505,7 @@
                 if ( (btm_status != BTM_SUCCESS) && (btm_status != BTM_CMD_STARTED))
                 {
                     GATT_TRACE_ERROR("gatt_security_check_start BTM_SetEncryption failed btm_status=%d", btm_status);
-                    status = FALSE;
+                    status = false;
                 }
             }
             if (status)
@@ -516,11 +516,11 @@
             /* wait for link encrypotion to finish */
             break;
         default:
-            gatt_sec_check_complete(TRUE, p_clcb, gatt_sec_act);
+            gatt_sec_check_complete(true, p_clcb, gatt_sec_act);
             break;
     }
 
-    if (status == FALSE)
+    if (status == false)
     {
         gatt_set_sec_act(p_tcb, GATT_SEC_NONE);
         gatt_set_ch_state(p_tcb, GATT_CH_OPEN);
diff --git a/stack/gatt/gatt_cl.c b/stack/gatt/gatt_cl.c
index 433a2f1..1c14747 100644
--- a/stack/gatt/gatt_cl.c
+++ b/stack/gatt/gatt_cl.c
@@ -24,7 +24,7 @@
 
 #include "bt_target.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
 #include <string.h>
 #include "bt_utils.h"
@@ -48,7 +48,7 @@
 *********************************************************************************/
 void gatt_send_prepare_write(tGATT_TCB  *p_tcb, tGATT_CLCB *p_clcb);
 
-UINT8   disc_type_to_att_opcode[GATT_DISC_MAX] =
+uint8_t disc_type_to_att_opcode[GATT_DISC_MAX] =
 {
     0,
     GATT_REQ_READ_BY_GRP_TYPE,     /*  GATT_DISC_SRVC_ALL = 1, */
@@ -58,7 +58,7 @@
     GATT_REQ_FIND_INFO             /*  GATT_DISC_CHAR_DSCPT,    */
 };
 
-UINT16 disc_type_to_uuid[GATT_DISC_MAX] =
+uint16_t disc_type_to_uuid[GATT_DISC_MAX] =
 {
     0,                  /* reserved */
     GATT_UUID_PRI_SERVICE, /* <service> DISC_SRVC_ALL */
@@ -80,7 +80,7 @@
 *******************************************************************************/
 void gatt_act_discovery(tGATT_CLCB *p_clcb)
 {
-    UINT8       op_code = disc_type_to_att_opcode[p_clcb->op_subtype];
+    uint8_t     op_code = disc_type_to_att_opcode[p_clcb->op_subtype];
     tGATT_CL_MSG   cl_req;
     tGATT_STATUS    st;
 
@@ -134,12 +134,12 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void gatt_act_read (tGATT_CLCB *p_clcb, UINT16 offset)
+void gatt_act_read (tGATT_CLCB *p_clcb, uint16_t offset)
 {
     tGATT_TCB  *p_tcb = p_clcb->p_tcb;
-    UINT8   rt = GATT_INTERNAL_ERROR;
+    uint8_t rt = GATT_INTERNAL_ERROR;
     tGATT_CL_MSG  msg;
-    UINT8        op_code = 0;
+    uint8_t      op_code = 0;
 
     memset (&msg, 0, sizeof(tGATT_CL_MSG));
 
@@ -169,9 +169,9 @@
             else
             {
                 if (!p_clcb->first_read_blob_after_read)
-                    p_clcb->first_read_blob_after_read = TRUE;
+                    p_clcb->first_read_blob_after_read = true;
                 else
-                    p_clcb->first_read_blob_after_read = FALSE;
+                    p_clcb->first_read_blob_after_read = false;
 
                 GATT_TRACE_DEBUG("gatt_act_read first_read_blob_after_read=%d",
                                   p_clcb->first_read_blob_after_read);
@@ -222,10 +222,10 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void gatt_act_write (tGATT_CLCB *p_clcb, UINT8 sec_act)
+void gatt_act_write (tGATT_CLCB *p_clcb, uint8_t sec_act)
 {
     tGATT_TCB           *p_tcb = p_clcb->p_tcb;
-    UINT8               rt = GATT_SUCCESS, op_code = 0;
+    uint8_t             rt = GATT_SUCCESS, op_code = 0;
     tGATT_VALUE         *p_attr = (tGATT_VALUE *)p_clcb->p_attr_buf;
 
     if (p_attr)
@@ -297,7 +297,7 @@
 *******************************************************************************/
 void gatt_send_queue_write_cancel (tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, tGATT_EXEC_FLAG flag)
 {
-    UINT8       rt ;
+    uint8_t     rt ;
 
     GATT_TRACE_DEBUG("gatt_send_queue_write_cancel ");
 
@@ -314,13 +314,13 @@
 **
 ** Description      To terminate write long or not.
 **
-** Returns          TRUE: write long is terminated; FALSE keep sending.
+** Returns          true: write long is terminated; false keep sending.
 **
 *******************************************************************************/
-BOOLEAN gatt_check_write_long_terminate(tGATT_TCB  *p_tcb, tGATT_CLCB *p_clcb, tGATT_VALUE *p_rsp_value)
+bool    gatt_check_write_long_terminate(tGATT_TCB  *p_tcb, tGATT_CLCB *p_clcb, tGATT_VALUE *p_rsp_value)
 {
     tGATT_VALUE         *p_attr = (tGATT_VALUE *)p_clcb->p_attr_buf;
-    BOOLEAN             exec = FALSE;
+    bool                exec = false;
     tGATT_EXEC_FLAG     flag = GATT_PREP_WRITE_EXEC;
 
     GATT_TRACE_DEBUG("gatt_check_write_long_terminate ");
@@ -334,22 +334,22 @@
             /* data does not match    */
             p_clcb->status = GATT_ERROR;
             flag = GATT_PREP_WRITE_CANCEL;
-            exec = TRUE;
+            exec = true;
         }
         else /* response checking is good */
         {
             p_clcb->status = GATT_SUCCESS;
             /* update write offset and check if end of attribute value */
             if ((p_attr->offset += p_rsp_value->len) >= p_attr->len)
-                exec = TRUE;
+                exec = true;
         }
     }
     if (exec)
     {
         gatt_send_queue_write_cancel (p_tcb, p_clcb, flag);
-        return TRUE;
+        return true;
     }
-    return FALSE;
+    return false;
 }
 /*******************************************************************************
 **
@@ -363,14 +363,14 @@
 void gatt_send_prepare_write(tGATT_TCB  *p_tcb, tGATT_CLCB *p_clcb)
 {
     tGATT_VALUE  *p_attr = (tGATT_VALUE *)p_clcb->p_attr_buf;
-    UINT16  to_send, offset;
-    UINT8   rt = GATT_SUCCESS;
-    UINT8   type = p_clcb->op_subtype;
+    uint16_t to_send, offset;
+    uint8_t rt = GATT_SUCCESS;
+    uint8_t type = p_clcb->op_subtype;
 
     GATT_TRACE_DEBUG("gatt_send_prepare_write type=0x%x", type );
     to_send = p_attr->len - p_attr->offset;
 
-    if (to_send > (p_tcb->payload_size - GATT_WRITE_LONG_HDR_SIZE)) /* 2 = UINT16 offset bytes  */
+    if (to_send > (p_tcb->payload_size - GATT_WRITE_LONG_HDR_SIZE)) /* 2 = uint16_t offset bytes  */
         to_send = p_tcb->payload_size - GATT_WRITE_LONG_HDR_SIZE;
 
     p_clcb->s_handle = p_attr->handle;
@@ -411,10 +411,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_process_find_type_value_rsp (tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, UINT16 len, UINT8 *p_data)
+void gatt_process_find_type_value_rsp (tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, uint16_t len, uint8_t *p_data)
 {
     tGATT_DISC_RES      result;
-    UINT8               *p = p_data;
+    uint8_t             *p = p_data;
 
     UNUSED(p_tcb);
 
@@ -456,11 +456,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_process_read_info_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, UINT8 op_code,
-                                UINT16 len, UINT8 *p_data)
+void gatt_process_read_info_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, uint8_t op_code,
+                                uint16_t len, uint8_t *p_data)
 {
     tGATT_DISC_RES  result;
-    UINT8   *p = p_data, uuid_len = 0, type;
+    uint8_t *p = p_data, uuid_len = 0, type;
 
     UNUSED(p_tcb);
     UNUSED(op_code);
@@ -515,8 +515,8 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void gatt_proc_disc_error_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, UINT8 opcode,
-                              UINT16 handle, UINT8 reason)
+void gatt_proc_disc_error_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, uint8_t opcode,
+                              uint16_t handle, uint8_t reason)
 {
     tGATT_STATUS    status = (tGATT_STATUS) reason;
 
@@ -555,11 +555,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_process_error_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, UINT8 op_code,
-                            UINT16 len, UINT8 *p_data)
+void gatt_process_error_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, uint8_t op_code,
+                            uint16_t len, uint8_t *p_data)
 {
-    UINT8   opcode, reason, * p= p_data;
-    UINT16  handle;
+    uint8_t opcode, reason, * p= p_data;
+    uint16_t handle;
     tGATT_VALUE  *p_attr = (tGATT_VALUE *)p_clcb->p_attr_buf;
 
     UNUSED(op_code);
@@ -608,10 +608,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_process_prep_write_rsp (tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, UINT8 op_code,
-                                  UINT16 len, UINT8 *p_data)
+void gatt_process_prep_write_rsp (tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, uint8_t op_code,
+                                  uint16_t len, uint8_t *p_data)
 {
-    UINT8 *p = p_data;
+    uint8_t *p = p_data;
 
     tGATT_VALUE value = {
         .conn_id = p_clcb->conn_id,
@@ -660,14 +660,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_process_notification(tGATT_TCB *p_tcb, UINT8 op_code,
-                               UINT16 len, UINT8 *p_data)
+void gatt_process_notification(tGATT_TCB *p_tcb, uint8_t op_code,
+                               uint16_t len, uint8_t *p_data)
 {
     tGATT_VALUE     value;
     tGATT_REG       *p_reg;
-    UINT16          conn_id;
+    uint16_t        conn_id;
     tGATT_STATUS    encrypt_status;
-    UINT8           *p= p_data, i,
+    uint8_t         *p= p_data, i,
     event = (op_code == GATT_HANDLE_VALUE_NOTIF) ? GATTC_OPTYPE_NOTIFICATION : GATTC_OPTYPE_INDICATION;
 
     GATT_TRACE_DEBUG("gatt_process_notification ");
@@ -747,13 +747,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_process_read_by_type_rsp (tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, UINT8 op_code,
-                                    UINT16 len, UINT8 *p_data)
+void gatt_process_read_by_type_rsp (tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, uint8_t op_code,
+                                    uint16_t len, uint8_t *p_data)
 {
     tGATT_DISC_RES      result;
     tGATT_DISC_VALUE    record_value;
-    UINT8               *p = p_data, value_len, handle_len = 2;
-    UINT16              handle = 0;
+    uint8_t             *p = p_data, value_len, handle_len = 2;
+    uint16_t            handle = 0;
 
     /* discovery procedure and no callback function registered */
     if (((!p_clcb->p_reg) || (!p_clcb->p_reg->app_cb.p_disc_res_cb)) && (p_clcb->operation == GATTC_OPTYPE_DISCOVERY))
@@ -844,7 +844,7 @@
             else if (value_len == 4)
             {
                 p_clcb->s_handle = record_value.incl_service.s_handle;
-                p_clcb->read_uuid128.wait_for_read_rsp = TRUE;
+                p_clcb->read_uuid128.wait_for_read_rsp = true;
                 p_clcb->read_uuid128.next_disc_start_hdl = handle + 1;
                 memcpy(&p_clcb->read_uuid128.result, &result, sizeof(result));
                 memcpy(&p_clcb->read_uuid128.result.value, &record_value, sizeof (result.value));
@@ -868,7 +868,7 @@
             {
                 p_clcb->op_subtype = GATT_READ_BY_HANDLE;
                 if (!p_clcb->p_attr_buf)
-                    p_clcb->p_attr_buf = (UINT8 *)osi_malloc(GATT_MAX_ATTR_LEN);
+                    p_clcb->p_attr_buf = (uint8_t *)osi_malloc(GATT_MAX_ATTR_LEN);
                 if (p_clcb->counter <= GATT_MAX_ATTR_LEN) {
                     memcpy(p_clcb->p_attr_buf, p, p_clcb->counter);
                     gatt_act_read(p_clcb, p_clcb->counter);
@@ -891,7 +891,7 @@
                 gatt_end_operation(p_clcb, GATT_INVALID_HANDLE, NULL);
                 return;
             }
-            if (!gatt_parse_uuid_from_cmd(&record_value.dclr_value.char_uuid, (UINT16)(value_len - 3), &p))
+            if (!gatt_parse_uuid_from_cmd(&record_value.dclr_value.char_uuid, (uint16_t)(value_len - 3), &p))
             {
                 gatt_end_operation(p_clcb, GATT_SUCCESS, NULL);
                 /* invalid format, and skip the result */
@@ -948,11 +948,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_process_read_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb,  UINT8 op_code,
-                           UINT16 len, UINT8 *p_data)
+void gatt_process_read_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb,  uint8_t op_code,
+                           uint16_t len, uint8_t *p_data)
 {
-    UINT16      offset = p_clcb->counter;
-    UINT8       * p= p_data;
+    uint16_t    offset = p_clcb->counter;
+    uint8_t     * p= p_data;
 
     UNUSED(op_code);
 
@@ -968,7 +968,7 @@
 
             /* allocate GKI buffer holding up long attribute value  */
             if (!p_clcb->p_attr_buf)
-                p_clcb->p_attr_buf = (UINT8 *)osi_malloc(GATT_MAX_ATTR_LEN);
+                p_clcb->p_attr_buf = (uint8_t *)osi_malloc(GATT_MAX_ATTR_LEN);
 
             /* copy attrobute value into cb buffer  */
             if (offset < GATT_MAX_ATTR_LEN) {
@@ -1007,7 +1007,7 @@
             p_clcb->read_uuid128.wait_for_read_rsp )
         {
             p_clcb->s_handle = p_clcb->read_uuid128.next_disc_start_hdl;
-            p_clcb->read_uuid128.wait_for_read_rsp = FALSE;
+            p_clcb->read_uuid128.wait_for_read_rsp = false;
             if (len == LEN_UUID_128)
             {
 
@@ -1051,9 +1051,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_process_mtu_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, UINT16 len, UINT8 *p_data)
+void gatt_process_mtu_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, uint16_t len, uint8_t *p_data)
 {
-    UINT16 mtu;
+    uint16_t mtu;
     tGATT_STATUS    status = GATT_SUCCESS;
 
     if (len < GATT_MTU_RSP_MIN_LEN)
@@ -1082,9 +1082,9 @@
 ** Returns          response code.
 **
 *******************************************************************************/
-UINT8 gatt_cmd_to_rsp_code (UINT8 cmd_code)
+uint8_t gatt_cmd_to_rsp_code (uint8_t cmd_code)
 {
-    UINT8   rsp_code  = 0;
+    uint8_t rsp_code  = 0;
 
     if (cmd_code > 1 && cmd_code != GATT_CMD_WRITE)
     {
@@ -1098,14 +1098,14 @@
 **
 ** Description      Find next command in queue and sent to server
 **
-** Returns          TRUE if command sent, otherwise FALSE.
+** Returns          true if command sent, otherwise false.
 **
 *******************************************************************************/
-BOOLEAN gatt_cl_send_next_cmd_inq(tGATT_TCB *p_tcb)
+bool    gatt_cl_send_next_cmd_inq(tGATT_TCB *p_tcb)
 {
     tGATT_CMD_Q  *p_cmd = &p_tcb->cl_cmd_q[p_tcb->pending_cl_req];
-    BOOLEAN     sent = FALSE;
-    UINT8       rsp_code;
+    bool        sent = false;
+    uint8_t     rsp_code;
     tGATT_CLCB   *p_clcb = NULL;
     tGATT_STATUS att_ret = GATT_SUCCESS;
 
@@ -1117,8 +1117,8 @@
 
         if (att_ret == GATT_SUCCESS || att_ret == GATT_CONGESTED)
         {
-            sent = TRUE;
-            p_cmd->to_send = FALSE;
+            sent = true;
+            p_cmd->to_send = false;
             p_cmd->p_cmd = NULL;
 
             /* dequeue the request if is write command or sign write */
@@ -1132,7 +1132,7 @@
 
                 /* if no ack needed, keep sending */
                 if (att_ret == GATT_SUCCESS)
-                    sent = FALSE;
+                    sent = false;
 
                 p_cmd = &p_tcb->cl_cmd_q[p_tcb->pending_cl_req];
                 /* send command complete callback here */
@@ -1163,11 +1163,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_client_handle_server_rsp (tGATT_TCB *p_tcb, UINT8 op_code,
-                                    UINT16 len, UINT8 *p_data)
+void gatt_client_handle_server_rsp (tGATT_TCB *p_tcb, uint8_t op_code,
+                                    uint16_t len, uint8_t *p_data)
 {
     tGATT_CLCB   *p_clcb = NULL;
-    UINT8        rsp_code;
+    uint8_t      rsp_code;
 
     if (op_code != GATT_HANDLE_VALUE_IND && op_code != GATT_HANDLE_VALUE_NOTIF)
     {
diff --git a/stack/gatt/gatt_db.c b/stack/gatt/gatt_db.c
index 5f8c406..6f58c0f 100644
--- a/stack/gatt/gatt_db.c
+++ b/stack/gatt/gatt_db.c
@@ -24,7 +24,7 @@
 
 #include "bt_target.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
 #include "bt_trace.h"
 #include "bt_utils.h"
@@ -38,14 +38,14 @@
 /********************************************************************************
 **              L O C A L    F U N C T I O N     P R O T O T Y P E S            *
 *********************************************************************************/
-static BOOLEAN allocate_svc_db_buf(tGATT_SVC_DB *p_db);
+static bool allocate_svc_db_buf(tGATT_SVC_DB *p_db);
 static void *allocate_attr_in_db(tGATT_SVC_DB *p_db, tBT_UUID *p_uuid, tGATT_PERM perm);
-static BOOLEAN deallocate_attr_in_db(tGATT_SVC_DB *p_db, void *p_attr);
-static BOOLEAN copy_extra_byte_in_db(tGATT_SVC_DB *p_db, void **p_dst, UINT16 len);
+static bool deallocate_attr_in_db(tGATT_SVC_DB *p_db, void *p_attr);
+static bool copy_extra_byte_in_db(tGATT_SVC_DB *p_db, void **p_dst, uint16_t len);
 
-static BOOLEAN gatts_db_add_service_declaration(tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN is_pri);
-static tGATT_STATUS gatts_send_app_read_request(tGATT_TCB *p_tcb, UINT8 op_code,
-                                                UINT16 handle, UINT16 offset, UINT32 trans_id,
+static bool gatts_db_add_service_declaration(tGATT_SVC_DB *p_db, tBT_UUID *p_service, bool is_pri);
+static tGATT_STATUS gatts_send_app_read_request(tGATT_TCB *p_tcb, uint8_t op_code,
+                                                uint16_t handle, uint16_t offset, uint32_t trans_id,
                                                 bt_gatt_db_attribute_type_t gatt_type);
 
 /*******************************************************************************
@@ -60,15 +60,15 @@
 ** Returns          Status of te operation.
 **
 *******************************************************************************/
-BOOLEAN gatts_init_service_db (tGATT_SVC_DB *p_db, tBT_UUID *p_service,  BOOLEAN is_pri,
-                               UINT16 s_hdl, UINT16 num_handle)
+bool    gatts_init_service_db (tGATT_SVC_DB *p_db, tBT_UUID *p_service,  bool    is_pri,
+                               uint16_t s_hdl, uint16_t num_handle)
 {
     p_db->svc_buffer = fixed_queue_new(SIZE_MAX);
 
     if (!allocate_svc_db_buf(p_db))
     {
         GATT_TRACE_ERROR("gatts_init_service_db failed, no resources");
-        return FALSE;
+        return false;
     }
 
     GATT_TRACE_DEBUG("gatts_init_service_db");
@@ -117,12 +117,12 @@
 **
 *******************************************************************************/
 static tGATT_STATUS gatts_check_attr_readability(tGATT_ATTR *p_attr,
-                                                 UINT16 offset,
-                                                 BOOLEAN read_long,
+                                                 uint16_t offset,
+                                                 bool    read_long,
                                                  tGATT_SEC_FLAG sec_flag,
-                                                 UINT8 key_size)
+                                                 uint8_t key_size)
 {
-    UINT16          min_key_size;
+    uint16_t        min_key_size;
     tGATT_PERM      perm = p_attr->permission;
 
     UNUSED(offset);
@@ -206,16 +206,16 @@
 **
 *******************************************************************************/
 static tGATT_STATUS read_attr_value (void *p_attr,
-                                     UINT16 offset,
-                                     UINT8 **p_data,
-                                     BOOLEAN read_long,
-                                     UINT16 mtu,
-                                     UINT16 *p_len,
+                                     uint16_t offset,
+                                     uint8_t **p_data,
+                                     bool    read_long,
+                                     uint16_t mtu,
+                                     uint16_t *p_len,
                                      tGATT_SEC_FLAG sec_flag,
-                                     UINT8 key_size)
+                                     uint8_t key_size)
 {
-    UINT16          len = 0, uuid16 = 0;
-    UINT8           *p = *p_data;
+    uint16_t        len = 0, uuid16 = 0;
+    uint8_t         *p = *p_data;
     tGATT_STATUS    status;
     tGATT_ATTR    *p_attr16  = (tGATT_ATTR  *)p_attr;
 
@@ -321,21 +321,21 @@
 *******************************************************************************/
 tGATT_STATUS gatts_db_read_attr_value_by_type (tGATT_TCB   *p_tcb,
                                                tGATT_SVC_DB    *p_db,
-                                               UINT8        op_code,
+                                               uint8_t      op_code,
                                                BT_HDR      *p_rsp,
-                                               UINT16       s_handle,
-                                               UINT16       e_handle,
+                                               uint16_t     s_handle,
+                                               uint16_t     e_handle,
                                                tBT_UUID     type,
-                                               UINT16      *p_len,
+                                               uint16_t    *p_len,
                                                tGATT_SEC_FLAG sec_flag,
-                                               UINT8        key_size,
-                                               UINT32       trans_id,
-                                               UINT16       *p_cur_handle)
+                                               uint8_t      key_size,
+                                               uint32_t     trans_id,
+                                               uint16_t     *p_cur_handle)
 {
     tGATT_STATUS status = GATT_NOT_FOUND;
     tGATT_ATTR  *p_attr;
-    UINT16      len = 0;
-    UINT8       *p = (UINT8 *)(p_rsp + 1) + p_rsp->len + L2CAP_MIN_OFFSET;
+    uint16_t    len = 0;
+    uint8_t     *p = (uint8_t *)(p_rsp + 1) + p_rsp->len + L2CAP_MIN_OFFSET;
     tBT_UUID    attr_uuid;
 
     if (p_db && p_db->p_attr_list)
@@ -356,7 +356,7 @@
 
                 UINT16_TO_STREAM (p, p_attr->handle);
 
-                status = read_attr_value ((void *)p_attr, 0, &p, FALSE, (UINT16)(*p_len -2), &len, sec_flag, key_size);
+                status = read_attr_value ((void *)p_attr, 0, &p, false, (uint16_t)(*p_len -2), &len, sec_flag, key_size);
 
                 if (status == GATT_PENDING)
                 {
@@ -393,8 +393,8 @@
         }
     }
 
-#if (defined(BLE_DELAY_REQUEST_ENC) && (BLE_DELAY_REQUEST_ENC == TRUE))
-    UINT8 flag = 0;
+#if (BLE_DELAY_REQUEST_ENC == TRUE)
+    uint8_t flag = 0;
     if (BTM_GetSecurityFlags(p_tcb->peer_bda, &flag))
     {
         if ((p_tcb->att_lcid == L2CAP_ATT_CID) && (status == GATT_PENDING) &&
@@ -425,7 +425,7 @@
 ** Returns          Status of the operation.
 **
 *******************************************************************************/
-UINT16 gatts_add_included_service (tGATT_SVC_DB *p_db, UINT16 s_handle, UINT16 e_handle,
+uint16_t gatts_add_included_service (tGATT_SVC_DB *p_db, uint16_t s_handle, uint16_t e_handle,
                                    tBT_UUID service)
 {
     tGATT_ATTR      *p_attr;
@@ -474,7 +474,7 @@
 ** Returns          Status of te operation.
 **
 *******************************************************************************/
-UINT16 gatts_add_characteristic (tGATT_SVC_DB *p_db, tGATT_PERM perm,
+uint16_t gatts_add_characteristic (tGATT_SVC_DB *p_db, tGATT_PERM perm,
                                  tGATT_CHAR_PROP property,
                                  tBT_UUID * p_char_uuid)
 {
@@ -520,7 +520,7 @@
 ** Returns          descriptor type.
 **
 *******************************************************************************/
-UINT8 gatt_convertchar_descr_type(tBT_UUID *p_descr_uuid)
+uint8_t gatt_convertchar_descr_type(tBT_UUID *p_descr_uuid)
 {
     tBT_UUID std_descr = {LEN_UUID_16, {GATT_UUID_CHAR_EXT_PROP}};
 
@@ -569,7 +569,7 @@
 ** Returns          Status of the operation.
 **
 *******************************************************************************/
-UINT16 gatts_add_char_descr (tGATT_SVC_DB *p_db, tGATT_PERM perm,
+uint16_t gatts_add_char_descr (tGATT_SVC_DB *p_db, tGATT_PERM perm,
                              tBT_UUID *     p_descr_uuid)
 {
     tGATT_ATTR    *p_char_dscptr;
@@ -616,17 +616,17 @@
 *******************************************************************************/
 tGATT_STATUS gatts_read_attr_value_by_handle(tGATT_TCB *p_tcb,
                                              tGATT_SVC_DB *p_db,
-                                             UINT8 op_code,
-                                             UINT16 handle, UINT16 offset,
-                                             UINT8 *p_value, UINT16 *p_len,
-                                             UINT16 mtu,
+                                             uint8_t op_code,
+                                             uint16_t handle, uint16_t offset,
+                                             uint8_t *p_value, uint16_t *p_len,
+                                             uint16_t mtu,
                                              tGATT_SEC_FLAG sec_flag,
-                                             UINT8 key_size,
-                                             UINT32 trans_id)
+                                             uint8_t key_size,
+                                             uint32_t trans_id)
 {
     tGATT_STATUS status = GATT_NOT_FOUND;
     tGATT_ATTR  *p_attr;
-    UINT8       *pp = p_value;
+    uint8_t     *pp = p_value;
 
     if (p_db && p_db->p_attr_list)
     {
@@ -637,7 +637,7 @@
             if (p_attr->handle == handle)
             {
                 status = read_attr_value (p_attr, offset, &pp,
-                                          (BOOLEAN)(op_code == GATT_REQ_READ_BLOB),
+                                          (bool   )(op_code == GATT_REQ_READ_BLOB),
                                           mtu, p_len, sec_flag, key_size);
 
                 if (status == GATT_PENDING)
@@ -674,10 +674,10 @@
 **
 *******************************************************************************/
 tGATT_STATUS gatts_read_attr_perm_check(tGATT_SVC_DB *p_db,
-                                        BOOLEAN is_long,
-                                        UINT16 handle,
+                                        bool    is_long,
+                                        uint16_t handle,
                                         tGATT_SEC_FLAG sec_flag,
-                                        UINT8 key_size)
+                                        uint8_t key_size)
 {
     tGATT_STATUS status = GATT_NOT_FOUND;
     tGATT_ATTR  *p_attr;
@@ -719,15 +719,15 @@
 ** Returns          Status of the operation.
 **
 *******************************************************************************/
-tGATT_STATUS gatts_write_attr_perm_check (tGATT_SVC_DB *p_db, UINT8 op_code,
-                                          UINT16 handle, UINT16 offset, UINT8 *p_data,
-                                          UINT16 len, tGATT_SEC_FLAG sec_flag, UINT8 key_size)
+tGATT_STATUS gatts_write_attr_perm_check (tGATT_SVC_DB *p_db, uint8_t op_code,
+                                          uint16_t handle, uint16_t offset, uint8_t *p_data,
+                                          uint16_t len, tGATT_SEC_FLAG sec_flag, uint8_t key_size)
 {
     tGATT_STATUS    status = GATT_NOT_FOUND;
     tGATT_ATTR    *p_attr;
-    UINT16          max_size = 0;
+    uint16_t        max_size = 0;
     tGATT_PERM      perm;
-    UINT16          min_key_size;
+    uint16_t        min_key_size;
 
     GATT_TRACE_DEBUG( "%s: op_code=0x%0x handle=0x%04x offset=%d len=%d sec_flag=0x%0x key_size=%d",
                        __func__, op_code, handle, offset, len, sec_flag, key_size);
@@ -935,7 +935,7 @@
         return NULL;
     }
 
-    UINT16 len = sizeof(tGATT_ATTR);
+    uint16_t len = sizeof(tGATT_ATTR);
     if (p_db->mem_free < len) {
         if (!allocate_svc_db_buf(p_db)) {
             GATT_TRACE_ERROR("allocate_attr_in_db failed, no resources");
@@ -983,13 +983,13 @@
 ** Parameter        p_db: database pointer.
 **                  p_attr: pointer to the attribute record to be freed.
 **
-** Returns          BOOLEAN: success
+** Returns          bool   : success
 **
 *******************************************************************************/
-static BOOLEAN deallocate_attr_in_db(tGATT_SVC_DB *p_db, void *p_attr)
+static bool    deallocate_attr_in_db(tGATT_SVC_DB *p_db, void *p_attr)
 {
     tGATT_ATTR  *p_cur, *p_next;
-    BOOLEAN     found = FALSE;
+    bool        found = false;
 
     if (p_db->p_attr_list == NULL)
         return found;
@@ -1003,13 +1003,13 @@
         if (p_next == p_attr)
         {
             p_cur->p_next = p_next->p_next;
-            found = TRUE;
+            found = true;
         }
     }
     if (p_cur == p_attr && p_cur == p_db->p_attr_list)
     {
         p_db->p_attr_list = p_cur->p_next;
-        found = TRUE;
+        found = true;
     }
     /* else attr not found */
     if ( found)
@@ -1034,16 +1034,16 @@
 ** Returns          None.
 **
 *******************************************************************************/
-static BOOLEAN copy_extra_byte_in_db(tGATT_SVC_DB *p_db, void **p_dst, UINT16 len)
+static bool    copy_extra_byte_in_db(tGATT_SVC_DB *p_db, void **p_dst, uint16_t len)
 {
-    UINT8 *p = (UINT8 *)*p_dst;
+    uint8_t *p = (uint8_t *)*p_dst;
 
     if (p_db->mem_free < len)
     {
         if (!allocate_svc_db_buf(p_db))
         {
             GATT_TRACE_ERROR("copy_extra_byte_in_db failed, no resources");
-            return FALSE;
+            return false;
         }
     }
 
@@ -1053,7 +1053,7 @@
     memset((void *)p, 0, len);
     *p_dst = (void *)p;
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -1062,21 +1062,21 @@
 **
 ** Description      Utility function to allocate extra buffer for service database.
 **
-** Returns          TRUE if allocation succeed, otherwise FALSE.
+** Returns          true if allocation succeed, otherwise false.
 **
 *******************************************************************************/
-static BOOLEAN allocate_svc_db_buf(tGATT_SVC_DB *p_db)
+static bool    allocate_svc_db_buf(tGATT_SVC_DB *p_db)
 {
     BT_HDR *p_buf = (BT_HDR *)osi_calloc(GATT_DB_BUF_SIZE);
 
     GATT_TRACE_DEBUG("%s allocating extra buffer", __func__);
 
-    p_db->p_free_mem = (UINT8 *) p_buf;
+    p_db->p_free_mem = (uint8_t *) p_buf;
     p_db->mem_free = GATT_DB_BUF_SIZE;
 
     fixed_queue_enqueue(p_db->svc_buffer, p_buf);
 
-    return TRUE;
+    return true;
 
 }
 
@@ -1089,14 +1089,14 @@
 ** Returns          status of operation.
 **
 *******************************************************************************/
-static tGATT_STATUS gatts_send_app_read_request(tGATT_TCB *p_tcb, UINT8 op_code,
-                                                UINT16 handle, UINT16 offset, UINT32 trans_id,
+static tGATT_STATUS gatts_send_app_read_request(tGATT_TCB *p_tcb, uint8_t op_code,
+                                                uint16_t handle, uint16_t offset, uint32_t trans_id,
                                                 bt_gatt_db_attribute_type_t gatt_type)
 {
     tGATTS_DATA   sr_data;
-    UINT8       i_rcb;
+    uint8_t     i_rcb;
     tGATT_SR_REG *p_sreg;
-    UINT16   conn_id;
+    uint16_t conn_id;
 
     i_rcb = gatt_sr_find_i_rcb_by_handle(handle);
     p_sreg = &gatt_cb.sr_reg[i_rcb];
@@ -1105,7 +1105,7 @@
     if (trans_id == 0)
     {
         trans_id = gatt_sr_enqueue_cmd(p_tcb, op_code, handle);
-        gatt_sr_update_cback_cnt(p_tcb, p_sreg->gatt_if, TRUE, TRUE);
+        gatt_sr_update_cback_cnt(p_tcb, p_sreg->gatt_if, true, true);
     }
 
     if (trans_id != 0 )
@@ -1113,10 +1113,10 @@
         memset(&sr_data, 0, sizeof(tGATTS_DATA));
 
         sr_data.read_req.handle = handle;
-        sr_data.read_req.is_long = (BOOLEAN)(op_code == GATT_REQ_READ_BLOB);
+        sr_data.read_req.is_long = (bool)(op_code == GATT_REQ_READ_BLOB);
         sr_data.read_req.offset = offset;
 
-        UINT8 opcode;
+        uint8_t opcode;
         if (gatt_type == BTGATT_DB_DESCRIPTOR) {
             opcode = GATTS_REQ_TYPE_READ_DESCRIPTOR;
         } else if (gatt_type == BTGATT_DB_CHARACTERISTIC) {
@@ -1148,11 +1148,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static BOOLEAN gatts_db_add_service_declaration(tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN is_pri)
+static bool gatts_db_add_service_declaration(tGATT_SVC_DB *p_db, tBT_UUID *p_service, bool is_pri)
 {
     tGATT_ATTR  *p_attr;
     tBT_UUID    uuid = {LEN_UUID_16, {0}};
-    BOOLEAN     rt = FALSE;
+    bool        rt = false;
 
     GATT_TRACE_DEBUG( "add_service_declaration");
 
@@ -1181,7 +1181,7 @@
                 p_attr->p_value->uuid.len = LEN_UUID_128;
                 memcpy(p_attr->p_value->uuid.uu.uuid128, p_service->uu.uuid128, LEN_UUID_128);
             }
-            rt = TRUE;
+            rt = true;
         }
 
     }
diff --git a/stack/gatt/gatt_int.h b/stack/gatt/gatt_int.h
index cc9568a..4b06c49 100644
--- a/stack/gatt/gatt_int.h
+++ b/stack/gatt/gatt_int.h
@@ -33,11 +33,11 @@
 extern "C" {
 #endif
 
-#define GATT_CREATE_CONN_ID(tcb_idx, gatt_if)  ((UINT16) ((((UINT8)(tcb_idx) ) << 8) | ((UINT8) (gatt_if))))
-#define GATT_GET_TCB_IDX(conn_id)  ((UINT8) (((UINT16) (conn_id)) >> 8))
-#define GATT_GET_GATT_IF(conn_id)  ((tGATT_IF)((UINT8) (conn_id)))
+#define GATT_CREATE_CONN_ID(tcb_idx, gatt_if)  ((uint16_t) ((((uint8_t)(tcb_idx) ) << 8) | ((uint8_t) (gatt_if))))
+#define GATT_GET_TCB_IDX(conn_id)  ((uint8_t) (((uint16_t) (conn_id)) >> 8))
+#define GATT_GET_GATT_IF(conn_id)  ((tGATT_IF)((uint8_t) (conn_id)))
 
-#define GATT_GET_SR_REG_PTR(index) (&gatt_cb.sr_reg[(UINT8) (index)]);
+#define GATT_GET_SR_REG_PTR(index) (&gatt_cb.sr_reg[(uint8_t) (index)]);
 #define GATT_TRANS_ID_MAX                   0x0fffffff      /* 4 MSB is reserved */
 
 /* security action for GATT write and read request */
@@ -48,7 +48,7 @@
 #define GATT_SEC_ENCRYPT_NO_MITM   4    /* unauthenticated encryption or better */
 #define GATT_SEC_ENCRYPT_MITM      5    /* authenticated encryption */
 #define GATT_SEC_ENC_PENDING       6   /* wait for link encryption pending */
-typedef UINT8 tGATT_SEC_ACTION;
+typedef uint8_t tGATT_SEC_ACTION;
 
 
 #define GATT_ATTR_OP_SPT_MTU               (0x00000001 << 0)
@@ -95,7 +95,7 @@
 #define GATT_SEC_FLAG_LKEY_UNAUTHED     BTM_SEC_FLAG_LKEY_KNOWN
 #define GATT_SEC_FLAG_LKEY_AUTHED       BTM_SEC_FLAG_LKEY_AUTHED
 #define GATT_SEC_FLAG_ENCRYPTED         BTM_SEC_FLAG_ENCRYPTED
-typedef UINT8 tGATT_SEC_FLAG;
+typedef uint8_t tGATT_SEC_FLAG;
 
 /* Find Information Response Type
 */
@@ -106,10 +106,10 @@
 typedef struct
 {
     tBT_UUID        uuid;           /* type of attribute to be found */
-    UINT16          s_handle;       /* starting handle */
-    UINT16          e_handle;       /* ending handle */
-    UINT16          value_len;      /* length of the attribute value */
-    UINT8           value[GATT_MAX_MTU_SIZE];       /* pointer to the attribute value to be found */
+    uint16_t        s_handle;       /* starting handle */
+    uint16_t        e_handle;       /* ending handle */
+    uint16_t        value_len;      /* length of the attribute value */
+    uint8_t         value[GATT_MAX_MTU_SIZE];       /* pointer to the attribute value to be found */
 } tGATT_FIND_TYPE_VALUE;
 
 /* client request message to ATT protocol
@@ -123,17 +123,17 @@
     tGATT_VALUE             attr_value;   /* write request */
                                           /* prepare write */
     /* write blob */
-    UINT16                  handle;        /* read,  handle value confirmation */
-    UINT16                  mtu;
+    uint16_t                handle;        /* read,  handle value confirmation */
+    uint16_t                mtu;
     tGATT_EXEC_FLAG         exec_write;    /* execute write */
 }tGATT_CL_MSG;
 
 /* error response strucutre */
 typedef struct
 {
-    UINT16  handle;
-    UINT8   cmd_code;
-    UINT8   reason;
+    uint16_t handle;
+    uint8_t cmd_code;
+    uint8_t reason;
 }tGATT_ERROR;
 
 /* server response message to ATT protocol
@@ -144,8 +144,8 @@
     tGATT_VALUE             attr_value;     /* READ, HANDLE_VALUE_IND, PREPARE_WRITE */
                                             /* READ_BLOB, READ_BY_TYPE */
     tGATT_ERROR             error;          /* ERROR_RSP */
-    UINT16                  handle;         /* WRITE, WRITE_BLOB */
-    UINT16                  mtu;            /* exchange MTU request */
+    uint16_t                handle;         /* WRITE, WRITE_BLOB */
+    uint16_t                mtu;            /* exchange MTU request */
 } tGATT_SR_MSG;
 
 /* Characteristic declaration attribute value
@@ -153,7 +153,7 @@
 typedef struct
 {
     tGATT_CHAR_PROP             property;
-    UINT16                      char_val_handle;
+    uint16_t                    char_val_handle;
 } tGATT_CHAR_DECL;
 
 /* attribute value maintained in the server database
@@ -171,7 +171,7 @@
 #define GATT_ATTR_UUID_TYPE_16      0
 #define GATT_ATTR_UUID_TYPE_128     1
 #define GATT_ATTR_UUID_TYPE_32      2
-typedef UINT8   tGATT_ATTR_UUID_TYPE;
+typedef uint8_t tGATT_ATTR_UUID_TYPE;
 
 /* 16 bits UUID Attribute in server database
 */
@@ -181,7 +181,7 @@
                                                     either tGATT_ATTR16 or tGATT_ATTR128 */
     tGATT_ATTR_VALUE                    *p_value;
     tGATT_PERM                          permission;
-    UINT16                              handle;
+    uint16_t                            handle;
     tBT_UUID                            uuid;
     bt_gatt_db_attribute_type_t         gatt_type;
 } tGATT_ATTR;
@@ -192,11 +192,11 @@
 {
     void            *p_attr_list;               /* pointer to the first attribute,
                                                   either tGATT_ATTR16 or tGATT_ATTR128 */
-    UINT8           *p_free_mem;                /* Pointer to free memory       */
+    uint8_t         *p_free_mem;                /* Pointer to free memory       */
     fixed_queue_t   *svc_buffer;                /* buffer queue used for service database */
-    UINT32          mem_free;                   /* Memory still available       */
-    UINT16          end_handle;                 /* Last handle number           */
-    UINT16          next_handle;                /* Next usable handle value     */
+    uint32_t        mem_free;                   /* Memory still available       */
+    uint16_t        end_handle;                 /* Last handle number           */
+    uint16_t        next_handle;                /* Next usable handle value     */
 } tGATT_SVC_DB;
 
 /* Data Structure used for GATT server                                        */
@@ -207,12 +207,12 @@
 {
     tGATT_SVC_DB    *p_db;      /* pointer to the service database */
     tBT_UUID        app_uuid;           /* applicatino UUID */
-    UINT32          sdp_handle; /* primamry service SDP handle */
-    UINT16          type;       /* service type UUID, primary or secondary */
-    UINT16          s_hdl;      /* service starting handle */
-    UINT16          e_hdl;      /* service ending handle */
+    uint32_t        sdp_handle; /* primamry service SDP handle */
+    uint16_t        type;       /* service type UUID, primary or secondary */
+    uint16_t        s_hdl;      /* service starting handle */
+    uint16_t        e_hdl;      /* service ending handle */
     tGATT_IF        gatt_if;    /* this service is belong to which application */
-    BOOLEAN         in_use;
+    bool            in_use;
 } tGATT_SR_REG;
 
 #define GATT_LISTEN_TO_ALL  0xff
@@ -228,8 +228,8 @@
     tBT_UUID     app_uuid128;
     tGATT_CBACK  app_cb;
     tGATT_IF     gatt_if; /* one based */
-    BOOLEAN      in_use;
-    UINT8        listening; /* if adv for all has been enabled */
+    bool         in_use;
+    uint8_t      listening; /* if adv for all has been enabled */
 } tGATT_REG;
 
 
@@ -239,31 +239,31 @@
 typedef struct
 {
     BT_HDR      *p_cmd;
-    UINT16      clcb_idx;
-    UINT8       op_code;
-    BOOLEAN     to_send;
+    uint16_t    clcb_idx;
+    uint8_t     op_code;
+    bool        to_send;
 }tGATT_CMD_Q;
 
 
 #if GATT_MAX_SR_PROFILES <= 8
-typedef UINT8 tGATT_APP_MASK;
+typedef uint8_t tGATT_APP_MASK;
 #elif GATT_MAX_SR_PROFILES <= 16
-typedef UINT16 tGATT_APP_MASK;
+typedef uint16_t tGATT_APP_MASK;
 #elif GATT_MAX_SR_PROFILES <= 32
-typedef UINT32 tGATT_APP_MASK;
+typedef uint32_t tGATT_APP_MASK;
 #endif
 
 /* command details for each connection */
 typedef struct
 {
     BT_HDR          *p_rsp_msg;
-    UINT32           trans_id;
+    uint32_t         trans_id;
     tGATT_READ_MULTI multi_req;
     fixed_queue_t   *multi_rsp_q;
-    UINT16           handle;
-    UINT8            op_code;
-    UINT8            status;
-    UINT8            cback_cnt[GATT_MAX_APPS];
+    uint16_t         handle;
+    uint8_t          op_code;
+    uint8_t          status;
+    uint8_t          cback_cnt[GATT_MAX_APPS];
 } tGATT_SR_CMD;
 
 #define     GATT_CH_CLOSE               0
@@ -272,7 +272,7 @@
 #define     GATT_CH_CFG                 3
 #define     GATT_CH_OPEN                4
 
-typedef UINT8 tGATT_CH_STATE;
+typedef uint8_t tGATT_CH_STATE;
 
 #define GATT_GATT_START_HANDLE  1
 #define GATT_GAP_START_HANDLE   20
@@ -280,9 +280,9 @@
 
 typedef struct hdl_cfg
 {
-    UINT16               gatt_start_hdl;
-    UINT16               gap_start_hdl;
-    UINT16               app_start_hdl;
+    uint16_t             gatt_start_hdl;
+    uint16_t             gap_start_hdl;
+    uint16_t             app_start_hdl;
 }tGATT_HDL_CFG;
 
 typedef struct hdl_list_elem
@@ -291,14 +291,14 @@
     struct              hdl_list_elem *p_prev;
     tGATTS_HNDL_RANGE   asgn_range; /* assigned handle range */
     tGATT_SVC_DB        svc_db;
-    BOOLEAN             in_use;
+    bool                in_use;
 }tGATT_HDL_LIST_ELEM;
 
 typedef struct
 {
     tGATT_HDL_LIST_ELEM  *p_first;
     tGATT_HDL_LIST_ELEM  *p_last;
-    UINT16               count;
+    uint16_t             count;
 }tGATT_HDL_LIST_INFO;
 
 
@@ -306,10 +306,10 @@
 {
     struct              srv_list_elem *p_next;
     struct              srv_list_elem *p_prev;
-    UINT16              s_hdl;
-    UINT8               i_sreg;
-    BOOLEAN             in_use;
-    BOOLEAN             is_primary;
+    uint16_t            s_hdl;
+    uint8_t             i_sreg;
+    bool                in_use;
+    bool                is_primary;
 }tGATT_SRV_LIST_ELEM;
 
 
@@ -318,7 +318,7 @@
     tGATT_SRV_LIST_ELEM  *p_last_primary;
     tGATT_SRV_LIST_ELEM  *p_first;
     tGATT_SRV_LIST_ELEM  *p_last;
-    UINT16               count;
+    uint16_t             count;
 }tGATT_SRV_LIST_INFO;
 
 typedef struct
@@ -327,66 +327,66 @@
     tGATT_SEC_ACTION sec_act;
     BD_ADDR         peer_bda;
     tBT_TRANSPORT   transport;
-    UINT32          trans_id;
+    uint32_t        trans_id;
 
-    UINT16          att_lcid;           /* L2CAP channel ID for ATT */
-    UINT16          payload_size;
+    uint16_t        att_lcid;           /* L2CAP channel ID for ATT */
+    uint16_t        payload_size;
 
     tGATT_CH_STATE  ch_state;
-    UINT8           ch_flags;
+    uint8_t         ch_flags;
 
     tGATT_IF        app_hold_link[GATT_MAX_APPS];
 
     /* server needs */
     /* server response data */
     tGATT_SR_CMD    sr_cmd;
-    UINT16          indicate_handle;
+    uint16_t        indicate_handle;
     fixed_queue_t   *pending_ind_q;
 
     alarm_t         *conf_timer;         /* peer confirm to indication timer */
 
-    UINT8           prep_cnt[GATT_MAX_APPS];
-    UINT8           ind_count;
+    uint8_t         prep_cnt[GATT_MAX_APPS];
+    uint8_t         ind_count;
 
     tGATT_CMD_Q     cl_cmd_q[GATT_CL_MAX_LCB];
     alarm_t         *ind_ack_timer;   /* local app confirm to indication timer */
-    UINT8           pending_cl_req;
-    UINT8           next_slot_inq;    /* index of next available slot in queue */
+    uint8_t         pending_cl_req;
+    uint8_t         next_slot_inq;    /* index of next available slot in queue */
 
-    BOOLEAN         in_use;
-    UINT8           tcb_idx;
+    bool            in_use;
+    uint8_t         tcb_idx;
 } tGATT_TCB;
 
 
 /* logic channel */
 typedef struct
 {
-    UINT16                  next_disc_start_hdl;   /* starting handle for the next inc srvv discovery */
+    uint16_t                next_disc_start_hdl;   /* starting handle for the next inc srvv discovery */
     tGATT_DISC_RES          result;
-    BOOLEAN                 wait_for_read_rsp;
+    bool                    wait_for_read_rsp;
 } tGATT_READ_INC_UUID128;
 typedef struct
 {
     tGATT_TCB               *p_tcb;         /* associated TCB of this CLCB */
     tGATT_REG               *p_reg;        /* owner of this CLCB */
-    UINT8                   sccb_idx;
-    UINT8                   *p_attr_buf;    /* attribute buffer for read multiple, prepare write */
+    uint8_t                 sccb_idx;
+    uint8_t                 *p_attr_buf;    /* attribute buffer for read multiple, prepare write */
     tBT_UUID                uuid;
-    UINT16                  conn_id;        /* connection handle */
-    UINT16                  clcb_idx;
-    UINT16                  s_handle;       /* starting handle of the active request */
-    UINT16                  e_handle;       /* ending handle of the active request */
-    UINT16                  counter;        /* used as offset, attribute length, num of prepare write */
-    UINT16                  start_offset;
+    uint16_t                conn_id;        /* connection handle */
+    uint16_t                clcb_idx;
+    uint16_t                s_handle;       /* starting handle of the active request */
+    uint16_t                e_handle;       /* ending handle of the active request */
+    uint16_t                counter;        /* used as offset, attribute length, num of prepare write */
+    uint16_t                start_offset;
     tGATT_AUTH_REQ          auth_req;       /* authentication requirement */
-    UINT8                   operation;      /* one logic channel can have one operation active */
-    UINT8                   op_subtype;     /* operation subtype */
-    UINT8                   status;         /* operation status */
-    BOOLEAN                 first_read_blob_after_read;
+    uint8_t                 operation;      /* one logic channel can have one operation active */
+    uint8_t                 op_subtype;     /* operation subtype */
+    uint8_t                 status;         /* operation status */
+    bool                    first_read_blob_after_read;
     tGATT_READ_INC_UUID128  read_uuid128;
-    BOOLEAN                 in_use;
+    bool                    in_use;
     alarm_t                 *gatt_rsp_timer_ent;  /* peer response timer */
-    UINT8                   retry_count;
+    uint8_t                 retry_count;
 
 } tGATT_CLCB;
 
@@ -397,15 +397,15 @@
 
 typedef struct
 {
-    UINT16                  clcb_idx;
-    BOOLEAN                 in_use;
+    uint16_t                clcb_idx;
+    bool                    in_use;
 } tGATT_SCCB;
 
 typedef struct
 {
-    UINT16      handle;
-    UINT16      uuid;
-    UINT32      service_change;
+    uint16_t    handle;
+    uint16_t    uuid;
+    uint32_t    service_change;
 }tGATT_SVC_CHG;
 
 typedef struct
@@ -413,7 +413,7 @@
     tGATT_IF        gatt_if[GATT_MAX_APPS];
     tGATT_IF        listen_gif[GATT_MAX_APPS];
     BD_ADDR         remote_bda;
-    BOOLEAN         in_use;
+    bool            in_use;
 }tGATT_BG_CONN_DEV;
 
 #define GATT_SVC_CHANGED_CONNECTING        1   /* wait for connection */
@@ -424,17 +424,17 @@
 
 typedef struct
 {
-    UINT16  conn_id;
-    BOOLEAN in_use;
-    BOOLEAN connected;
+    uint16_t conn_id;
+    bool    in_use;
+    bool    connected;
     BD_ADDR bda;
     tBT_TRANSPORT   transport;
 
     /* GATT service change CCC related variables */
-    UINT8       ccc_stage;
-    UINT8       ccc_result;
-    UINT16      s_handle;
-    UINT16      e_handle;
+    uint8_t     ccc_stage;
+    uint8_t     ccc_result;
+    uint16_t    s_handle;
+    uint16_t    e_handle;
 }tGATT_PROFILE_CLCB;
 
 typedef struct
@@ -443,7 +443,7 @@
     fixed_queue_t       *sign_op_queue;
 
     tGATT_SR_REG        sr_reg[GATT_MAX_SR_PROFILES];
-    UINT16              next_handle;    /* next available handle */
+    uint16_t            next_handle;    /* next available handle */
     tGATT_SVC_CHG       gattp_attr;     /* GATT profile attribute service change */
     tGATT_IF            gatt_if;
     tGATT_HDL_LIST_INFO hdl_list_info;
@@ -455,18 +455,18 @@
     tGATT_REG           cl_rcb[GATT_MAX_APPS];
     tGATT_CLCB          clcb[GATT_CL_MAX_LCB];  /* connection link control block*/
     tGATT_SCCB          sccb[GATT_MAX_SCCB];    /* sign complete callback function GATT_MAX_SCCB <= GATT_CL_MAX_LCB */
-    UINT8               trace_level;
-    UINT16              def_mtu_size;
+    uint8_t             trace_level;
+    uint16_t            def_mtu_size;
 
-#if GATT_CONFORMANCE_TESTING == TRUE
-    BOOLEAN             enable_err_rsp;
-    UINT8               req_op_code;
-    UINT8               err_status;
-    UINT16              handle;
+#if (GATT_CONFORMANCE_TESTING == TRUE)
+    bool                enable_err_rsp;
+    uint8_t             req_op_code;
+    uint8_t             err_status;
+    uint16_t            handle;
 #endif
 
     tGATT_PROFILE_CLCB  profile_clcb[GATT_MAX_APPS];
-    UINT16              handle_of_h_r;          /* Handle of the handles reused characteristic value */
+    uint16_t            handle_of_h_r;          /* Handle of the handles reused characteristic value */
 
     tGATT_APPL_INFO       cb_info;
 
@@ -481,15 +481,15 @@
 #define GATT_SIZE_OF_SRV_CHG_HNDL_RANGE 4
 
 /* Global GATT data */
-#if GATT_DYNAMIC_MEMORY == FALSE
+#if (GATT_DYNAMIC_MEMORY == FALSE)
 extern tGATT_CB  gatt_cb;
 #else
 extern tGATT_CB *gatt_cb_ptr;
 #define gatt_cb (*gatt_cb_ptr)
 #endif
 
-#if GATT_CONFORMANCE_TESTING == TRUE
-extern void gatt_set_err_rsp(BOOLEAN enable, UINT8 req_op_code, UINT8 err_status);
+#if (GATT_CONFORMANCE_TESTING == TRUE)
+extern void gatt_set_err_rsp(bool    enable, uint8_t req_op_code, uint8_t err_status);
 #endif
 
 #ifdef __cplusplus
@@ -501,11 +501,11 @@
 extern void gatt_free(void);
 
 /* from gatt_main.c */
-extern BOOLEAN gatt_disconnect (tGATT_TCB *p_tcb);
-extern BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr, tBT_TRANSPORT transport);
-extern BOOLEAN gatt_connect (BD_ADDR rem_bda,  tGATT_TCB *p_tcb, tBT_TRANSPORT transport);
+extern bool    gatt_disconnect (tGATT_TCB *p_tcb);
+extern bool    gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr, tBT_TRANSPORT transport);
+extern bool    gatt_connect (BD_ADDR rem_bda,  tGATT_TCB *p_tcb, tBT_TRANSPORT transport);
 extern void gatt_data_process (tGATT_TCB *p_tcb, BT_HDR *p_buf);
-extern void gatt_update_app_use_link_flag ( tGATT_IF gatt_if, tGATT_TCB *p_tcb, BOOLEAN is_add, BOOLEAN check_acl_link);
+extern void gatt_update_app_use_link_flag ( tGATT_IF gatt_if, tGATT_TCB *p_tcb, bool    is_add, bool    check_acl_link);
 
 extern void gatt_profile_db_init(void);
 extern void gatt_set_ch_state(tGATT_TCB *p_tcb, tGATT_CH_STATE ch_state);
@@ -517,123 +517,123 @@
 extern void gatt_add_a_bonded_dev_for_srv_chg (BD_ADDR bda);
 
 /* from gatt_attr.c */
-extern UINT16 gatt_profile_find_conn_id_by_bd_addr(BD_ADDR bda);
+extern uint16_t gatt_profile_find_conn_id_by_bd_addr(BD_ADDR bda);
 
 
 /* Functions provided by att_protocol.c */
-extern tGATT_STATUS attp_send_cl_msg (tGATT_TCB *p_tcb, UINT16 clcb_idx, UINT8 op_code, tGATT_CL_MSG *p_msg);
-extern BT_HDR *attp_build_sr_msg(tGATT_TCB *p_tcb, UINT8 op_code, tGATT_SR_MSG *p_msg);
+extern tGATT_STATUS attp_send_cl_msg (tGATT_TCB *p_tcb, uint16_t clcb_idx, uint8_t op_code, tGATT_CL_MSG *p_msg);
+extern BT_HDR *attp_build_sr_msg(tGATT_TCB *p_tcb, uint8_t op_code, tGATT_SR_MSG *p_msg);
 extern tGATT_STATUS attp_send_sr_msg (tGATT_TCB *p_tcb, BT_HDR *p_msg);
 extern tGATT_STATUS attp_send_msg_to_l2cap(tGATT_TCB *p_tcb, BT_HDR *p_toL2CAP);
 
 /* utility functions */
-extern UINT8 * gatt_dbg_op_name(UINT8 op_code);
-extern UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl);
-extern BOOLEAN gatt_parse_uuid_from_cmd(tBT_UUID *p_uuid, UINT16 len, UINT8 **p_data);
-extern UINT8 gatt_build_uuid_to_stream(UINT8 **p_dst, tBT_UUID uuid);
-extern BOOLEAN gatt_uuid_compare(tBT_UUID src, tBT_UUID tar);
-extern void gatt_convert_uuid32_to_uuid128(UINT8 uuid_128[LEN_UUID_128], UINT32 uuid_32);
-extern void gatt_sr_get_sec_info(BD_ADDR rem_bda, tBT_TRANSPORT transport, UINT8 *p_sec_flag, UINT8 *p_key_size);
-extern void gatt_start_rsp_timer(UINT16 clcb_idx);
+extern uint8_t * gatt_dbg_op_name(uint8_t op_code);
+extern uint32_t gatt_add_sdp_record (tBT_UUID *p_uuid, uint16_t start_hdl, uint16_t end_hdl);
+extern bool    gatt_parse_uuid_from_cmd(tBT_UUID *p_uuid, uint16_t len, uint8_t **p_data);
+extern uint8_t gatt_build_uuid_to_stream(uint8_t **p_dst, tBT_UUID uuid);
+extern bool    gatt_uuid_compare(tBT_UUID src, tBT_UUID tar);
+extern void gatt_convert_uuid32_to_uuid128(uint8_t uuid_128[LEN_UUID_128], uint32_t uuid_32);
+extern void gatt_sr_get_sec_info(BD_ADDR rem_bda, tBT_TRANSPORT transport, uint8_t *p_sec_flag, uint8_t *p_key_size);
+extern void gatt_start_rsp_timer(uint16_t clcb_idx);
 extern void gatt_start_conf_timer(tGATT_TCB    *p_tcb);
 extern void gatt_rsp_timeout(void *data);
 extern void gatt_indication_confirmation_timeout(void *data);
 extern void gatt_ind_ack_timeout(void *data);
 extern void gatt_start_ind_ack_timer(tGATT_TCB *p_tcb);
-extern tGATT_STATUS gatt_send_error_rsp(tGATT_TCB *p_tcb, UINT8 err_code, UINT8 op_code, UINT16 handle, BOOLEAN deq);
+extern tGATT_STATUS gatt_send_error_rsp(tGATT_TCB *p_tcb, uint8_t err_code, uint8_t op_code, uint16_t handle, bool    deq);
 extern void gatt_dbg_display_uuid(tBT_UUID bt_uuid);
 extern tGATT_PENDING_ENC_CLCB* gatt_add_pending_enc_channel_clcb(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb );
 
-extern BOOLEAN gatt_is_srv_chg_ind_pending (tGATT_TCB *p_tcb);
+extern bool    gatt_is_srv_chg_ind_pending (tGATT_TCB *p_tcb);
 extern tGATTS_SRV_CHG *gatt_is_bda_in_the_srv_chg_clt_list (BD_ADDR bda);
 
-extern BOOLEAN gatt_find_the_connected_bda(UINT8 start_idx, BD_ADDR bda, UINT8 *p_found_idx, tBT_TRANSPORT *p_transport);
+extern bool    gatt_find_the_connected_bda(uint8_t start_idx, BD_ADDR bda, uint8_t *p_found_idx, tBT_TRANSPORT *p_transport);
 extern void gatt_set_srv_chg(void);
 extern void gatt_delete_dev_from_srv_chg_clt_list(BD_ADDR bd_addr);
 extern tGATT_VALUE *gatt_add_pending_ind(tGATT_TCB  *p_tcb, tGATT_VALUE *p_ind);
 extern void gatt_free_srvc_db_buffer_app_id(tBT_UUID *p_app_id);
-extern BOOLEAN gatt_update_listen_mode(void);
-extern BOOLEAN gatt_cl_send_next_cmd_inq(tGATT_TCB *p_tcb);
+extern bool    gatt_update_listen_mode(void);
+extern bool    gatt_cl_send_next_cmd_inq(tGATT_TCB *p_tcb);
 
 /* reserved handle list */
-extern tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_app_id (tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, UINT16 svc_inst);
-extern tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_handle(UINT16 handle);
+extern tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_app_id (tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, uint16_t svc_inst);
+extern tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_handle(uint16_t handle);
 extern tGATT_HDL_LIST_ELEM *gatt_alloc_hdl_buffer(void);
 extern void gatt_free_hdl_buffer(tGATT_HDL_LIST_ELEM *p);
-extern BOOLEAN gatt_is_last_attribute(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_start, tBT_UUID value);
+extern bool    gatt_is_last_attribute(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_start, tBT_UUID value);
 extern void gatt_update_last_pri_srv_info(tGATT_SRV_LIST_INFO *p_list);
-extern BOOLEAN gatt_add_a_srv_to_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_new);
-extern BOOLEAN gatt_remove_a_srv_from_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_remove);
-extern BOOLEAN gatt_add_an_item_to_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_new);
-extern BOOLEAN gatt_remove_an_item_from_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_remove);
+extern bool    gatt_add_a_srv_to_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_new);
+extern bool    gatt_remove_a_srv_from_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_remove);
+extern bool    gatt_add_an_item_to_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_new);
+extern bool    gatt_remove_an_item_from_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_remove);
 extern tGATTS_SRV_CHG *gatt_add_srv_chg_clt(tGATTS_SRV_CHG *p_srv_chg);
 
 /* for background connection */
-extern BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_addr, BOOLEAN is_initiator);
-extern BOOLEAN gatt_is_bg_dev_for_app(tGATT_BG_CONN_DEV *p_dev, tGATT_IF gatt_if);
-extern BOOLEAN gatt_remove_bg_dev_for_app(tGATT_IF gatt_if, BD_ADDR bd_addr);
-extern UINT8 gatt_get_num_apps_for_bg_dev(BD_ADDR bd_addr);
-extern BOOLEAN gatt_find_app_for_bg_dev(BD_ADDR bd_addr, tGATT_IF *p_gatt_if);
+extern bool    gatt_update_auto_connect_dev (tGATT_IF gatt_if, bool    add, BD_ADDR bd_addr, bool    is_initiator);
+extern bool    gatt_is_bg_dev_for_app(tGATT_BG_CONN_DEV *p_dev, tGATT_IF gatt_if);
+extern bool    gatt_remove_bg_dev_for_app(tGATT_IF gatt_if, BD_ADDR bd_addr);
+extern uint8_t gatt_get_num_apps_for_bg_dev(BD_ADDR bd_addr);
+extern bool    gatt_find_app_for_bg_dev(BD_ADDR bd_addr, tGATT_IF *p_gatt_if);
 extern tGATT_BG_CONN_DEV * gatt_find_bg_dev(BD_ADDR remote_bda);
 extern void gatt_deregister_bgdev_list(tGATT_IF gatt_if);
 extern void gatt_reset_bgdev_list(void);
 
 /* server function */
-extern UINT8 gatt_sr_find_i_rcb_by_handle(UINT16 handle);
-extern UINT8 gatt_sr_find_i_rcb_by_app_id(tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, UINT16 svc_inst);
-extern UINT8 gatt_sr_alloc_rcb(tGATT_HDL_LIST_ELEM *p_list);
-extern tGATT_STATUS gatt_sr_process_app_rsp (tGATT_TCB *p_tcb, tGATT_IF gatt_if, UINT32 trans_id, UINT8 op_code, tGATT_STATUS status, tGATTS_RSP *p_msg);
-extern void gatt_server_handle_client_req (tGATT_TCB *p_tcb, UINT8 op_code,
-                                           UINT16 len, UINT8 *p_data);
-extern void gatt_sr_send_req_callback(UINT16 conn_id,  UINT32 trans_id,
-                                      UINT8 op_code, tGATTS_DATA *p_req_data);
-extern UINT32 gatt_sr_enqueue_cmd (tGATT_TCB *p_tcb, UINT8 op_code, UINT16 handle);
-extern BOOLEAN gatt_cancel_open(tGATT_IF gatt_if, BD_ADDR bda);
+extern uint8_t gatt_sr_find_i_rcb_by_handle(uint16_t handle);
+extern uint8_t gatt_sr_find_i_rcb_by_app_id(tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, uint16_t svc_inst);
+extern uint8_t gatt_sr_alloc_rcb(tGATT_HDL_LIST_ELEM *p_list);
+extern tGATT_STATUS gatt_sr_process_app_rsp (tGATT_TCB *p_tcb, tGATT_IF gatt_if, uint32_t trans_id, uint8_t op_code, tGATT_STATUS status, tGATTS_RSP *p_msg);
+extern void gatt_server_handle_client_req (tGATT_TCB *p_tcb, uint8_t op_code,
+                                           uint16_t len, uint8_t *p_data);
+extern void gatt_sr_send_req_callback(uint16_t conn_id,  uint32_t trans_id,
+                                      uint8_t op_code, tGATTS_DATA *p_req_data);
+extern uint32_t gatt_sr_enqueue_cmd (tGATT_TCB *p_tcb, uint8_t op_code, uint16_t handle);
+extern bool    gatt_cancel_open(tGATT_IF gatt_if, BD_ADDR bda);
 
 /*   */
 
 extern tGATT_REG *gatt_get_regcb (tGATT_IF gatt_if);
-extern BOOLEAN gatt_is_clcb_allocated (UINT16 conn_id);
-extern tGATT_CLCB *gatt_clcb_alloc (UINT16 conn_id);
+extern bool    gatt_is_clcb_allocated (uint16_t conn_id);
+extern tGATT_CLCB *gatt_clcb_alloc (uint16_t conn_id);
 extern void gatt_clcb_dealloc (tGATT_CLCB *p_clcb);
 
 extern void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB *p_tcb );
-extern BOOLEAN gatt_sr_is_cback_cnt_zero(tGATT_TCB *p_tcb );
-extern BOOLEAN gatt_sr_is_prep_cnt_zero(tGATT_TCB *p_tcb );
+extern bool    gatt_sr_is_cback_cnt_zero(tGATT_TCB *p_tcb );
+extern bool    gatt_sr_is_prep_cnt_zero(tGATT_TCB *p_tcb );
 extern void gatt_sr_reset_cback_cnt(tGATT_TCB *p_tcb );
 extern void gatt_sr_reset_prep_cnt(tGATT_TCB *p_tcb );
-extern void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc, BOOLEAN is_reset_first);
-extern void gatt_sr_update_prep_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc, BOOLEAN is_reset_first);
+extern void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, bool    is_inc, bool    is_reset_first);
+extern void gatt_sr_update_prep_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, bool    is_inc, bool    is_reset_first);
 
-extern BOOLEAN gatt_find_app_hold_link(tGATT_TCB *p_tcb, UINT8 start_idx, UINT8 *p_found_idx, tGATT_IF *p_gatt_if);
-extern UINT8 gatt_num_apps_hold_link(tGATT_TCB *p_tcb);
-extern UINT8 gatt_num_clcb_by_bd_addr(BD_ADDR bda);
-extern tGATT_TCB * gatt_find_tcb_by_cid(UINT16 lcid);
+extern bool    gatt_find_app_hold_link(tGATT_TCB *p_tcb, uint8_t start_idx, uint8_t *p_found_idx, tGATT_IF *p_gatt_if);
+extern uint8_t gatt_num_apps_hold_link(tGATT_TCB *p_tcb);
+extern uint8_t gatt_num_clcb_by_bd_addr(BD_ADDR bda);
+extern tGATT_TCB * gatt_find_tcb_by_cid(uint16_t lcid);
 extern tGATT_TCB * gatt_allocate_tcb_by_bdaddr(BD_ADDR bda, tBT_TRANSPORT transport);
-extern tGATT_TCB * gatt_get_tcb_by_idx(UINT8 tcb_idx);
+extern tGATT_TCB * gatt_get_tcb_by_idx(uint8_t tcb_idx);
 extern tGATT_TCB * gatt_find_tcb_by_addr(BD_ADDR bda, tBT_TRANSPORT transport);
-extern BOOLEAN gatt_send_ble_burst_data (BD_ADDR remote_bda,  BT_HDR *p_buf);
+extern bool    gatt_send_ble_burst_data (BD_ADDR remote_bda,  BT_HDR *p_buf);
 
 /* GATT client functions */
 extern void gatt_dequeue_sr_cmd (tGATT_TCB *p_tcb);
-extern UINT8 gatt_send_write_msg(tGATT_TCB *p_tcb, UINT16 clcb_idx, UINT8 op_code, UINT16 handle,
-                                 UINT16 len, UINT16 offset, UINT8 *p_data);
-extern void gatt_cleanup_upon_disc(BD_ADDR bda, UINT16 reason, tBT_TRANSPORT transport);
+extern uint8_t gatt_send_write_msg(tGATT_TCB *p_tcb, uint16_t clcb_idx, uint8_t op_code, uint16_t handle,
+                                 uint16_t len, uint16_t offset, uint8_t *p_data);
+extern void gatt_cleanup_upon_disc(BD_ADDR bda, uint16_t reason, tBT_TRANSPORT transport);
 extern void gatt_end_operation(tGATT_CLCB *p_clcb, tGATT_STATUS status, void *p_data);
 
 extern void gatt_act_discovery(tGATT_CLCB *p_clcb);
-extern void gatt_act_read(tGATT_CLCB *p_clcb, UINT16 offset);
-extern void gatt_act_write(tGATT_CLCB *p_clcb, UINT8 sec_act);
-extern UINT8 gatt_act_send_browse(tGATT_TCB *p_tcb, UINT16 index, UINT8 op, UINT16 s_handle, UINT16 e_handle,
+extern void gatt_act_read(tGATT_CLCB *p_clcb, uint16_t offset);
+extern void gatt_act_write(tGATT_CLCB *p_clcb, uint8_t sec_act);
+extern uint8_t gatt_act_send_browse(tGATT_TCB *p_tcb, uint16_t index, uint8_t op, uint16_t s_handle, uint16_t e_handle,
                                   tBT_UUID uuid);
-extern tGATT_CLCB *gatt_cmd_dequeue(tGATT_TCB *p_tcb, UINT8 *p_opcode);
-extern BOOLEAN gatt_cmd_enq(tGATT_TCB *p_tcb, UINT16 clcb_idx, BOOLEAN to_send, UINT8 op_code, BT_HDR *p_buf);
-extern void gatt_client_handle_server_rsp (tGATT_TCB *p_tcb, UINT8 op_code,
-                                           UINT16 len, UINT8 *p_data);
+extern tGATT_CLCB *gatt_cmd_dequeue(tGATT_TCB *p_tcb, uint8_t *p_opcode);
+extern bool    gatt_cmd_enq(tGATT_TCB *p_tcb, uint16_t clcb_idx, bool    to_send, uint8_t op_code, BT_HDR *p_buf);
+extern void gatt_client_handle_server_rsp (tGATT_TCB *p_tcb, uint8_t op_code,
+                                           uint16_t len, uint8_t *p_data);
 extern void gatt_send_queue_write_cancel (tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, tGATT_EXEC_FLAG flag);
 
 /* gatt_auth.c */
-extern BOOLEAN gatt_security_check_start(tGATT_CLCB *p_clcb);
+extern bool    gatt_security_check_start(tGATT_CLCB *p_clcb);
 extern void gatt_verify_signature(tGATT_TCB *p_tcb, BT_HDR *p_buf);
 extern tGATT_SEC_ACTION gatt_determine_sec_act(tGATT_CLCB *p_clcb );
 extern tGATT_STATUS gatt_get_link_encrypt_status(tGATT_TCB *p_tcb);
@@ -641,18 +641,18 @@
 extern void gatt_set_sec_act(tGATT_TCB *p_tcb, tGATT_SEC_ACTION sec_act);
 
 /* gatt_db.c */
-extern BOOLEAN gatts_init_service_db (tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN is_pri, UINT16 s_hdl, UINT16 num_handle);
-extern UINT16 gatts_add_included_service (tGATT_SVC_DB *p_db, UINT16 s_handle, UINT16 e_handle, tBT_UUID service);
-extern UINT16 gatts_add_characteristic (tGATT_SVC_DB *p_db, tGATT_PERM perm, tGATT_CHAR_PROP property, tBT_UUID *p_char_uuid);
-extern UINT16 gatts_add_char_descr (tGATT_SVC_DB *p_db, tGATT_PERM perm, tBT_UUID *p_dscp_uuid);
-extern tGATT_STATUS gatts_db_read_attr_value_by_type (tGATT_TCB *p_tcb, tGATT_SVC_DB *p_db, UINT8 op_code, BT_HDR *p_rsp, UINT16 s_handle,
-                                                      UINT16 e_handle, tBT_UUID type, UINT16 *p_len, tGATT_SEC_FLAG sec_flag, UINT8 key_size,UINT32 trans_id, UINT16 *p_cur_handle);
-extern tGATT_STATUS gatts_read_attr_value_by_handle(tGATT_TCB *p_tcb,tGATT_SVC_DB *p_db, UINT8 op_code, UINT16 handle, UINT16 offset,
-                                                    UINT8 *p_value, UINT16 *p_len, UINT16 mtu,tGATT_SEC_FLAG sec_flag,UINT8 key_size,UINT32 trans_id);
-extern tGATT_STATUS gatts_write_attr_perm_check (tGATT_SVC_DB *p_db, UINT8 op_code,UINT16 handle, UINT16 offset, UINT8 *p_data,
-                                                 UINT16 len, tGATT_SEC_FLAG sec_flag, UINT8 key_size);
-extern tGATT_STATUS gatts_read_attr_perm_check(tGATT_SVC_DB *p_db, BOOLEAN is_long, UINT16 handle, tGATT_SEC_FLAG sec_flag,UINT8 key_size);
-extern void gatts_update_srv_list_elem(UINT8 i_sreg, UINT16 handle, BOOLEAN is_primary);
+extern bool    gatts_init_service_db (tGATT_SVC_DB *p_db, tBT_UUID *p_service, bool    is_pri, uint16_t s_hdl, uint16_t num_handle);
+extern uint16_t gatts_add_included_service (tGATT_SVC_DB *p_db, uint16_t s_handle, uint16_t e_handle, tBT_UUID service);
+extern uint16_t gatts_add_characteristic (tGATT_SVC_DB *p_db, tGATT_PERM perm, tGATT_CHAR_PROP property, tBT_UUID *p_char_uuid);
+extern uint16_t gatts_add_char_descr (tGATT_SVC_DB *p_db, tGATT_PERM perm, tBT_UUID *p_dscp_uuid);
+extern tGATT_STATUS gatts_db_read_attr_value_by_type (tGATT_TCB *p_tcb, tGATT_SVC_DB *p_db, uint8_t op_code, BT_HDR *p_rsp, uint16_t s_handle,
+                                                      uint16_t e_handle, tBT_UUID type, uint16_t *p_len, tGATT_SEC_FLAG sec_flag, uint8_t key_size,uint32_t trans_id, uint16_t *p_cur_handle);
+extern tGATT_STATUS gatts_read_attr_value_by_handle(tGATT_TCB *p_tcb,tGATT_SVC_DB *p_db, uint8_t op_code, uint16_t handle, uint16_t offset,
+                                                    uint8_t *p_value, uint16_t *p_len, uint16_t mtu,tGATT_SEC_FLAG sec_flag,uint8_t key_size,uint32_t trans_id);
+extern tGATT_STATUS gatts_write_attr_perm_check (tGATT_SVC_DB *p_db, uint8_t op_code,uint16_t handle, uint16_t offset, uint8_t *p_data,
+                                                 uint16_t len, tGATT_SEC_FLAG sec_flag, uint8_t key_size);
+extern tGATT_STATUS gatts_read_attr_perm_check(tGATT_SVC_DB *p_db, bool    is_long, uint16_t handle, tGATT_SEC_FLAG sec_flag,uint8_t key_size);
+extern void gatts_update_srv_list_elem(uint8_t i_sreg, uint16_t handle, bool    is_primary);
 extern tBT_UUID * gatts_get_service_uuid (tGATT_SVC_DB *p_db);
 
 extern void gatt_reset_bgdev_list(void);
diff --git a/stack/gatt/gatt_main.c b/stack/gatt/gatt_main.c
index 7914217..e0ad1f2 100644
--- a/stack/gatt/gatt_main.c
+++ b/stack/gatt/gatt_main.c
@@ -24,7 +24,7 @@
 
 #include "bt_target.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
 #include "bt_common.h"
 #include "gatt_int.h"
@@ -44,21 +44,21 @@
 /********************************************************************************/
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
-static void gatt_le_connect_cback (UINT16 chan, BD_ADDR bd_addr, BOOLEAN connected,
-        UINT16 reason, tBT_TRANSPORT transport);
-static void gatt_le_data_ind (UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf);
-static void gatt_le_cong_cback(BD_ADDR remote_bda, BOOLEAN congest);
+static void gatt_le_connect_cback (uint16_t chan, BD_ADDR bd_addr, bool    connected,
+        uint16_t reason, tBT_TRANSPORT transport);
+static void gatt_le_data_ind (uint16_t chan, BD_ADDR bd_addr, BT_HDR *p_buf);
+static void gatt_le_cong_cback(BD_ADDR remote_bda, bool    congest);
 
-static void gatt_l2cif_connect_ind_cback (BD_ADDR  bd_addr, UINT16 l2cap_cid,
-        UINT16 psm, UINT8 l2cap_id);
-static void gatt_l2cif_connect_cfm_cback (UINT16 l2cap_cid, UINT16 result);
-static void gatt_l2cif_config_ind_cback (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
-static void gatt_l2cif_config_cfm_cback (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
-static void gatt_l2cif_disconnect_ind_cback (UINT16 l2cap_cid, BOOLEAN ack_needed);
-static void gatt_l2cif_disconnect_cfm_cback (UINT16 l2cap_cid, UINT16 result);
-static void gatt_l2cif_data_ind_cback (UINT16 l2cap_cid, BT_HDR *p_msg);
+static void gatt_l2cif_connect_ind_cback (BD_ADDR  bd_addr, uint16_t l2cap_cid,
+        uint16_t psm, uint8_t l2cap_id);
+static void gatt_l2cif_connect_cfm_cback (uint16_t l2cap_cid, uint16_t result);
+static void gatt_l2cif_config_ind_cback (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
+static void gatt_l2cif_config_cfm_cback (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
+static void gatt_l2cif_disconnect_ind_cback (uint16_t l2cap_cid, bool    ack_needed);
+static void gatt_l2cif_disconnect_cfm_cback (uint16_t l2cap_cid, uint16_t result);
+static void gatt_l2cif_data_ind_cback (uint16_t l2cap_cid, BT_HDR *p_msg);
 static void gatt_send_conn_cback (tGATT_TCB *p_tcb);
-static void gatt_l2cif_congest_cback (UINT16 cid, BOOLEAN congested);
+static void gatt_l2cif_congest_cback (uint16_t cid, bool    congested);
 
 static const tL2CAP_APPL_INFO dyn_info =
 {
@@ -75,7 +75,7 @@
     NULL
 } ;
 
-#if GATT_DYNAMIC_MEMORY == FALSE
+#if (GATT_DYNAMIC_MEMORY == FALSE)
 tGATT_CB  gatt_cb;
 #endif
 
@@ -127,8 +127,8 @@
         GATT_TRACE_ERROR ("ATT Dynamic Registration failed");
     }
 
-    BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_ATT, BTM_SEC_NONE, BT_PSM_ATT, 0, 0);
-    BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_ATT, BTM_SEC_NONE, BT_PSM_ATT, 0, 0);
+    BTM_SetSecurityLevel(true, "", BTM_SEC_SERVICE_ATT, BTM_SEC_NONE, BT_PSM_ATT, 0, 0);
+    BTM_SetSecurityLevel(false, "", BTM_SEC_SERVICE_ATT, BTM_SEC_NONE, BT_PSM_ATT, 0, 0);
 
     gatt_cb.hdl_cfg.gatt_start_hdl = GATT_GATT_START_HANDLE;
     gatt_cb.hdl_cfg.gap_start_hdl  = GATT_GAP_START_HANDLE;
@@ -187,12 +187,12 @@
 **
 ** Parameter        rem_bda: remote device address to connect to.
 **
-** Returns          TRUE if connection is started, otherwise return FALSE.
+** Returns          true if connection is started, otherwise return false.
 **
 *******************************************************************************/
-BOOLEAN gatt_connect (BD_ADDR rem_bda, tGATT_TCB *p_tcb, tBT_TRANSPORT transport)
+bool    gatt_connect (BD_ADDR rem_bda, tGATT_TCB *p_tcb, tBT_TRANSPORT transport)
 {
-    BOOLEAN             gatt_ret = FALSE;
+    bool                gatt_ret = false;
 
     if (gatt_get_ch_state(p_tcb) != GATT_CH_OPEN)
         gatt_set_ch_state(p_tcb, GATT_CH_CONN);
@@ -205,7 +205,7 @@
     else
     {
         if ((p_tcb->att_lcid = L2CA_ConnectReq(BT_PSM_ATT, rem_bda)) != 0)
-            gatt_ret = TRUE;
+            gatt_ret = true;
     }
 
     return gatt_ret;
@@ -219,20 +219,20 @@
 **
 ** Parameter        p_tcb: pointer to the TCB to disconnect.
 **
-** Returns          TRUE: if connection found and to be disconnected; otherwise
-**                  return FALSE.
+** Returns          true: if connection found and to be disconnected; otherwise
+**                  return false.
 **
 *******************************************************************************/
-BOOLEAN gatt_disconnect (tGATT_TCB *p_tcb)
+bool    gatt_disconnect (tGATT_TCB *p_tcb)
 {
-    BOOLEAN             ret = FALSE;
+    bool                ret = false;
     tGATT_CH_STATE      ch_state;
 
     GATT_TRACE_EVENT ("%s", __func__);
 
     if (p_tcb != NULL)
     {
-        ret = TRUE;
+        ret = true;
         if ( (ch_state = gatt_get_ch_state(p_tcb)) != GATT_CH_CLOSING )
         {
             if (p_tcb->att_lcid == L2CAP_ATT_CID)
@@ -274,22 +274,22 @@
 ** Returns          true if any modifications are made, false otherwise.
 **
 *******************************************************************************/
-BOOLEAN gatt_update_app_hold_link_status(tGATT_IF gatt_if, tGATT_TCB *p_tcb, BOOLEAN is_add)
+bool    gatt_update_app_hold_link_status(tGATT_IF gatt_if, tGATT_TCB *p_tcb, bool    is_add)
 {
     for (int i=0; i<GATT_MAX_APPS; i++) {
         if (p_tcb->app_hold_link[i] == 0 && is_add) {
             p_tcb->app_hold_link[i] = gatt_if;
             GATT_TRACE_DEBUG("%s: added gatt_if=%d idx=%d ", __func__, gatt_if, i);
-            return TRUE;
+            return true;
         } else if (p_tcb->app_hold_link[i] == gatt_if && !is_add) {
             p_tcb->app_hold_link[i] = 0;
             GATT_TRACE_DEBUG("%s: removed gatt_if=%d idx=%d", __func__, gatt_if, i);
-            return TRUE;
+            return true;
         }
     }
 
     GATT_TRACE_DEBUG("%s: gatt_if=%d not found; is_add=%d", __func__, gatt_if, is_add);
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -302,8 +302,8 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void gatt_update_app_use_link_flag(tGATT_IF gatt_if, tGATT_TCB *p_tcb, BOOLEAN is_add,
-                                   BOOLEAN check_acl_link)
+void gatt_update_app_use_link_flag(tGATT_IF gatt_if, tGATT_TCB *p_tcb, bool    is_add,
+                                   bool    check_acl_link)
 {
     GATT_TRACE_DEBUG("%s: is_add=%d chk_link=%d", __func__, is_add, check_acl_link);
 
@@ -346,15 +346,15 @@
 ** Returns          void.
 **
 *******************************************************************************/
-BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr, tBT_TRANSPORT transport)
+bool    gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr, tBT_TRANSPORT transport)
 {
-    BOOLEAN     ret = FALSE;
+    bool        ret = false;
     tGATT_TCB   *p_tcb;
-    UINT8       st;
+    uint8_t     st;
 
     if ((p_tcb = gatt_find_tcb_by_addr(bd_addr, transport)) != NULL)
     {
-        ret = TRUE;
+        ret = true;
         st = gatt_get_ch_state(p_tcb);
 
         /* before link down, another app try to open a GATT connection */
@@ -362,12 +362,12 @@
             transport == BT_TRANSPORT_LE )
         {
             if (!gatt_connect(bd_addr,  p_tcb, transport))
-                ret = FALSE;
+                ret = false;
         }
         else if(st == GATT_CH_CLOSING)
         {
             /* need to complete the closing first */
-            ret = FALSE;
+            ret = false;
         }
     }
     else
@@ -382,7 +382,7 @@
                 memset(p_tcb, 0, sizeof(tGATT_TCB));
             }
             else
-                ret = TRUE;
+                ret = true;
         }
         else
         {
@@ -393,7 +393,7 @@
 
     if (ret)
     {
-        gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, TRUE, FALSE);
+        gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, true, false);
     }
 
     return ret;
@@ -405,15 +405,15 @@
 **
 ** Description      This callback function is called by L2CAP to indicate that
 **                  the ATT fixed channel for LE is
-**                      connected (conn = TRUE)/disconnected (conn = FALSE).
+**                      connected (conn = true)/disconnected (conn = false).
 **
 *******************************************************************************/
-static void gatt_le_connect_cback (UINT16 chan, BD_ADDR bd_addr, BOOLEAN connected,
-                                   UINT16 reason, tBT_TRANSPORT transport)
+static void gatt_le_connect_cback (uint16_t chan, BD_ADDR bd_addr, bool    connected,
+                                   uint16_t reason, tBT_TRANSPORT transport)
 {
 
     tGATT_TCB       *p_tcb = gatt_find_tcb_by_addr(bd_addr, transport);
-    BOOLEAN                 check_srv_chg = FALSE;
+    bool                    check_srv_chg = false;
     tGATTS_SRV_CHG          *p_srv_chg_clt=NULL;
 
     /* ignore all fixed channel connect/disconnect on BR/EDR link for GATT */
@@ -426,7 +426,7 @@
 
     if ((p_srv_chg_clt = gatt_is_bda_in_the_srv_chg_clt_list(bd_addr)) != NULL)
     {
-        check_srv_chg = TRUE;
+        check_srv_chg = true;
     }
     else
     {
@@ -492,14 +492,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_channel_congestion(tGATT_TCB *p_tcb, BOOLEAN congested)
+static void gatt_channel_congestion(tGATT_TCB *p_tcb, bool    congested)
 {
-    UINT8 i = 0;
+    uint8_t i = 0;
     tGATT_REG *p_reg=NULL;
-    UINT16 conn_id;
+    uint16_t conn_id;
 
     /* if uncongested, check to see if there is any more pending data */
-    if (p_tcb != NULL && congested == FALSE)
+    if (p_tcb != NULL && congested == false)
     {
         gatt_cl_send_next_cmd_inq(p_tcb);
     }
@@ -527,7 +527,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_le_cong_cback(BD_ADDR remote_bda, BOOLEAN congested)
+static void gatt_le_cong_cback(BD_ADDR remote_bda, bool    congested)
 {
     tGATT_TCB *p_tcb = gatt_find_tcb_by_addr(remote_bda, BT_TRANSPORT_LE);
 
@@ -553,7 +553,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_le_data_ind (UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf)
+static void gatt_le_data_ind (uint16_t chan, BD_ADDR bd_addr, BT_HDR *p_buf)
 {
     tGATT_TCB    *p_tcb;
 
@@ -586,10 +586,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_l2cif_connect_ind_cback (BD_ADDR  bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
+static void gatt_l2cif_connect_ind_cback (BD_ADDR  bd_addr, uint16_t lcid, uint16_t psm, uint8_t id)
 {
     /* do we already have a control channel for this peer? */
-    UINT8       result = L2CAP_CONN_OK;
+    uint8_t     result = L2CAP_CONN_OK;
     tL2CAP_CFG_INFO cfg;
     tGATT_TCB       *p_tcb = gatt_find_tcb_by_addr(bd_addr, BT_TRANSPORT_BR_EDR);
     UNUSED(psm);
@@ -624,7 +624,7 @@
 
         /* Send L2CAP config req */
         memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO));
-        cfg.mtu_present = TRUE;
+        cfg.mtu_present = true;
         cfg.mtu = GATT_MAX_MTU_SIZE;
 
         L2CA_ConfigReq(lcid, &cfg);
@@ -641,7 +641,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_l2cif_connect_cfm_cback(UINT16 lcid, UINT16 result)
+static void gatt_l2cif_connect_cfm_cback(uint16_t lcid, uint16_t result)
 {
     tGATT_TCB       *p_tcb;
     tL2CAP_CFG_INFO cfg;
@@ -662,7 +662,7 @@
 
                 /* Send L2CAP config req */
                 memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO));
-                cfg.mtu_present = TRUE;
+                cfg.mtu_present = true;
                 cfg.mtu = GATT_MAX_MTU_SIZE;
                 L2CA_ConfigReq(lcid, &cfg);
             }
@@ -693,7 +693,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_l2cif_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
+void gatt_l2cif_config_cfm_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg)
 {
     tGATT_TCB       *p_tcb;
     tGATTS_SRV_CHG  *p_srv_chg_clt=NULL;
@@ -749,7 +749,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_l2cif_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
+void gatt_l2cif_config_ind_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg)
 {
     tGATT_TCB       *p_tcb;
     tGATTS_SRV_CHG  *p_srv_chg_clt=NULL;
@@ -805,10 +805,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_l2cif_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed)
+void gatt_l2cif_disconnect_ind_cback(uint16_t lcid, bool    ack_needed)
 {
     tGATT_TCB       *p_tcb;
-    UINT16          reason;
+    uint16_t        reason;
 
     /* look up clcb for this channel */
     if ((p_tcb = gatt_find_tcb_by_cid(lcid)) != NULL)
@@ -842,10 +842,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_l2cif_disconnect_cfm_cback(UINT16 lcid, UINT16 result)
+static void gatt_l2cif_disconnect_cfm_cback(uint16_t lcid, uint16_t result)
 {
     tGATT_TCB       *p_tcb;
-    UINT16          reason;
+    uint16_t        reason;
     UNUSED(result);
 
     /* look up clcb for this channel */
@@ -877,7 +877,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_l2cif_data_ind_cback(UINT16 lcid, BT_HDR *p_buf)
+static void gatt_l2cif_data_ind_cback(uint16_t lcid, BT_HDR *p_buf)
 {
     tGATT_TCB       *p_tcb;
 
@@ -901,7 +901,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatt_l2cif_congest_cback (UINT16 lcid, BOOLEAN congested)
+static void gatt_l2cif_congest_cback (uint16_t lcid, bool    congested)
 {
     tGATT_TCB *p_tcb = gatt_find_tcb_by_cid(lcid);
 
@@ -923,10 +923,10 @@
 *******************************************************************************/
 static void gatt_send_conn_cback(tGATT_TCB *p_tcb)
 {
-    UINT8               i;
+    uint8_t             i;
     tGATT_REG           *p_reg;
     tGATT_BG_CONN_DEV   *p_bg_dev=NULL;
-    UINT16              conn_id;
+    uint16_t            conn_id;
 
     p_bg_dev = gatt_find_bg_dev(p_tcb->peer_bda);
 
@@ -936,13 +936,13 @@
         if (p_reg->in_use)
         {
             if (p_bg_dev && gatt_is_bg_dev_for_app(p_bg_dev, p_reg->gatt_if))
-                gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, TRUE, TRUE);
+                gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, true, true);
 
             if (p_reg->app_cb.p_conn_cb)
             {
                 conn_id = GATT_CREATE_CONN_ID(p_tcb->tcb_idx, p_reg->gatt_if);
                 (*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, p_tcb->peer_bda, conn_id,
-                                          TRUE, 0, p_tcb->transport);
+                                          true, 0, p_tcb->transport);
             }
         }
     }
@@ -972,9 +972,9 @@
 *******************************************************************************/
 void gatt_data_process (tGATT_TCB *p_tcb, BT_HDR *p_buf)
 {
-    UINT8   *p = (UINT8 *)(p_buf + 1) + p_buf->offset;
-    UINT8   op_code, pseudo_op_code;
-    UINT16  msg_len;
+    uint8_t *p = (uint8_t *)(p_buf + 1) + p_buf->offset;
+    uint8_t op_code, pseudo_op_code;
+    uint16_t msg_len;
 
     if (p_buf->len > 0)
     {
@@ -1027,11 +1027,11 @@
     tGATTS_SRV_CHG srv_chg_clt;
 
     memcpy(srv_chg_clt.bda, bda, BD_ADDR_LEN);
-    srv_chg_clt.srv_changed = FALSE;
+    srv_chg_clt.srv_changed = false;
     if (gatt_add_srv_chg_clt(&srv_chg_clt) != NULL)
     {
         memcpy(req.srv_chg.bda, bda, BD_ADDR_LEN);
-        req.srv_chg.srv_changed = FALSE;
+        req.srv_chg.srv_changed = false;
         if (gatt_cb.cb_info.p_srv_chg_callback)
             (*gatt_cb.cb_info.p_srv_chg_callback)(GATTS_SRV_CHG_CMD_ADD_CLIENT, &req, NULL);
     }
@@ -1049,9 +1049,9 @@
 *******************************************************************************/
 void gatt_send_srv_chg_ind (BD_ADDR peer_bda)
 {
-    UINT8   handle_range[GATT_SIZE_OF_SRV_CHG_HNDL_RANGE];
-    UINT8   *p = handle_range;
-    UINT16  conn_id;
+    uint8_t handle_range[GATT_SIZE_OF_SRV_CHG_HNDL_RANGE];
+    uint8_t *p = handle_range;
+    uint16_t conn_id;
 
     GATT_TRACE_DEBUG("gatt_send_srv_chg_ind");
 
@@ -1109,8 +1109,8 @@
 {
     tGATTS_SRV_CHG_REQ req;
     tGATTS_SRV_CHG_RSP rsp;
-    BOOLEAN status;
-    UINT8 num_clients,i;
+    bool    status;
+    uint8_t num_clients,i;
     tGATTS_SRV_CHG  srv_chg_clt;
 
     GATT_TRACE_DEBUG("gatt_init_srv_chg");
@@ -1126,13 +1126,13 @@
             while ((i <= num_clients) && status)
             {
                 req.client_read_index = i;
-                if ((status = (*gatt_cb.cb_info.p_srv_chg_callback)(GATTS_SRV_CHG_CMD_READ_CLENT, &req, &rsp)) == TRUE)
+                if ((status = (*gatt_cb.cb_info.p_srv_chg_callback)(GATTS_SRV_CHG_CMD_READ_CLENT, &req, &rsp)) == true)
                 {
                     memcpy(&srv_chg_clt, &rsp.srv_chg ,sizeof(tGATTS_SRV_CHG));
                     if (gatt_add_srv_chg_clt(&srv_chg_clt) == NULL)
                     {
                         GATT_TRACE_ERROR("Unable to add a service change client");
-                        status = FALSE;
+                        status = false;
                     }
                 }
                 i++;
@@ -1156,9 +1156,9 @@
 *******************************************************************************/
 void gatt_proc_srv_chg (void)
 {
-    UINT8               start_idx, found_idx;
+    uint8_t             start_idx, found_idx;
     BD_ADDR             bda;
-    BOOLEAN             srv_chg_ind_pending=FALSE;
+    bool                srv_chg_ind_pending=false;
     tGATT_TCB           *p_tcb;
     tBT_TRANSPORT      transport;
 
diff --git a/stack/gatt/gatt_sr.c b/stack/gatt/gatt_sr.c
index 58d28b7..85e9404 100644
--- a/stack/gatt/gatt_sr.c
+++ b/stack/gatt/gatt_sr.c
@@ -25,7 +25,7 @@
 #include "bt_target.h"
 #include "bt_utils.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 #include <string.h>
 #include "gatt_int.h"
 #include "l2c_api.h"
@@ -43,10 +43,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-UINT32 gatt_sr_enqueue_cmd (tGATT_TCB *p_tcb, UINT8 op_code, UINT16 handle)
+uint32_t gatt_sr_enqueue_cmd (tGATT_TCB *p_tcb, uint8_t op_code, uint16_t handle)
 {
     tGATT_SR_CMD   *p_cmd = &p_tcb->sr_cmd;
-    UINT32          trans_id = 0;
+    uint32_t        trans_id = 0;
 
     if ( (p_cmd->op_code == 0) ||
          (op_code == GATT_HANDLE_VALUE_CONF)) /* no pending request */
@@ -78,10 +78,10 @@
 **
 ** Description      This function check the server command queue is empty or not.
 **
-** Returns          TRUE if empty, FALSE if there is pending command.
+** Returns          true if empty, false if there is pending command.
 **
 *******************************************************************************/
-BOOLEAN gatt_sr_cmd_empty (tGATT_TCB *p_tcb)
+bool    gatt_sr_cmd_empty (tGATT_TCB *p_tcb)
 {
     return(p_tcb->sr_cmd.op_code == 0);
 }
@@ -115,15 +115,15 @@
 **
 ** Description      This function check the read multiple response.
 **
-** Returns          BOOLEAN if all replies have been received
+** Returns          bool    if all replies have been received
 **
 *******************************************************************************/
-static BOOLEAN process_read_multi_rsp (tGATT_SR_CMD *p_cmd, tGATT_STATUS status,
-                                       tGATTS_RSP *p_msg, UINT16 mtu)
+static bool    process_read_multi_rsp (tGATT_SR_CMD *p_cmd, tGATT_STATUS status,
+                                       tGATTS_RSP *p_msg, uint16_t mtu)
 {
-    UINT16          ii, total_len, len;
-    UINT8           *p;
-    BOOLEAN         is_overflow = FALSE;
+    uint16_t        ii, total_len, len;
+    uint8_t         *p;
+    bool            is_overflow = false;
 
     GATT_TRACE_DEBUG ("%s status=%d mtu=%d", __func__, status, mtu);
 
@@ -147,7 +147,7 @@
             len = sizeof(BT_HDR) + L2CAP_MIN_OFFSET + mtu;
             p_buf = (BT_HDR *)osi_calloc(len);
             p_buf->offset = L2CAP_MIN_OFFSET;
-            p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+            p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
             /* First byte in the response is the opcode */
             *p++ = GATT_RSP_READ_MULTI;
@@ -180,7 +180,7 @@
                     {
                         /* just send the partial response for the overflow case */
                         len = p_rsp->attr_value.len - (total_len - mtu);
-                        is_overflow = TRUE;
+                        is_overflow = true;
                         GATT_TRACE_DEBUG ("multi read overflow available len=%d val_len=%d", len, p_rsp->attr_value.len );
                     }
                     else
@@ -231,16 +231,16 @@
                 p_cmd->p_rsp_msg = p_buf;
             }
 
-            return(TRUE);
+            return(true);
         }
     }
     else    /* any handle read exception occurs, return error */
     {
-        return(TRUE);
+        return(true);
     }
 
     /* If here, still waiting */
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -254,7 +254,7 @@
 **
 *******************************************************************************/
 tGATT_STATUS gatt_sr_process_app_rsp (tGATT_TCB *p_tcb, tGATT_IF gatt_if,
-                                      UINT32 trans_id, UINT8 op_code,
+                                      uint32_t trans_id, uint8_t op_code,
                                       tGATT_STATUS status, tGATTS_RSP *p_msg)
 {
     tGATT_STATUS    ret_code = GATT_SUCCESS;
@@ -262,7 +262,7 @@
 
     GATT_TRACE_DEBUG("gatt_sr_process_app_rsp gatt_if=%d", gatt_if);
 
-    gatt_sr_update_cback_cnt(p_tcb, gatt_if, FALSE, FALSE);
+    gatt_sr_update_cback_cnt(p_tcb, gatt_if, false, false);
 
     if (op_code == GATT_REQ_READ_MULTI)
     {
@@ -273,7 +273,7 @@
     else
     {
         if (op_code == GATT_REQ_PREPARE_WRITE && status == GATT_SUCCESS)
-            gatt_sr_update_prep_cnt(p_tcb, gatt_if, TRUE, FALSE);
+            gatt_sr_update_prep_cnt(p_tcb, gatt_if, true, false);
 
         if (op_code == GATT_REQ_EXEC_WRITE && status != GATT_SUCCESS)
             gatt_sr_reset_cback_cnt(p_tcb);
@@ -285,7 +285,7 @@
         {
             if (p_tcb->sr_cmd.p_rsp_msg == NULL)
             {
-                p_tcb->sr_cmd.p_rsp_msg = attp_build_sr_msg (p_tcb, (UINT8)(op_code + 1), (tGATT_SR_MSG *)p_msg);
+                p_tcb->sr_cmd.p_rsp_msg = attp_build_sr_msg (p_tcb, (uint8_t)(op_code + 1), (tGATT_SR_MSG *)p_msg);
             }
             else
             {
@@ -302,7 +302,7 @@
         }
         else
         {
-            ret_code = gatt_send_error_rsp (p_tcb, status, op_code, p_tcb->sr_cmd.handle, FALSE);
+            ret_code = gatt_send_error_rsp (p_tcb, status, op_code, p_tcb->sr_cmd.handle, false);
         }
 
         gatt_dequeue_sr_cmd(p_tcb);
@@ -323,22 +323,22 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_process_exec_write_req (tGATT_TCB *p_tcb, UINT8 op_code, UINT16 len, UINT8 *p_data)
+void gatt_process_exec_write_req (tGATT_TCB *p_tcb, uint8_t op_code, uint16_t len, uint8_t *p_data)
 {
-    UINT8   *p = p_data, flag, i = 0;
-    UINT32  trans_id = 0;
+    uint8_t *p = p_data, flag, i = 0;
+    uint32_t trans_id = 0;
     tGATT_IF gatt_if;
-    UINT16  conn_id;
+    uint16_t conn_id;
 
     UNUSED(len);
 
-#if GATT_CONFORMANCE_TESTING == TRUE
+#if (GATT_CONFORMANCE_TESTING == TRUE)
     if (gatt_cb.enable_err_rsp && gatt_cb.req_op_code == op_code)
     {
         GATT_TRACE_DEBUG("Conformance tst: forced err rspv for Execute Write: error status=%d",
         gatt_cb.err_status);
 
-        gatt_send_error_rsp (p_tcb, gatt_cb.err_status, gatt_cb.req_op_code, gatt_cb.handle, FALSE);
+        gatt_send_error_rsp (p_tcb, gatt_cb.err_status, gatt_cb.req_op_code, gatt_cb.handle, false);
 
         return;
     }
@@ -373,7 +373,7 @@
     else /* nothing needs to be executed , send response now */
     {
         GATT_TRACE_ERROR("gatt_process_exec_write_req: no prepare write pending");
-        gatt_send_error_rsp(p_tcb, GATT_ERROR, GATT_REQ_EXEC_WRITE, 0, FALSE);
+        gatt_send_error_rsp(p_tcb, GATT_ERROR, GATT_REQ_EXEC_WRITE, 0, false);
     }
 }
 
@@ -387,13 +387,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_process_read_multi_req (tGATT_TCB *p_tcb, UINT8 op_code, UINT16 len, UINT8 *p_data)
+void gatt_process_read_multi_req (tGATT_TCB *p_tcb, uint8_t op_code, uint16_t len, uint8_t *p_data)
 {
-    UINT32          trans_id;
-    UINT16          handle = 0, ll = len;
-    UINT8           *p = p_data, i_rcb;
+    uint32_t        trans_id;
+    uint16_t        handle = 0, ll = len;
+    uint8_t         *p = p_data, i_rcb;
     tGATT_STATUS    err = GATT_SUCCESS;
-    UINT8           sec_flag, key_size;
+    uint8_t         sec_flag, key_size;
 
     GATT_TRACE_DEBUG("gatt_process_read_multi_req" );
     p_tcb->sr_cmd.multi_req.num_handles = 0;
@@ -403,14 +403,14 @@
                          &sec_flag,
                          &key_size);
 
-#if GATT_CONFORMANCE_TESTING == TRUE
+#if (GATT_CONFORMANCE_TESTING == TRUE)
     if (gatt_cb.enable_err_rsp && gatt_cb.req_op_code == op_code)
     {
         GATT_TRACE_DEBUG("Conformance tst: forced err rspvofr ReadMultiple: error status=%d", gatt_cb.err_status);
 
         STREAM_TO_UINT16(handle, p);
 
-        gatt_send_error_rsp (p_tcb, gatt_cb.err_status, gatt_cb.req_op_code, handle, FALSE);
+        gatt_send_error_rsp (p_tcb, gatt_cb.err_status, gatt_cb.req_op_code, handle, false);
 
         return;
     }
@@ -426,7 +426,7 @@
 
             /* check read permission */
             if ((err = gatts_read_attr_perm_check(   gatt_cb.sr_reg[i_rcb].p_db,
-                                                     FALSE,
+                                                     false,
                                                      handle,
                                                      sec_flag,
                                                      key_size))
@@ -490,7 +490,7 @@
 
     /* in theroy BUSY is not possible(should already been checked), protected check */
     if (err != GATT_SUCCESS && err != GATT_PENDING && err != GATT_BUSY)
-        gatt_send_error_rsp(p_tcb, err, op_code, handle, FALSE);
+        gatt_send_error_rsp(p_tcb, err, op_code, handle, false);
 }
 
 /*******************************************************************************
@@ -504,11 +504,11 @@
 **
 *******************************************************************************/
 static tGATT_STATUS gatt_build_primary_service_rsp (BT_HDR *p_msg, tGATT_TCB *p_tcb,
-                                                    UINT8 op_code, UINT16 s_hdl,
-                                                    UINT16 e_hdl, UINT8 *p_data, tBT_UUID value)
+                                                    uint8_t op_code, uint16_t s_hdl,
+                                                    uint16_t e_hdl, uint8_t *p_data, tBT_UUID value)
 {
     tGATT_STATUS    status = GATT_NOT_FOUND;
-    UINT8           handle_len =4, *p ;
+    uint8_t         handle_len =4, *p ;
     tGATT_SR_REG    *p_rcb;
     tGATT_SRV_LIST_INFO *p_list= &gatt_cb.srv_list_info;
     tGATT_SRV_LIST_ELEM  *p_srv=NULL;
@@ -516,7 +516,7 @@
 
     UNUSED(p_data);
 
-    p = (UINT8 *)(p_msg + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_msg + 1) + L2CAP_MIN_OFFSET;
 
     p_srv = p_list->p_first;
 
@@ -543,7 +543,7 @@
 
                     if (op_code == GATT_REQ_READ_BY_GRP_TYPE)
                     {
-                        *p ++ =  (UINT8)p_msg->offset; /* length byte */
+                        *p ++ =  (uint8_t)p_msg->offset; /* length byte */
                         p_msg->len ++;
                     }
                 }
@@ -592,18 +592,18 @@
 ** Description      fill the find information response information in the given
 **                  buffer.
 **
-** Returns          TRUE: if data filled sucessfully.
-**                  FALSE: packet full, or format mismatch.
+** Returns          true: if data filled sucessfully.
+**                  false: packet full, or format mismatch.
 **
 *******************************************************************************/
-static tGATT_STATUS gatt_build_find_info_rsp(tGATT_SR_REG *p_rcb, BT_HDR *p_msg, UINT16 *p_len,
-                                             UINT16 s_hdl, UINT16 e_hdl)
+static tGATT_STATUS gatt_build_find_info_rsp(tGATT_SR_REG *p_rcb, BT_HDR *p_msg, uint16_t *p_len,
+                                             uint16_t s_hdl, uint16_t e_hdl)
 {
     tGATT_STATUS        status = GATT_NOT_FOUND;
-    UINT8               *p;
-    UINT16              len = *p_len;
+    uint8_t             *p;
+    uint16_t            len = *p_len;
     tGATT_ATTR        *p_attr = NULL;
-    UINT8               info_pair_len[2] = {4, 18};
+    uint8_t             info_pair_len[2] = {4, 18};
 
     if (!p_rcb->p_db || !p_rcb->p_db->p_attr_list)
         return status;
@@ -611,7 +611,7 @@
     /* check the attribute database */
     p_attr = (tGATT_ATTR *) p_rcb->p_db->p_attr_list;
 
-    p = (UINT8 *)(p_msg + 1) + L2CAP_MIN_OFFSET + p_msg->len;
+    p = (uint8_t *)(p_msg + 1) + L2CAP_MIN_OFFSET + p_msg->len;
 
     while (p_attr)
     {
@@ -677,14 +677,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-static tGATT_STATUS gatts_validate_packet_format(UINT8 op_code, UINT16 *p_len,
-                                                 UINT8 **p_data, tBT_UUID *p_uuid_filter,
-                                                 UINT16 *p_s_hdl, UINT16 *p_e_hdl)
+static tGATT_STATUS gatts_validate_packet_format(uint8_t op_code, uint16_t *p_len,
+                                                 uint8_t **p_data, tBT_UUID *p_uuid_filter,
+                                                 uint16_t *p_s_hdl, uint16_t *p_e_hdl)
 {
     tGATT_STATUS    reason = GATT_SUCCESS;
-    UINT16          uuid_len, s_hdl = 0, e_hdl = 0;
-    UINT16          len = *p_len;
-    UINT8           *p = *p_data;
+    uint16_t        uuid_len, s_hdl = 0, e_hdl = 0;
+    uint16_t        len = *p_len;
+    uint8_t         *p = *p_data;
 
     if (len >= 4)
     {
@@ -707,7 +707,7 @@
                 uuid_len = (op_code == GATT_REQ_FIND_TYPE_VALUE) ? 2 : len;
 
                 /* parse uuid now */
-                if (gatt_parse_uuid_from_cmd (p_uuid_filter, uuid_len, &p) == FALSE ||
+                if (gatt_parse_uuid_from_cmd (p_uuid_filter, uuid_len, &p) == false ||
                     p_uuid_filter->len == 0)
                 {
                     GATT_TRACE_DEBUG("UUID filter does not exsit");
@@ -741,13 +741,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatts_process_primary_service_req(tGATT_TCB *p_tcb, UINT8 op_code, UINT16 len, UINT8 *p_data)
+void gatts_process_primary_service_req(tGATT_TCB *p_tcb, uint8_t op_code, uint16_t len, uint8_t *p_data)
 {
-    UINT8           reason = GATT_INVALID_PDU;
-    UINT16          s_hdl = 0, e_hdl = 0;
+    uint8_t         reason = GATT_INVALID_PDU;
+    uint16_t        s_hdl = 0, e_hdl = 0;
     tBT_UUID        uuid, value, primary_service = {LEN_UUID_16, {GATT_UUID_PRI_SERVICE}};
     BT_HDR          *p_msg = NULL;
-    UINT16          msg_len = (UINT16)(sizeof(BT_HDR) + p_tcb->payload_size + L2CAP_MIN_OFFSET);
+    uint16_t        msg_len = (uint16_t)(sizeof(BT_HDR) + p_tcb->payload_size + L2CAP_MIN_OFFSET);
 
     memset (&value, 0, sizeof(tBT_UUID));
     reason = gatts_validate_packet_format(op_code, &len, &p_data, &uuid, &s_hdl, &e_hdl);
@@ -758,7 +758,7 @@
         {
             if (op_code == GATT_REQ_FIND_TYPE_VALUE)
             {
-                if (gatt_parse_uuid_from_cmd(&value, len, &p_data) == FALSE)
+                if (gatt_parse_uuid_from_cmd(&value, len, &p_data) == false)
                     reason = GATT_INVALID_PDU;
             }
 
@@ -788,7 +788,7 @@
     if (reason != GATT_SUCCESS)
     {
         osi_free(p_msg);
-        gatt_send_error_rsp (p_tcb, reason, op_code, s_hdl, FALSE);
+        gatt_send_error_rsp (p_tcb, reason, op_code, s_hdl, false);
     }
     else
         attp_send_sr_msg(p_tcb, p_msg);
@@ -805,10 +805,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatts_process_find_info(tGATT_TCB *p_tcb, UINT8 op_code, UINT16 len, UINT8 *p_data)
+static void gatts_process_find_info(tGATT_TCB *p_tcb, uint8_t op_code, uint16_t len, uint8_t *p_data)
 {
-    UINT8           reason = GATT_INVALID_PDU, *p;
-    UINT16          s_hdl = 0, e_hdl = 0, buf_len;
+    uint8_t         reason = GATT_INVALID_PDU, *p;
+    uint16_t        s_hdl = 0, e_hdl = 0, buf_len;
     BT_HDR          *p_msg = NULL;
     tGATT_SR_REG    *p_rcb;
     tGATT_SRV_LIST_INFO *p_list= &gatt_cb.srv_list_info;
@@ -818,12 +818,12 @@
 
     if (reason == GATT_SUCCESS)
     {
-        buf_len = (UINT16)(sizeof(BT_HDR) + p_tcb->payload_size + L2CAP_MIN_OFFSET);
+        buf_len = (uint16_t)(sizeof(BT_HDR) + p_tcb->payload_size + L2CAP_MIN_OFFSET);
 
         p_msg = (BT_HDR *)osi_calloc(buf_len);
         reason = GATT_NOT_FOUND;
 
-        p = (UINT8 *)(p_msg + 1) + L2CAP_MIN_OFFSET;
+        p = (uint8_t *)(p_msg + 1) + L2CAP_MIN_OFFSET;
         *p ++ = op_code + 1;
         p_msg->len = 2;
 
@@ -845,7 +845,7 @@
             }
             p_srv = p_srv->p_next;
         }
-        *p = (UINT8)p_msg->offset;
+        *p = (uint8_t)p_msg->offset;
 
         p_msg->offset = L2CAP_MIN_OFFSET;
     }
@@ -853,7 +853,7 @@
     if (reason != GATT_SUCCESS)
     {
         osi_free(p_msg);
-        gatt_send_error_rsp (p_tcb, reason, op_code, s_hdl, FALSE);
+        gatt_send_error_rsp (p_tcb, reason, op_code, s_hdl, false);
     }
     else
         attp_send_sr_msg(p_tcb, p_msg);
@@ -870,22 +870,22 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatts_process_mtu_req (tGATT_TCB *p_tcb, UINT16 len, UINT8 *p_data)
+static void gatts_process_mtu_req (tGATT_TCB *p_tcb, uint16_t len, uint8_t *p_data)
 {
-    UINT16        mtu = 0;
-    UINT8         *p = p_data, i;
+    uint16_t      mtu = 0;
+    uint8_t       *p = p_data, i;
     BT_HDR        *p_buf;
-    UINT16   conn_id;
+    uint16_t conn_id;
 
     /* BR/EDR conenction, send error response */
     if (p_tcb->att_lcid != L2CAP_ATT_CID)
     {
-        gatt_send_error_rsp (p_tcb, GATT_REQ_NOT_SUPPORTED, GATT_REQ_MTU, 0, FALSE);
+        gatt_send_error_rsp (p_tcb, GATT_REQ_NOT_SUPPORTED, GATT_REQ_MTU, 0, false);
     }
     else if (len < GATT_MTU_REQ_MIN_LEN)
     {
         GATT_TRACE_ERROR("invalid MTU request PDU received.");
-        gatt_send_error_rsp (p_tcb, GATT_INVALID_PDU, GATT_REQ_MTU, 0, FALSE);
+        gatt_send_error_rsp (p_tcb, GATT_INVALID_PDU, GATT_REQ_MTU, 0, false);
     }
     else
     {
@@ -938,27 +938,27 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatts_process_read_by_type_req(tGATT_TCB *p_tcb, UINT8 op_code, UINT16 len, UINT8 *p_data)
+void gatts_process_read_by_type_req(tGATT_TCB *p_tcb, uint8_t op_code, uint16_t len, uint8_t *p_data)
 {
     tBT_UUID            uuid;
     tGATT_SR_REG        *p_rcb;
     size_t              msg_len = sizeof(BT_HDR) + p_tcb->payload_size + L2CAP_MIN_OFFSET;
-    UINT16              buf_len, s_hdl, e_hdl, err_hdl = 0;
+    uint16_t            buf_len, s_hdl, e_hdl, err_hdl = 0;
     BT_HDR              *p_msg = NULL;
     tGATT_STATUS        reason, ret;
-    UINT8               *p;
-    UINT8               sec_flag, key_size;
+    uint8_t             *p;
+    uint8_t             sec_flag, key_size;
     tGATT_SRV_LIST_INFO *p_list= &gatt_cb.srv_list_info;
     tGATT_SRV_LIST_ELEM  *p_srv=NULL;
 
     reason = gatts_validate_packet_format(op_code, &len, &p_data, &uuid, &s_hdl, &e_hdl);
 
-#if GATT_CONFORMANCE_TESTING == TRUE
+#if (GATT_CONFORMANCE_TESTING == TRUE)
     if (gatt_cb.enable_err_rsp && gatt_cb.req_op_code == op_code)
     {
         GATT_TRACE_DEBUG("Conformance tst: forced err rsp for ReadByType: error status=%d", gatt_cb.err_status);
 
-        gatt_send_error_rsp (p_tcb, gatt_cb.err_status, gatt_cb.req_op_code, s_hdl, FALSE);
+        gatt_send_error_rsp (p_tcb, gatt_cb.err_status, gatt_cb.req_op_code, s_hdl, false);
 
         return;
     }
@@ -967,7 +967,7 @@
     if (reason == GATT_SUCCESS)
     {
         p_msg = (BT_HDR *)osi_calloc(msg_len);
-        p = (UINT8 *)(p_msg + 1) + L2CAP_MIN_OFFSET;
+        p = (uint8_t *)(p_msg + 1) + L2CAP_MIN_OFFSET;
 
         *p ++ = op_code + 1;
         /* reserve length byte */
@@ -1011,7 +1011,7 @@
             }
             p_srv = p_srv->p_next;
         }
-        *p = (UINT8)p_msg->offset;
+        *p = (uint8_t)p_msg->offset;
         p_msg->offset = L2CAP_MIN_OFFSET;
     }
     if (reason != GATT_SUCCESS)
@@ -1020,7 +1020,7 @@
 
         /* in theroy BUSY is not possible(should already been checked), protected check */
         if (reason != GATT_PENDING && reason != GATT_BUSY)
-            gatt_send_error_rsp (p_tcb, reason, op_code, s_hdl, FALSE);
+            gatt_send_error_rsp (p_tcb, reason, op_code, s_hdl, false);
     }
     else
         attp_send_sr_msg(p_tcb, p_msg);
@@ -1037,16 +1037,16 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatts_process_write_req (tGATT_TCB *p_tcb, UINT8 i_rcb, UINT16 handle,
-                              UINT8 op_code, UINT16 len, UINT8 *p_data,
+void gatts_process_write_req (tGATT_TCB *p_tcb, uint8_t i_rcb, uint16_t handle,
+                              uint8_t op_code, uint16_t len, uint8_t *p_data,
                               bt_gatt_db_attribute_type_t gatt_type)
 {
     tGATTS_DATA     sr_data;
-    UINT32          trans_id;
+    uint32_t        trans_id;
     tGATT_STATUS    status;
-    UINT8           sec_flag, key_size, *p = p_data;
+    uint8_t         sec_flag, key_size, *p = p_data;
     tGATT_SR_REG    *p_sreg;
-    UINT16          conn_id;
+    uint16_t        conn_id;
 
     memset(&sr_data, 0, sizeof(tGATTS_DATA));
 
@@ -1055,10 +1055,10 @@
         case GATT_REQ_PREPARE_WRITE:
             if (len < 2) {
                 GATT_TRACE_ERROR("%s: Prepare write request was invalid - missing offset, sending error response", __func__);
-                gatt_send_error_rsp(p_tcb, GATT_INVALID_PDU, op_code, handle, FALSE);
+                gatt_send_error_rsp(p_tcb, GATT_INVALID_PDU, op_code, handle, false);
                 return;
             }
-            sr_data.write_req.is_prep = TRUE;
+            sr_data.write_req.is_prep = true;
             STREAM_TO_UINT16(sr_data.write_req.offset, p);
             len -= 2;
             /* fall through */
@@ -1072,7 +1072,7 @@
         case GATT_CMD_WRITE:
         case GATT_REQ_WRITE:
             if (op_code == GATT_REQ_WRITE || op_code == GATT_REQ_PREPARE_WRITE)
-                sr_data.write_req.need_rsp = TRUE;
+                sr_data.write_req.need_rsp = true;
             sr_data.write_req.handle = handle;
             sr_data.write_req.len = len;
             if (len != 0 && p != NULL)
@@ -1103,7 +1103,7 @@
             p_sreg = &gatt_cb.sr_reg[i_rcb];
             conn_id = GATT_CREATE_CONN_ID(p_tcb->tcb_idx, p_sreg->gatt_if);
 
-            UINT8 opcode = 0;
+            uint8_t opcode = 0;
             if (gatt_type == BTGATT_DB_DESCRIPTOR) {
                 opcode = GATTS_REQ_TYPE_WRITE_DESCRIPTOR;
             } else if (gatt_type == BTGATT_DB_CHARACTERISTIC) {
@@ -1130,7 +1130,7 @@
     if (status != GATT_PENDING && status != GATT_BUSY &&
         (op_code == GATT_REQ_PREPARE_WRITE || op_code == GATT_REQ_WRITE))
     {
-        gatt_send_error_rsp (p_tcb, status, op_code, handle, FALSE);
+        gatt_send_error_rsp (p_tcb, status, op_code, handle, false);
     }
     return;
 }
@@ -1145,13 +1145,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void gatts_process_read_req(tGATT_TCB *p_tcb, tGATT_SR_REG *p_rcb, UINT8 op_code,
-                                   UINT16 handle, UINT16 len, UINT8 *p_data)
+static void gatts_process_read_req(tGATT_TCB *p_tcb, tGATT_SR_REG *p_rcb, uint8_t op_code,
+                                   uint16_t handle, uint16_t len, uint8_t *p_data)
 {
     size_t          buf_len = sizeof(BT_HDR) + p_tcb->payload_size + L2CAP_MIN_OFFSET;
     tGATT_STATUS    reason;
-    UINT8           sec_flag, key_size, *p;
-    UINT16          offset = 0, value_len = 0;
+    uint8_t         sec_flag, key_size, *p;
+    uint16_t        offset = 0, value_len = 0;
     BT_HDR          *p_msg = (BT_HDR *)osi_calloc(buf_len);
 
     UNUSED(len);
@@ -1159,7 +1159,7 @@
     if (op_code == GATT_REQ_READ_BLOB)
         STREAM_TO_UINT16(offset, p_data);
 
-    p = (UINT8 *)(p_msg + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_msg + 1) + L2CAP_MIN_OFFSET;
     *p ++ = op_code + 1;
     p_msg->len = 1;
     buf_len = p_tcb->payload_size - 1;
@@ -1187,7 +1187,7 @@
 
         /* in theroy BUSY is not possible(should already been checked), protected check */
         if (reason != GATT_PENDING && reason != GATT_BUSY)
-            gatt_send_error_rsp (p_tcb, reason, op_code, handle, FALSE);
+            gatt_send_error_rsp (p_tcb, reason, op_code, handle, false);
     }
     else
         attp_send_sr_msg(p_tcb, p_msg);
@@ -1204,11 +1204,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatts_process_attribute_req (tGATT_TCB *p_tcb, UINT8 op_code,
-                                  UINT16 len, UINT8 *p_data)
+void gatts_process_attribute_req (tGATT_TCB *p_tcb, uint8_t op_code,
+                                  uint16_t len, uint8_t *p_data)
 {
-    UINT16          handle = 0;
-    UINT8           *p = p_data, i;
+    uint16_t        handle = 0;
+    uint8_t         *p = p_data, i;
     tGATT_SR_REG    *p_rcb = gatt_cb.sr_reg;
     tGATT_STATUS    status = GATT_INVALID_HANDLE;
     tGATT_ATTR    *p_attr;
@@ -1224,13 +1224,13 @@
         len -= 2;
     }
 
-#if GATT_CONFORMANCE_TESTING == TRUE
+#if (GATT_CONFORMANCE_TESTING == TRUE)
     gatt_cb.handle = handle;
     if (gatt_cb.enable_err_rsp && gatt_cb.req_op_code == op_code)
     {
         GATT_TRACE_DEBUG("Conformance tst: forced err rsp: error status=%d", gatt_cb.err_status);
 
-        gatt_send_error_rsp (p_tcb, gatt_cb.err_status, gatt_cb.req_op_code, handle, FALSE);
+        gatt_send_error_rsp (p_tcb, gatt_cb.err_status, gatt_cb.req_op_code, handle, false);
 
         return;
     }
@@ -1276,7 +1276,7 @@
     }
 
     if (status != GATT_SUCCESS && op_code != GATT_CMD_WRITE && op_code != GATT_SIGN_CMD_WRITE)
-        gatt_send_error_rsp (p_tcb, status, op_code, handle, FALSE);
+        gatt_send_error_rsp (p_tcb, status, op_code, handle, false);
 }
 
 /*******************************************************************************
@@ -1297,8 +1297,8 @@
 
     if ((p_buf = gatt_is_bda_in_the_srv_chg_clt_list(p_tcb->peer_bda)) != NULL)
     {
-        GATT_TRACE_DEBUG("NV update set srv chg = FALSE");
-        p_buf->srv_changed = FALSE;
+        GATT_TRACE_DEBUG("NV update set srv chg = false");
+        p_buf->srv_changed = false;
         memcpy(&req.srv_chg, p_buf, sizeof(tGATTS_SRV_CHG));
         if (gatt_cb.cb_info.p_srv_chg_callback)
             (*gatt_cb.cb_info.p_srv_chg_callback)(GATTS_SRV_CHG_CMD_UPDATE_CLIENT,&req, NULL);
@@ -1337,13 +1337,13 @@
 **
 ** Description      This function process the Indication ack
 **
-** Returns          TRUE continue to process the indication ack by the aaplication
+** Returns          true continue to process the indication ack by the aaplication
 **                  if the ACk is not a Service Changed Indication Ack
 **
 *******************************************************************************/
-static BOOLEAN gatts_proc_ind_ack(tGATT_TCB *p_tcb, UINT16 ack_handle)
+static bool    gatts_proc_ind_ack(tGATT_TCB *p_tcb, uint16_t ack_handle)
 {
-    BOOLEAN continue_processing = TRUE;
+    bool    continue_processing = true;
 
     GATT_TRACE_DEBUG ("gatts_proc_ind_ack ack handle=%d", ack_handle);
 
@@ -1351,7 +1351,7 @@
     {
         gatts_proc_srv_chg_ind_ack(p_tcb);
         /* there is no need to inform the application since srv chg is handled internally by GATT */
-        continue_processing = FALSE;
+        continue_processing = false;
     }
 
     gatts_chk_pending_ind(p_tcb);
@@ -1367,14 +1367,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatts_process_value_conf(tGATT_TCB *p_tcb, UINT8 op_code)
+void gatts_process_value_conf(tGATT_TCB *p_tcb, uint8_t op_code)
 {
-    UINT16          handle = p_tcb->indicate_handle;
-    UINT32          trans_id;
-    UINT8           i;
+    uint16_t        handle = p_tcb->indicate_handle;
+    uint32_t        trans_id;
+    uint8_t         i;
     tGATT_SR_REG    *p_rcb = gatt_cb.sr_reg;
-    BOOLEAN         continue_processing;
-    UINT16          conn_id;
+    bool            continue_processing;
+    uint16_t        conn_id;
 
     alarm_cancel(p_tcb->conf_timer);
     if (GATT_HANDLE_IS_VALID(handle))
@@ -1413,8 +1413,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_server_handle_client_req (tGATT_TCB *p_tcb, UINT8 op_code,
-                                    UINT16 len, UINT8 *p_data)
+void gatt_server_handle_client_req (tGATT_TCB *p_tcb, uint8_t op_code,
+                                    uint16_t len, uint8_t *p_data)
 {
     /* there is pending command, discard this one */
     if (!gatt_sr_cmd_empty(p_tcb) && op_code != GATT_HANDLE_VALUE_CONF)
@@ -1430,7 +1430,7 @@
             op_code != GATT_SIGN_CMD_WRITE &&
             op_code != GATT_HANDLE_VALUE_CONF)
         {
-            gatt_send_error_rsp (p_tcb, GATT_INVALID_PDU, op_code, 0, FALSE);
+            gatt_send_error_rsp (p_tcb, GATT_INVALID_PDU, op_code, 0, false);
         }
         /* otherwise, ignore the pkt */
     }
diff --git a/stack/gatt/gatt_utils.c b/stack/gatt/gatt_utils.c
index e8a6cf1..9d77ed9 100644
--- a/stack/gatt/gatt_utils.c
+++ b/stack/gatt/gatt_utils.c
@@ -24,7 +24,7 @@
 #include "bt_target.h"
 #include "bt_utils.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     #include <string.h>
     #include "stdio.h"
     #include "bt_common.h"
@@ -76,7 +76,7 @@
     "ATT_OP_CODE_MAX"
 };
 
-static const UINT8  base_uuid[LEN_UUID_128] = {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
+static const uint8_t base_uuid[LEN_UUID_128] = {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
     0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
 extern fixed_queue_t *btu_general_alarm_queue;
@@ -159,7 +159,7 @@
 **
 ** Function         gatt_set_srv_chg
 **
-** Description      Set the service changed flag to TRUE
+** Description      Set the service changed flag to true
 **
 ** Returns        None
 **
@@ -179,8 +179,8 @@
         tGATTS_SRV_CHG *p_buf = (tGATTS_SRV_CHG *)list_node(node);
         if (!p_buf->srv_changed)
         {
-            GATT_TRACE_DEBUG("set srv_changed to TRUE");
-            p_buf->srv_changed = TRUE;
+            GATT_TRACE_DEBUG("set srv_changed to true");
+            p_buf->srv_changed = true;
             tGATTS_SRV_CHG_REQ req;
             memcpy(&req.srv_chg, p_buf, sizeof(tGATTS_SRV_CHG));
             if (gatt_cb.cb_info.p_srv_chg_callback)
@@ -244,7 +244,7 @@
 *******************************************************************************/
 tGATT_HDL_LIST_ELEM *gatt_alloc_hdl_buffer(void)
 {
-    UINT8 i;
+    uint8_t i;
     tGATT_CB    *p_cb = &gatt_cb;
     tGATT_HDL_LIST_ELEM * p_elem= &p_cb->hdl_list[0];
 
@@ -253,7 +253,7 @@
         if (!p_cb->hdl_list[i].in_use)
         {
             memset(p_elem, 0, sizeof(tGATT_HDL_LIST_ELEM));
-            p_elem->in_use = TRUE;
+            p_elem->in_use = true;
             p_elem->svc_db.svc_buffer = fixed_queue_new(SIZE_MAX);
             return p_elem;
         }
@@ -271,7 +271,7 @@
 ** Returns    Pointer to the buffer, NULL no buffer available
 **
 *******************************************************************************/
-tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_handle(UINT16 handle)
+tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_handle(uint16_t handle)
 {
     tGATT_HDL_LIST_INFO *p_list_info= &gatt_cb.hdl_list_info;
     tGATT_HDL_LIST_ELEM      *p_list = NULL;
@@ -299,7 +299,7 @@
 *******************************************************************************/
 tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_app_id (tBT_UUID *p_app_uuid128,
                                                      tBT_UUID *p_svc_uuid,
-                                                     UINT16 start_handle)
+                                                     uint16_t start_handle)
 {
     tGATT_HDL_LIST_INFO *p_list_info= &gatt_cb.hdl_list_info;
     tGATT_HDL_LIST_ELEM      *p_list = NULL;
@@ -352,7 +352,7 @@
 void gatt_free_srvc_db_buffer_app_id(tBT_UUID *p_app_id)
 {
     tGATT_HDL_LIST_ELEM *p_elem =  &gatt_cb.hdl_list[0];
-    UINT8   i;
+    uint8_t i;
 
     for (i = 0; i < GATT_MAX_SR_PROFILES; i ++, p_elem ++)
     {
@@ -374,13 +374,13 @@
 **
 ** Description     Check this is the last attribute of the specified value or not
 **
-** Returns       TRUE - yes this is the last attribute
+** Returns       true - yes this is the last attribute
 **
 *******************************************************************************/
-BOOLEAN gatt_is_last_attribute(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_start, tBT_UUID value)
+bool    gatt_is_last_attribute(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_start, tBT_UUID value)
 {
     tGATT_SRV_LIST_ELEM *p_srv= p_start->p_next;
-    BOOLEAN              is_last_attribute = TRUE;
+    bool                 is_last_attribute = true;
     tGATT_SR_REG        *p_rcb = NULL;
     tBT_UUID            *p_svc_uuid;
 
@@ -394,7 +394,7 @@
 
         if (gatt_uuid_compare(value, *p_svc_uuid))
         {
-            is_last_attribute = FALSE;
+            is_last_attribute = false;
             break;
 
         }
@@ -439,11 +439,11 @@
 ** Returns          None.
 **
 *******************************************************************************/
-void gatts_update_srv_list_elem(UINT8 i_sreg, UINT16 handle, BOOLEAN is_primary)
+void gatts_update_srv_list_elem(uint8_t i_sreg, uint16_t handle, bool    is_primary)
 {
     UNUSED(handle);
 
-    gatt_cb.srv_list[i_sreg].in_use         = TRUE;
+    gatt_cb.srv_list[i_sreg].in_use         = true;
     gatt_cb.srv_list[i_sreg].i_sreg    = i_sreg;
     gatt_cb.srv_list[i_sreg].s_hdl          = gatt_cb.sr_reg[i_sreg].s_hdl;
     gatt_cb.srv_list[i_sreg].is_primary     = is_primary;
@@ -457,17 +457,17 @@
 ** Description  add an service to the list in ascending
 **              order of the start handle
 **
-** Returns   BOOLEAN TRUE-if add is successful
+** Returns   bool    true-if add is successful
 **
 *******************************************************************************/
-BOOLEAN gatt_add_a_srv_to_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_new)
+bool    gatt_add_a_srv_to_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_new)
 {
     tGATT_SRV_LIST_ELEM *p_old;
 
     if (!p_new)
     {
         GATT_TRACE_DEBUG("p_new==NULL");
-        return FALSE;
+        return false;
     }
 
     if (!p_list->p_first)
@@ -513,7 +513,7 @@
     p_list->count++;
 
     gatt_update_last_pri_srv_info(p_list);
-    return TRUE;
+    return true;
 
 }
 
@@ -523,15 +523,15 @@
 **
 ** Description  Remove a service from the list
 **
-** Returns   BOOLEAN TRUE-if remove is successful
+** Returns   bool    true-if remove is successful
 **
 *******************************************************************************/
-BOOLEAN gatt_remove_a_srv_from_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_remove)
+bool    gatt_remove_a_srv_from_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_remove)
 {
     if (!p_remove || !p_list->p_first)
     {
         GATT_TRACE_DEBUG("p_remove==NULL || p_list->p_first==NULL");
-        return FALSE;
+        return false;
     }
 
     if (p_remove->p_prev == NULL)
@@ -552,7 +552,7 @@
     }
     p_list->count--;
     gatt_update_last_pri_srv_info(p_list);
-    return TRUE;
+    return true;
 
 }
 
@@ -563,16 +563,16 @@
 ** Description  add an service handle range to the list in decending
 **              order of the start handle
 **
-** Returns   BOOLEAN TRUE-if add is successful
+** Returns   bool    true-if add is successful
 **
 *******************************************************************************/
-BOOLEAN gatt_add_an_item_to_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_new)
+bool    gatt_add_an_item_to_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_new)
 {
     tGATT_HDL_LIST_ELEM *p_old;
     if (!p_new)
     {
         GATT_TRACE_DEBUG("p_new==NULL");
-        return FALSE;
+        return false;
     }
 
     if (!p_list->p_first)
@@ -617,7 +617,7 @@
         }
     }
     p_list->count++;
-    return TRUE;
+    return true;
 
 }
 
@@ -627,15 +627,15 @@
 **
 ** Description  Remove an service handle range from the list
 **
-** Returns   BOOLEAN TRUE-if remove is successful
+** Returns   bool    true-if remove is successful
 **
 *******************************************************************************/
-BOOLEAN gatt_remove_an_item_from_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_remove)
+bool    gatt_remove_an_item_from_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_remove)
 {
     if (!p_remove || !p_list->p_first)
     {
         GATT_TRACE_DEBUG("p_remove==NULL || p_list->p_first==NULL");
-        return FALSE;
+        return false;
     }
 
     if (p_remove->p_prev == NULL)
@@ -655,7 +655,7 @@
         p_remove->p_prev->p_next = p_remove->p_next;
     }
     p_list->count--;
-    return TRUE;
+    return true;
 
 }
 
@@ -665,14 +665,14 @@
 **
 ** Description      This function find the connected bda
 **
-** Returns           TRUE if found
+** Returns           true if found
 **
 *******************************************************************************/
-BOOLEAN gatt_find_the_connected_bda(UINT8 start_idx, BD_ADDR bda, UINT8 *p_found_idx,
+bool    gatt_find_the_connected_bda(uint8_t start_idx, BD_ADDR bda, uint8_t *p_found_idx,
                                     tBT_TRANSPORT *p_transport)
 {
-    UINT8 i;
-    BOOLEAN found = FALSE;
+    uint8_t i;
+    bool    found = false;
     GATT_TRACE_DEBUG("gatt_find_the_connected_bda start_idx=%d",start_idx);
 
     for (i = start_idx ; i < GATT_MAX_PHY_CHANNEL; i ++)
@@ -682,7 +682,7 @@
             memcpy( bda, gatt_cb.tcb[i].peer_bda, BD_ADDR_LEN);
             *p_found_idx = i;
             *p_transport = gatt_cb.tcb[i].transport;
-            found = TRUE;
+            found = true;
             GATT_TRACE_DEBUG("gatt_find_the_connected_bda bda :%02x-%02x-%02x-%02x-%02x-%02x",
                               bda[0],  bda[1], bda[2],  bda[3], bda[4],  bda[5]);
             break;
@@ -701,19 +701,19 @@
 ** Description      Check whether a service chnaged is in the indication pending queue
 **                  or waiting for an Ack already
 **
-** Returns         BOOLEAN
+** Returns         bool
 **
 *******************************************************************************/
-BOOLEAN gatt_is_srv_chg_ind_pending (tGATT_TCB *p_tcb)
+bool    gatt_is_srv_chg_ind_pending (tGATT_TCB *p_tcb)
 {
-    BOOLEAN srv_chg_ind_pending = FALSE;
+    bool    srv_chg_ind_pending = false;
 
     GATT_TRACE_DEBUG("gatt_is_srv_chg_ind_pending is_queue_empty=%d",
                      fixed_queue_is_empty(p_tcb->pending_ind_q));
 
     if (p_tcb->indicate_handle == gatt_cb.handle_of_h_r)
     {
-        srv_chg_ind_pending = TRUE;
+        srv_chg_ind_pending = true;
     }
     else if (! fixed_queue_is_empty(p_tcb->pending_ind_q))
     {
@@ -724,7 +724,7 @@
             tGATT_VALUE *p_buf = (tGATT_VALUE *)list_node(node);
             if (p_buf->handle == gatt_cb.handle_of_h_r)
             {
-                srv_chg_ind_pending = TRUE;
+                srv_chg_ind_pending = true;
                 break;
             }
         }
@@ -778,17 +778,17 @@
 ** Returns           GATT_INDEX_INVALID if not found. Otherwise index to the tcb.
 **
 *******************************************************************************/
-BOOLEAN gatt_is_bda_connected(BD_ADDR bda)
+bool    gatt_is_bda_connected(BD_ADDR bda)
 {
-    UINT8 i = 0;
-    BOOLEAN connected=FALSE;
+    uint8_t i = 0;
+    bool    connected=false;
 
     for ( i=0; i < GATT_MAX_PHY_CHANNEL; i ++)
     {
         if (gatt_cb.tcb[i].in_use &&
             !memcmp(gatt_cb.tcb[i].peer_bda, bda, BD_ADDR_LEN))
         {
-            connected = TRUE;
+            connected = true;
             break;
         }
     }
@@ -804,9 +804,9 @@
 ** Returns           GATT_INDEX_INVALID if not found. Otherwise index to the tcb.
 **
 *******************************************************************************/
-UINT8 gatt_find_i_tcb_by_addr(BD_ADDR bda, tBT_TRANSPORT transport)
+uint8_t gatt_find_i_tcb_by_addr(BD_ADDR bda, tBT_TRANSPORT transport)
 {
-    UINT8 i = 0;
+    uint8_t i = 0;
 
     for ( ; i < GATT_MAX_PHY_CHANNEL; i ++)
     {
@@ -829,7 +829,7 @@
 ** Returns           NULL if not found. Otherwise index to the tcb.
 **
 *******************************************************************************/
-tGATT_TCB * gatt_get_tcb_by_idx(UINT8 tcb_idx)
+tGATT_TCB * gatt_get_tcb_by_idx(uint8_t tcb_idx)
 {
     tGATT_TCB   *p_tcb = NULL;
 
@@ -851,7 +851,7 @@
 tGATT_TCB * gatt_find_tcb_by_addr(BD_ADDR bda, tBT_TRANSPORT transport)
 {
     tGATT_TCB   *p_tcb = NULL;
-    UINT8 i = 0;
+    uint8_t i = 0;
 
     if ((i = gatt_find_i_tcb_by_addr(bda, transport)) != GATT_INDEX_INVALID)
         p_tcb = &gatt_cb.tcb[i];
@@ -867,9 +867,9 @@
 ** Returns           GATT_INDEX_INVALID if not found. Otherwise index to the tcb.
 **
 *******************************************************************************/
-UINT8 gatt_find_i_tcb_free(void)
+uint8_t gatt_find_i_tcb_free(void)
 {
-    UINT8 i = 0, j = GATT_INDEX_INVALID;
+    uint8_t i = 0, j = GATT_INDEX_INVALID;
 
     for (i = 0; i < GATT_MAX_PHY_CHANNEL; i ++)
     {
@@ -892,8 +892,8 @@
 *******************************************************************************/
 tGATT_TCB * gatt_allocate_tcb_by_bdaddr(BD_ADDR bda, tBT_TRANSPORT transport)
 {
-    UINT8 i = 0;
-    BOOLEAN allocated = FALSE;
+    uint8_t i = 0;
+    bool    allocated = false;
     tGATT_TCB    *p_tcb = NULL;
 
     /* search for existing tcb with matching bda    */
@@ -902,7 +902,7 @@
     if (i == GATT_INDEX_INVALID)
     {
         i = gatt_find_i_tcb_free();
-        allocated = TRUE;
+        allocated = true;
     }
     if (i != GATT_INDEX_INVALID)
     {
@@ -915,7 +915,7 @@
             p_tcb->pending_ind_q = fixed_queue_new(SIZE_MAX);
             p_tcb->conf_timer = alarm_new("gatt.conf_timer");
             p_tcb->ind_ack_timer = alarm_new("gatt.ind_ack_timer");
-            p_tcb->in_use = TRUE;
+            p_tcb->in_use = true;
             p_tcb->tcb_idx = i;
             p_tcb->transport = transport;
         }
@@ -930,12 +930,12 @@
 **
 ** Description      Convert a 16 bits UUID to be an standard 128 bits one.
 **
-** Returns          TRUE if two uuid match; FALSE otherwise.
+** Returns          true if two uuid match; false otherwise.
 **
 *******************************************************************************/
-void gatt_convert_uuid16_to_uuid128(UINT8 uuid_128[LEN_UUID_128], UINT16 uuid_16)
+void gatt_convert_uuid16_to_uuid128(uint8_t uuid_128[LEN_UUID_128], uint16_t uuid_16)
 {
-    UINT8   *p = &uuid_128[LEN_UUID_128 - 4];
+    uint8_t *p = &uuid_128[LEN_UUID_128 - 4];
 
     memcpy (uuid_128, base_uuid, LEN_UUID_128);
 
@@ -948,12 +948,12 @@
 **
 ** Description      Convert a 32 bits UUID to be an standard 128 bits one.
 **
-** Returns          TRUE if two uuid match; FALSE otherwise.
+** Returns          true if two uuid match; false otherwise.
 **
 *******************************************************************************/
-void gatt_convert_uuid32_to_uuid128(UINT8 uuid_128[LEN_UUID_128], UINT32 uuid_32)
+void gatt_convert_uuid32_to_uuid128(uint8_t uuid_128[LEN_UUID_128], uint32_t uuid_32)
 {
-    UINT8   *p = &uuid_128[LEN_UUID_128 - 4];
+    uint8_t *p = &uuid_128[LEN_UUID_128 - 4];
 
     memcpy (uuid_128, base_uuid, LEN_UUID_128);
 
@@ -965,18 +965,18 @@
 **
 ** Description      Compare two UUID to see if they are the same.
 **
-** Returns          TRUE if two uuid match; FALSE otherwise.
+** Returns          true if two uuid match; false otherwise.
 **
 *******************************************************************************/
-BOOLEAN gatt_uuid_compare (tBT_UUID src, tBT_UUID tar)
+bool    gatt_uuid_compare (tBT_UUID src, tBT_UUID tar)
 {
-    UINT8  su[LEN_UUID_128], tu[LEN_UUID_128];
-    UINT8  *ps, *pt;
+    uint8_t su[LEN_UUID_128], tu[LEN_UUID_128];
+    uint8_t *ps, *pt;
 
     /* any of the UUID is unspecified */
     if (src.len == 0 || tar.len == 0)
     {
-        return TRUE;
+        return true;
     }
 
     /* If both are 16-bit, we can do a simple compare */
@@ -1033,10 +1033,10 @@
 ** Returns          UUID length.
 **
 *******************************************************************************/
-UINT8 gatt_build_uuid_to_stream(UINT8 **p_dst, tBT_UUID uuid)
+uint8_t gatt_build_uuid_to_stream(uint8_t **p_dst, tBT_UUID uuid)
 {
-    UINT8   *p = *p_dst;
-    UINT8   len = 0;
+    uint8_t *p = *p_dst;
+    uint8_t len = 0;
 
     if (uuid.len == LEN_UUID_16)
     {
@@ -1065,14 +1065,14 @@
 **
 ** Description      Convert a 128 bits UUID into a 16 bits UUID.
 **
-** Returns          TRUE if command sent, otherwise FALSE.
+** Returns          true if command sent, otherwise false.
 **
 *******************************************************************************/
-BOOLEAN gatt_parse_uuid_from_cmd(tBT_UUID *p_uuid_rec, UINT16 uuid_size, UINT8 **p_data)
+bool    gatt_parse_uuid_from_cmd(tBT_UUID *p_uuid_rec, uint16_t uuid_size, uint8_t **p_data)
 {
-    BOOLEAN is_base_uuid, ret = TRUE;
-    UINT8  xx;
-    UINT8 *p_uuid = *p_data;
+    bool    is_base_uuid, ret = true;
+    uint8_t xx;
+    uint8_t *p_uuid = *p_data;
 
     memset(p_uuid_rec, 0, sizeof(tBT_UUID));
 
@@ -1086,12 +1086,12 @@
 
         case LEN_UUID_128:
             /* See if we can compress his UUID down to 16 or 32bit UUIDs */
-            is_base_uuid = TRUE;
+            is_base_uuid = true;
             for (xx = 0; xx < LEN_UUID_128 - 4; xx++)
             {
                 if (p_uuid[xx] != base_uuid[xx])
                 {
-                    is_base_uuid = FALSE;
+                    is_base_uuid = false;
                     break;
                 }
             }
@@ -1123,7 +1123,7 @@
             GATT_TRACE_ERROR("DO NOT ALLOW 32 BITS UUID IN ATT PDU");
         case 0:
         default:
-            if (uuid_size != 0) ret = FALSE;
+            if (uuid_size != 0) ret = false;
             GATT_TRACE_WARNING("gatt_parse_uuid_from_cmd invalid uuid size");
             break;
     }
@@ -1140,7 +1140,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_start_rsp_timer(UINT16 clcb_idx)
+void gatt_start_rsp_timer(uint16_t clcb_idx)
 {
     tGATT_CLCB *p_clcb = &gatt_cb.clcb[clcb_idx];
     period_ms_t timeout_ms = GATT_WAIT_FOR_RSP_TIMEOUT_MS;
@@ -1213,7 +1213,7 @@
         p_clcb->op_subtype == GATT_DISC_SRVC_ALL &&
         p_clcb->retry_count < GATT_REQ_RETRY_LIMIT)
     {
-        UINT8 rsp_code;
+        uint8_t rsp_code;
         GATT_TRACE_WARNING("%s retry discovery primary service", __func__);
         if (p_clcb != gatt_cmd_dequeue(p_clcb->p_tcb, &rsp_code))
         {
@@ -1278,9 +1278,9 @@
 ** Returns          GATT_MAX_SR_PROFILES if not found. Otherwise index of th eservice.
 **
 *******************************************************************************/
-UINT8 gatt_sr_find_i_rcb_by_handle(UINT16 handle)
+uint8_t gatt_sr_find_i_rcb_by_handle(uint16_t handle)
 {
-    UINT8  i_rcb = 0;
+    uint8_t i_rcb = 0;
 
     for ( ; i_rcb < GATT_MAX_SR_PROFILES; i_rcb++)
     {
@@ -1303,9 +1303,9 @@
 ** Returns          0 if not found. Otherwise index of th eservice.
 **
 *******************************************************************************/
-UINT8 gatt_sr_find_i_rcb_by_app_id(tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, UINT16 start_handle)
+uint8_t gatt_sr_find_i_rcb_by_app_id(tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, uint16_t start_handle)
 {
-    UINT8           i_rcb = 0;
+    uint8_t         i_rcb = 0;
     tGATT_SR_REG    *p_sreg;
     tBT_UUID        *p_this_uuid;
 
@@ -1338,9 +1338,9 @@
 ** Returns          0 if not found. Otherwise index of th eservice.
 **
 *******************************************************************************/
-UINT8 gatt_sr_alloc_rcb(tGATT_HDL_LIST_ELEM *p_list )
+uint8_t gatt_sr_alloc_rcb(tGATT_HDL_LIST_ELEM *p_list )
 {
-    UINT8   ii = 0;
+    uint8_t ii = 0;
     tGATT_SR_REG    *p_sreg = NULL;
 
     /*this is a new application servoce start */
@@ -1350,7 +1350,7 @@
         {
             memset (p_sreg, 0, sizeof(tGATT_SR_REG));
 
-            p_sreg->in_use = TRUE;
+            p_sreg->in_use = true;
             memcpy (&p_sreg->app_uuid, &p_list->asgn_range.app_uuid128, sizeof(tBT_UUID));
 
             p_sreg->type                = p_list->asgn_range.is_primary ? GATT_UUID_PRI_SERVICE: GATT_UUID_SEC_SERVICE;
@@ -1376,9 +1376,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_sr_get_sec_info(BD_ADDR rem_bda, tBT_TRANSPORT transport, UINT8 *p_sec_flag, UINT8 *p_key_size)
+void gatt_sr_get_sec_info(BD_ADDR rem_bda, tBT_TRANSPORT transport, uint8_t *p_sec_flag, uint8_t *p_key_size)
 {
-    UINT8           sec_flag = 0;
+    uint8_t         sec_flag = 0;
 
     BTM_GetSecurityFlagsByTransport(rem_bda, &sec_flag, transport);
 
@@ -1397,8 +1397,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_sr_send_req_callback(UINT16 conn_id,
-                               UINT32 trans_id,
+void gatt_sr_send_req_callback(uint16_t conn_id,
+                               uint32_t trans_id,
                                tGATTS_REQ_TYPE type, tGATTS_DATA *p_data)
 {
     tGATT_IF        gatt_if = GATT_GET_GATT_IF(conn_id);
@@ -1431,8 +1431,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-tGATT_STATUS gatt_send_error_rsp (tGATT_TCB *p_tcb, UINT8 err_code, UINT8 op_code,
-                                  UINT16 handle, BOOLEAN deq)
+tGATT_STATUS gatt_send_error_rsp (tGATT_TCB *p_tcb, uint8_t err_code, uint8_t op_code,
+                                  uint16_t handle, bool    deq)
 {
     tGATT_ERROR      error;
     tGATT_STATUS     status;
@@ -1465,13 +1465,13 @@
 ** Returns          0 if error else sdp handle for the record.
 **
 *******************************************************************************/
-UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl)
+uint32_t gatt_add_sdp_record (tBT_UUID *p_uuid, uint16_t start_hdl, uint16_t end_hdl)
 {
     tSDP_PROTOCOL_ELEM  proto_elem_list[2];
-    UINT32              sdp_handle;
-    UINT16              list = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
-    UINT8               buff[60];
-    UINT8               *p = buff;
+    uint32_t            sdp_handle;
+    uint16_t            list = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
+    uint8_t             buff[60];
+    uint8_t             *p = buff;
 
     GATT_TRACE_DEBUG("gatt_add_sdp_record s_hdl=0x%x  s_hdl=0x%x",start_hdl, end_hdl);
 
@@ -1488,14 +1488,14 @@
             UINT8_TO_BE_STREAM (p, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES);
             UINT32_TO_BE_STREAM (p, p_uuid->uu.uuid32);
             SDP_AddAttribute (sdp_handle, ATTR_ID_SERVICE_CLASS_ID_LIST, DATA_ELE_SEQ_DESC_TYPE,
-                              (UINT32) (p - buff), buff);
+                              (uint32_t) (p - buff), buff);
             break;
 
         case LEN_UUID_128:
             UINT8_TO_BE_STREAM (p, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES);
             ARRAY_TO_BE_STREAM_REVERSE (p, p_uuid->uu.uuid128, LEN_UUID_128);
             SDP_AddAttribute (sdp_handle, ATTR_ID_SERVICE_CLASS_ID_LIST, DATA_ELE_SEQ_DESC_TYPE,
-                              (UINT32) (p - buff), buff);
+                              (uint32_t) (p - buff), buff);
             break;
 
         default:
@@ -1523,7 +1523,7 @@
 }
 
 
-    #if GATT_CONFORMANCE_TESTING == TRUE
+    #if GATT_CONFORMANCE_TESTING == true
 /*******************************************************************************
 **
 ** Function         gatt_set_err_rsp
@@ -1533,7 +1533,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void gatt_set_err_rsp(BOOLEAN enable, UINT8 req_op_code, UINT8 err_status)
+void gatt_set_err_rsp(bool    enable, uint8_t req_op_code, uint8_t err_status)
 {
     GATT_TRACE_DEBUG("gatt_set_err_rsp enable=%d op_code=%d, err_status=%d", enable, req_op_code, err_status);
     gatt_cb.enable_err_rsp  = enable;
@@ -1555,7 +1555,7 @@
 *******************************************************************************/
 tGATT_REG *gatt_get_regcb (tGATT_IF gatt_if)
 {
-    UINT8           ii = (UINT8)gatt_if;
+    uint8_t         ii = (uint8_t)gatt_if;
     tGATT_REG       *p_reg = NULL;
 
     if (ii < 1 || ii > GATT_MAX_APPS) {
@@ -1585,16 +1585,16 @@
 **
 *******************************************************************************/
 
-BOOLEAN gatt_is_clcb_allocated (UINT16 conn_id)
+bool    gatt_is_clcb_allocated (uint16_t conn_id)
 {
-    UINT8         i = 0;
-    BOOLEAN       is_allocated= FALSE;
+    uint8_t       i = 0;
+    bool          is_allocated= false;
 
     for (i = 0; i < GATT_CL_MAX_LCB; i++)
     {
         if (gatt_cb.clcb[i].in_use && (gatt_cb.clcb[i].conn_id == conn_id))
         {
-            is_allocated = TRUE;
+            is_allocated = true;
             break;
         }
     }
@@ -1611,12 +1611,12 @@
 ** Returns           NULL if not found. Otherwise pointer to the connection link block.
 **
 *******************************************************************************/
-tGATT_CLCB *gatt_clcb_alloc (UINT16 conn_id)
+tGATT_CLCB *gatt_clcb_alloc (uint16_t conn_id)
 {
-    UINT8           i = 0;
+    uint8_t         i = 0;
     tGATT_CLCB      *p_clcb = NULL;
     tGATT_IF        gatt_if=GATT_GET_GATT_IF(conn_id);
-    UINT8           tcb_idx = GATT_GET_TCB_IDX(conn_id);
+    uint8_t         tcb_idx = GATT_GET_TCB_IDX(conn_id);
     tGATT_TCB       *p_tcb = gatt_get_tcb_by_idx(tcb_idx);
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
 
@@ -1626,7 +1626,7 @@
         {
             p_clcb = &gatt_cb.clcb[i];
 
-            p_clcb->in_use      = TRUE;
+            p_clcb->in_use      = true;
             p_clcb->conn_id     = conn_id;
             p_clcb->clcb_idx    = i;
             p_clcb->p_reg       = p_reg;
@@ -1667,9 +1667,9 @@
 ** Returns           NULL if not found. Otherwise pointer to the rcb.
 **
 *******************************************************************************/
-tGATT_TCB * gatt_find_tcb_by_cid (UINT16 lcid)
+tGATT_TCB * gatt_find_tcb_by_cid (uint16_t lcid)
 {
-    UINT16       xx = 0;
+    uint16_t     xx = 0;
     tGATT_TCB    *p_tcb = NULL;
 
     for (xx = 0; xx < GATT_MAX_PHY_CHANNEL; xx++)
@@ -1693,9 +1693,9 @@
 ** Returns          total number of applications holding this acl link.
 **
 *******************************************************************************/
-UINT8 gatt_num_apps_hold_link(tGATT_TCB *p_tcb)
+uint8_t gatt_num_apps_hold_link(tGATT_TCB *p_tcb)
 {
-    UINT8 i, num = 0;
+    uint8_t i, num = 0;
 
     for (i = 0; i < GATT_MAX_APPS; i ++)
     {
@@ -1717,9 +1717,9 @@
 ** Returns          total number of clcb found.
 **
 *******************************************************************************/
-UINT8 gatt_num_clcb_by_bd_addr(BD_ADDR bda)
+uint8_t gatt_num_clcb_by_bd_addr(BD_ADDR bda)
 {
-    UINT8 i, num = 0;
+    uint8_t i, num = 0;
 
     for (i = 0; i < GATT_CL_MAX_LCB; i ++)
     {
@@ -1740,7 +1740,7 @@
 *******************************************************************************/
 void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB *p_tcb )
 {
-    UINT8 i;
+    uint8_t i;
 
     if (p_tcb)
     {
@@ -1764,10 +1764,10 @@
 ** Returns          True if thetotal application callback count is zero
 **
 *******************************************************************************/
-BOOLEAN gatt_sr_is_cback_cnt_zero(tGATT_TCB *p_tcb )
+bool    gatt_sr_is_cback_cnt_zero(tGATT_TCB *p_tcb )
 {
-    BOOLEAN status = TRUE;
-    UINT8   i;
+    bool    status = true;
+    uint8_t i;
 
     if (p_tcb)
     {
@@ -1775,14 +1775,14 @@
         {
             if (p_tcb->sr_cmd.cback_cnt[i])
             {
-                status = FALSE;
+                status = false;
                 break;
             }
         }
     }
     else
     {
-        status = FALSE;
+        status = false;
     }
     return status;
 }
@@ -1796,10 +1796,10 @@
 ** Returns          True no prepare write request
 **
 *******************************************************************************/
-BOOLEAN gatt_sr_is_prep_cnt_zero(tGATT_TCB *p_tcb)
+bool    gatt_sr_is_prep_cnt_zero(tGATT_TCB *p_tcb)
 {
-    BOOLEAN status = TRUE;
-    UINT8   i;
+    bool    status = true;
+    uint8_t i;
 
     if (p_tcb)
     {
@@ -1807,14 +1807,14 @@
         {
             if (p_tcb->prep_cnt[i])
             {
-                status = FALSE;
+                status = false;
                 break;
             }
         }
     }
     else
     {
-        status = FALSE;
+        status = false;
     }
     return status;
 }
@@ -1831,7 +1831,7 @@
 *******************************************************************************/
 void gatt_sr_reset_cback_cnt(tGATT_TCB *p_tcb )
 {
-    UINT8 i;
+    uint8_t i;
 
     if (p_tcb)
     {
@@ -1853,7 +1853,7 @@
 *******************************************************************************/
 void gatt_sr_reset_prep_cnt(tGATT_TCB *p_tcb )
 {
-    UINT8 i;
+    uint8_t i;
     if (p_tcb)
     {
         for (i = 0; i < GATT_MAX_APPS; i ++)
@@ -1873,10 +1873,10 @@
 ** Returns           None
 **
 *******************************************************************************/
-void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc, BOOLEAN is_reset_first)
+void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, bool    is_inc, bool    is_reset_first)
 {
 
-    UINT8 idx = ((UINT8) gatt_if) - 1 ;
+    uint8_t idx = ((uint8_t) gatt_if) - 1 ;
 
     if (p_tcb)
     {
@@ -1908,9 +1908,9 @@
 ** Returns           None
 **
 *******************************************************************************/
-void gatt_sr_update_prep_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc, BOOLEAN is_reset_first)
+void gatt_sr_update_prep_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, bool    is_inc, bool    is_reset_first)
 {
-    UINT8 idx = ((UINT8) gatt_if) - 1 ;
+    uint8_t idx = ((uint8_t) gatt_if) - 1 ;
 
     GATT_TRACE_DEBUG("gatt_sr_update_prep_cnt tcb idx=%d gatt_if=%d is_inc=%d is_reset_first=%d",
                       p_tcb->tcb_idx, gatt_if, is_inc, is_reset_first);
@@ -1943,10 +1943,10 @@
 ** Returns         Boolean
 **
 *******************************************************************************/
-BOOLEAN gatt_cancel_open(tGATT_IF gatt_if, BD_ADDR bda)
+bool    gatt_cancel_open(tGATT_IF gatt_if, BD_ADDR bda)
 {
     tGATT_TCB *p_tcb=NULL;
-    BOOLEAN status= TRUE;
+    bool    status= true;
 
     p_tcb = gatt_find_tcb_by_addr(bda, BT_TRANSPORT_LE);
 
@@ -1955,11 +1955,11 @@
         if (gatt_get_ch_state(p_tcb) == GATT_CH_OPEN)
         {
             GATT_TRACE_ERROR("GATT_CancelConnect - link connected Too late to cancel");
-            status = FALSE;
+            status = false;
         }
         else
         {
-            gatt_update_app_use_link_flag(gatt_if, p_tcb, FALSE, FALSE);
+            gatt_update_app_use_link_flag(gatt_if, p_tcb, false, false);
             if (!gatt_num_apps_hold_link(p_tcb))
             {
                 gatt_disconnect(p_tcb);
@@ -1979,10 +1979,10 @@
 ** Returns         Boolean
 **
 *******************************************************************************/
-BOOLEAN gatt_find_app_hold_link(tGATT_TCB *p_tcb, UINT8 start_idx, UINT8 *p_found_idx, tGATT_IF *p_gatt_if)
+bool    gatt_find_app_hold_link(tGATT_TCB *p_tcb, uint8_t start_idx, uint8_t *p_found_idx, tGATT_IF *p_gatt_if)
 {
-    UINT8 i;
-    BOOLEAN found= FALSE;
+    uint8_t i;
+    bool    found= false;
 
     for (i = start_idx; i < GATT_MAX_APPS; i ++)
     {
@@ -1990,7 +1990,7 @@
         {
             *p_gatt_if = gatt_cb.clcb[i].p_reg->gatt_if;
             *p_found_idx = i;
-            found = TRUE;
+            found = true;
             break;
         }
     }
@@ -2006,7 +2006,7 @@
 ** Returns          None.
 **
 *******************************************************************************/
-BOOLEAN gatt_cmd_enq(tGATT_TCB *p_tcb, UINT16 clcb_idx, BOOLEAN to_send, UINT8 op_code, BT_HDR *p_buf)
+bool    gatt_cmd_enq(tGATT_TCB *p_tcb, uint16_t clcb_idx, bool    to_send, uint8_t op_code, BT_HDR *p_buf)
 {
     tGATT_CMD_Q  *p_cmd = &p_tcb->cl_cmd_q[p_tcb->next_slot_inq];
 
@@ -2023,7 +2023,7 @@
     p_tcb->next_slot_inq ++;
     p_tcb->next_slot_inq %= GATT_CL_MAX_LCB;
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -2035,7 +2035,7 @@
 ** Returns          total number of clcb found.
 **
 *******************************************************************************/
-tGATT_CLCB * gatt_cmd_dequeue(tGATT_TCB *p_tcb, UINT8 *p_op_code)
+tGATT_CLCB * gatt_cmd_dequeue(tGATT_TCB *p_tcb, uint8_t *p_op_code)
 {
     tGATT_CMD_Q  *p_cmd = &p_tcb->cl_cmd_q[p_tcb->pending_cl_req];
     tGATT_CLCB *p_clcb = NULL;
@@ -2062,9 +2062,9 @@
 ** Returns          status code
 **
 *******************************************************************************/
-UINT8 gatt_send_write_msg (tGATT_TCB *p_tcb, UINT16 clcb_idx, UINT8 op_code,
-                           UINT16 handle, UINT16 len,
-                           UINT16 offset, UINT8 *p_data)
+uint8_t gatt_send_write_msg (tGATT_TCB *p_tcb, uint16_t clcb_idx, uint8_t op_code,
+                           uint16_t handle, uint16_t len,
+                           uint16_t offset, uint8_t *p_data)
 {
     tGATT_CL_MSG     msg;
 
@@ -2088,8 +2088,8 @@
 ** Returns          status code
 **
 *******************************************************************************/
-UINT8 gatt_act_send_browse(tGATT_TCB *p_tcb, UINT16 index, UINT8 op, UINT16 s_handle,
-                           UINT16 e_handle, tBT_UUID uuid)
+uint8_t gatt_act_send_browse(tGATT_TCB *p_tcb, uint16_t index, uint8_t op, uint16_t s_handle,
+                           uint16_t e_handle, tBT_UUID uuid)
 {
     tGATT_CL_MSG     msg;
 
@@ -2115,10 +2115,10 @@
 {
     tGATT_CL_COMPLETE   cb_data;
     tGATT_CMPL_CBACK    *p_cmpl_cb = (p_clcb->p_reg) ? p_clcb->p_reg->app_cb.p_cmpl_cb : NULL;
-    UINT8               op = p_clcb->operation, disc_type=GATT_DISC_MAX;
+    uint8_t             op = p_clcb->operation, disc_type=GATT_DISC_MAX;
     tGATT_DISC_CMPL_CB  *p_disc_cmpl_cb = (p_clcb->p_reg) ? p_clcb->p_reg->app_cb.p_disc_cmpl_cb : NULL;
-    UINT16              conn_id;
-    UINT8               operation;
+    uint16_t            conn_id;
+    uint8_t             operation;
 
     GATT_TRACE_DEBUG ("gatt_end_operation status=%d op=%d subtype=%d",
                        status, p_clcb->operation, p_clcb->op_subtype);
@@ -2189,12 +2189,12 @@
 ** Returns          16 bits uuid.
 **
 *******************************************************************************/
-void gatt_cleanup_upon_disc(BD_ADDR bda, UINT16 reason, tBT_TRANSPORT transport)
+void gatt_cleanup_upon_disc(BD_ADDR bda, uint16_t reason, tBT_TRANSPORT transport)
 {
     tGATT_TCB       *p_tcb = NULL;
     tGATT_CLCB      *p_clcb;
-    UINT8           i;
-    UINT16          conn_id;
+    uint8_t         i;
+    uint16_t        conn_id;
     tGATT_REG        *p_reg=NULL;
 
 
@@ -2235,7 +2235,7 @@
             {
                 conn_id = GATT_CREATE_CONN_ID(p_tcb->tcb_idx, p_reg->gatt_if);
                 GATT_TRACE_DEBUG ("found p_reg tcb_idx=%d gatt_if=%d  conn_id=0x%x", p_tcb->tcb_idx, p_reg->gatt_if, conn_id);
-                (*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if,  bda, conn_id, FALSE, reason, transport);
+                (*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if,  bda, conn_id, false, reason, transport);
             }
         }
         memset(p_tcb, 0, sizeof(tGATT_TCB));
@@ -2249,12 +2249,12 @@
 **
 ** Description      Get op code description name, for debug information.
 **
-** Returns          UINT8 *: name of the operation.
+** Returns          uint8_t *: name of the operation.
 **
 *******************************************************************************/
-UINT8 * gatt_dbg_op_name(UINT8 op_code)
+uint8_t * gatt_dbg_op_name(uint8_t op_code)
 {
-    UINT8 pseduo_op_code_idx = op_code & (~GATT_WRITE_CMD_MASK);
+    uint8_t pseduo_op_code_idx = op_code & (~GATT_WRITE_CMD_MASK);
 
     if (op_code == GATT_CMD_WRITE )
     {
@@ -2268,9 +2268,9 @@
     }
 
     if (pseduo_op_code_idx <= GATT_OP_CODE_MAX)
-        return(UINT8*) op_code_name[pseduo_op_code_idx];
+        return(uint8_t*) op_code_name[pseduo_op_code_idx];
     else
-        return(UINT8 *)"Op Code Exceed Max";
+        return(uint8_t *)"Op Code Exceed Max";
 }
 
 /*******************************************************************************
@@ -2321,21 +2321,21 @@
 **
 ** Description      find is this one of the background devices for the application
 **
-** Returns          TRUE this is one of the background devices for the  application
+** Returns          true this is one of the background devices for the  application
 **
 *******************************************************************************/
-BOOLEAN gatt_is_bg_dev_for_app(tGATT_BG_CONN_DEV *p_dev, tGATT_IF gatt_if)
+bool    gatt_is_bg_dev_for_app(tGATT_BG_CONN_DEV *p_dev, tGATT_IF gatt_if)
 {
-    UINT8   i;
+    uint8_t i;
 
     for (i = 0; i < GATT_MAX_APPS; i ++ )
     {
         if (p_dev->in_use && (p_dev->gatt_if[i] == gatt_if))
         {
-            return TRUE;
+            return true;
         }
     }
-    return FALSE;
+    return false;
 }
 /*******************************************************************************
 **
@@ -2349,7 +2349,7 @@
 tGATT_BG_CONN_DEV * gatt_find_bg_dev(BD_ADDR remote_bda)
 {
     tGATT_BG_CONN_DEV    *p_dev_list = &gatt_cb.bgconn_dev[0];
-    UINT8   i;
+    uint8_t i;
 
     for (i = 0; i < GATT_MAX_BG_CONN_DEV; i ++, p_dev_list ++)
     {
@@ -2372,13 +2372,13 @@
 tGATT_BG_CONN_DEV * gatt_alloc_bg_dev(BD_ADDR remote_bda)
 {
     tGATT_BG_CONN_DEV    *p_dev_list = &gatt_cb.bgconn_dev[0];
-    UINT8   i;
+    uint8_t i;
 
     for (i = 0; i < GATT_MAX_BG_CONN_DEV; i ++, p_dev_list ++)
     {
         if (!p_dev_list->in_use)
         {
-            p_dev_list->in_use = TRUE;
+            p_dev_list->in_use = true;
             memcpy(p_dev_list->remote_bda, remote_bda, BD_ADDR_LEN);
 
             return p_dev_list;
@@ -2393,15 +2393,15 @@
 **
 ** Description      add/remove device from the back ground connection device list
 **
-** Returns          TRUE if device added to the list; FALSE failed
+** Returns          true if device added to the list; false failed
 **
 *******************************************************************************/
-BOOLEAN gatt_add_bg_dev_list(tGATT_REG *p_reg,  BD_ADDR bd_addr, BOOLEAN is_initator)
+bool    gatt_add_bg_dev_list(tGATT_REG *p_reg,  BD_ADDR bd_addr, bool    is_initator)
 {
     tGATT_IF gatt_if =  p_reg->gatt_if;
     tGATT_BG_CONN_DEV   *p_dev = NULL;
-    UINT8       i;
-    BOOLEAN      ret = FALSE;
+    uint8_t     i;
+    bool         ret = false;
 
     if ((p_dev = gatt_find_bg_dev(bd_addr)) == NULL)
     {
@@ -2417,15 +2417,15 @@
                 if (p_dev->gatt_if[i] == gatt_if)
                 {
                     GATT_TRACE_ERROR("device already in iniator white list");
-                    return TRUE;
+                    return true;
                 }
                 else if (p_dev->gatt_if[i] == 0)
                 {
                     p_dev->gatt_if[i] = gatt_if;
                     if (i == 0)
-                        ret = BTM_BleUpdateBgConnDev(TRUE, bd_addr);
+                        ret = BTM_BleUpdateBgConnDev(true, bd_addr);
                     else
-                        ret = TRUE;
+                        ret = true;
                     break;
                 }
             }
@@ -2434,7 +2434,7 @@
                 if (p_dev->listen_gif[i] == gatt_if)
                 {
                     GATT_TRACE_ERROR("device already in adv white list");
-                    return TRUE;
+                    return true;
                 }
                 else if (p_dev->listen_gif[i] == 0)
                 {
@@ -2445,9 +2445,9 @@
                     p_dev->listen_gif[i] = gatt_if;
 
                     if (i == 0)
-                        ret = BTM_BleUpdateAdvWhitelist(TRUE, bd_addr);
+                        ret = BTM_BleUpdateAdvWhitelist(true, bd_addr);
                     else
-                        ret = TRUE;
+                        ret = true;
                     break;
                 }
             }
@@ -2470,14 +2470,14 @@
 ** Returns          Boolean
 **
 *******************************************************************************/
-BOOLEAN gatt_remove_bg_dev_for_app(tGATT_IF gatt_if, BD_ADDR bd_addr)
+bool    gatt_remove_bg_dev_for_app(tGATT_IF gatt_if, BD_ADDR bd_addr)
 {
     tGATT_TCB    *p_tcb = gatt_find_tcb_by_addr(bd_addr, BT_TRANSPORT_LE);
-    BOOLEAN       status;
+    bool          status;
 
     if (p_tcb)
-        gatt_update_app_use_link_flag(gatt_if, p_tcb, FALSE, FALSE);
-    status = gatt_update_auto_connect_dev(gatt_if, FALSE, bd_addr, TRUE);
+        gatt_update_app_use_link_flag(gatt_if, p_tcb, false, false);
+    status = gatt_update_auto_connect_dev(gatt_if, false, bd_addr, true);
     return status;
 }
 
@@ -2488,14 +2488,14 @@
 **
 ** Description      Gte the number of applciations for the specified background device
 **
-** Returns          UINT8 total number fo applications
+** Returns          uint8_t total number fo applications
 **
 *******************************************************************************/
-UINT8 gatt_get_num_apps_for_bg_dev(BD_ADDR bd_addr)
+uint8_t gatt_get_num_apps_for_bg_dev(BD_ADDR bd_addr)
 {
     tGATT_BG_CONN_DEV   *p_dev = NULL;
-    UINT8   i;
-    UINT8   cnt = 0;
+    uint8_t i;
+    uint8_t cnt = 0;
 
     if ((p_dev = gatt_find_bg_dev(bd_addr)) != NULL)
     {
@@ -2517,11 +2517,11 @@
 ** Returns          Boolean
 **
 *******************************************************************************/
-BOOLEAN gatt_find_app_for_bg_dev(BD_ADDR bd_addr, tGATT_IF *p_gatt_if)
+bool    gatt_find_app_for_bg_dev(BD_ADDR bd_addr, tGATT_IF *p_gatt_if)
 {
     tGATT_BG_CONN_DEV   *p_dev = NULL;
-    UINT8   i;
-    BOOLEAN ret = FALSE;
+    uint8_t i;
+    bool    ret = false;
 
     if ((p_dev = gatt_find_bg_dev(bd_addr)) == NULL)
     {
@@ -2533,7 +2533,7 @@
         if (p_dev->gatt_if[i] != 0 )
         {
             *p_gatt_if = p_dev->gatt_if[i];
-            ret = TRUE;
+            ret = true;
             break;
         }
     }
@@ -2551,12 +2551,12 @@
 ** Returns          pointer to the device record
 **
 *******************************************************************************/
-BOOLEAN gatt_remove_bg_dev_from_list(tGATT_REG *p_reg, BD_ADDR bd_addr, BOOLEAN is_initiator)
+bool    gatt_remove_bg_dev_from_list(tGATT_REG *p_reg, BD_ADDR bd_addr, bool    is_initiator)
 {
     tGATT_IF gatt_if = p_reg->gatt_if;
     tGATT_BG_CONN_DEV   *p_dev = NULL;
-    UINT8   i, j;
-    BOOLEAN ret = FALSE;
+    uint8_t i, j;
+    bool    ret = false;
 
     if ((p_dev = gatt_find_bg_dev(bd_addr)) == NULL)
     {
@@ -2575,9 +2575,9 @@
                     p_dev->gatt_if[j - 1] = p_dev->gatt_if[j];
 
                 if (p_dev->gatt_if[0] == 0)
-                    ret = BTM_BleUpdateBgConnDev(FALSE, p_dev->remote_bda);
+                    ret = BTM_BleUpdateBgConnDev(false, p_dev->remote_bda);
                 else
-                    ret = TRUE;
+                    ret = true;
 
                 break;
             }
@@ -2593,9 +2593,9 @@
                     p_dev->listen_gif[j - 1] = p_dev->listen_gif[j];
 
                 if (p_dev->listen_gif[0] == 0)
-                    ret = BTM_BleUpdateAdvWhitelist(FALSE, p_dev->remote_bda);
+                    ret = BTM_BleUpdateAdvWhitelist(false, p_dev->remote_bda);
                 else
-                    ret = TRUE;
+                    ret = true;
                 break;
             }
         }
@@ -2620,7 +2620,7 @@
 void gatt_deregister_bgdev_list(tGATT_IF gatt_if)
 {
     tGATT_BG_CONN_DEV    *p_dev_list = &gatt_cb.bgconn_dev[0];
-    UINT8 i , j, k;
+    uint8_t i , j, k;
     tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
 
     /* update the BG conn device list */
@@ -2639,7 +2639,7 @@
                         p_dev_list->gatt_if[k - 1] = p_dev_list->gatt_if[k];
 
                     if (p_dev_list->gatt_if[0] == 0)
-                        BTM_BleUpdateBgConnDev(FALSE, p_dev_list->remote_bda);
+                        BTM_BleUpdateBgConnDev(false, p_dev_list->remote_bda);
                 }
 
                 if (p_dev_list->listen_gif[j] == gatt_if)
@@ -2654,7 +2654,7 @@
                         p_dev_list->listen_gif[k - 1] = p_dev_list->listen_gif[k];
 
                     if (p_dev_list->listen_gif[0] == 0)
-                        BTM_BleUpdateAdvWhitelist(FALSE, p_dev_list->remote_bda);
+                        BTM_BleUpdateAdvWhitelist(false, p_dev_list->remote_bda);
                 }
             }
         }
@@ -2687,12 +2687,12 @@
 **                  add: add peer device
 **                  bd_addr: peer device address.
 **
-** Returns          TRUE if connection started; FALSE if connection start failure.
+** Returns          true if connection started; false if connection start failure.
 **
 *******************************************************************************/
-BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_addr, BOOLEAN is_initator)
+bool    gatt_update_auto_connect_dev (tGATT_IF gatt_if, bool    add, BD_ADDR bd_addr, bool    is_initator)
 {
-    BOOLEAN         ret = FALSE;
+    bool            ret = false;
     tGATT_REG        *p_reg;
     tGATT_TCB       *p_tcb = gatt_find_tcb_by_addr(bd_addr, BT_TRANSPORT_LE);
 
@@ -2701,7 +2701,7 @@
     if ((p_reg = gatt_get_regcb(gatt_if)) == NULL)
     {
         GATT_TRACE_ERROR("gatt_update_auto_connect_dev - gatt_if is not registered", gatt_if);
-        return(FALSE);
+        return(false);
     }
 
     if (add)
@@ -2711,7 +2711,7 @@
         if (ret && p_tcb != NULL)
         {
             /* if a connected device, update the link holding number */
-            gatt_update_app_use_link_flag(gatt_if, p_tcb, TRUE, TRUE);
+            gatt_update_app_use_link_flag(gatt_if, p_tcb, true, true);
         }
     }
     else
@@ -2754,13 +2754,13 @@
 ** Returns    Pointer to the new service start buffer, NULL no buffer available
 **
 *******************************************************************************/
-BOOLEAN gatt_update_listen_mode(void)
+bool    gatt_update_listen_mode(void)
 {
-    UINT8           ii = 0;
+    uint8_t         ii = 0;
     tGATT_REG       *p_reg = &gatt_cb.cl_rcb[0];
-    UINT8           listening = 0;
-    UINT16          connectability, window, interval;
-    BOOLEAN         rt = TRUE;
+    uint8_t         listening = 0;
+    uint16_t        connectability, window, interval;
+    bool            rt = true;
 
     for (; ii < GATT_MAX_APPS; ii ++, p_reg ++)
     {
diff --git a/stack/hcic/hciblecmds.c b/stack/hcic/hciblecmds.c
index 5d58449..ac4af1d 100644
--- a/stack/hcic/hciblecmds.c
+++ b/stack/hcic/hciblecmds.c
@@ -33,12 +33,12 @@
 #include <stddef.h>
 #include <string.h>
 
-#if (defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE)
+#if (BLE_INCLUDED == TRUE)
 
-BOOLEAN btsnd_hcic_ble_set_local_used_feat (UINT8 feat_set[8])
+bool    btsnd_hcic_ble_set_local_used_feat (uint8_t feat_set[8])
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_USED_FEAT_CMD;
     p->offset = 0;
@@ -47,13 +47,13 @@
     ARRAY_TO_STREAM (pp, feat_set, HCIC_PARAM_SIZE_SET_USED_FEAT_CMD);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_set_random_addr (BD_ADDR random_bda)
+bool    btsnd_hcic_ble_set_random_addr (BD_ADDR random_bda)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_RANDOM_ADDR_CMD;
     p->offset = 0;
@@ -64,16 +64,16 @@
     BDADDR_TO_STREAM (pp, random_bda);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_write_adv_params (UINT16 adv_int_min, UINT16 adv_int_max,
-                                       UINT8 adv_type, UINT8 addr_type_own,
-                                       UINT8 addr_type_dir, BD_ADDR direct_bda,
-                                       UINT8 channel_map, UINT8 adv_filter_policy)
+bool    btsnd_hcic_ble_write_adv_params (uint16_t adv_int_min, uint16_t adv_int_max,
+                                       uint8_t adv_type, uint8_t addr_type_own,
+                                       uint8_t addr_type_dir, BD_ADDR direct_bda,
+                                       uint8_t channel_map, uint8_t adv_filter_policy)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_WRITE_ADV_PARAMS ;
     p->offset = 0;
@@ -91,12 +91,12 @@
     UINT8_TO_STREAM (pp, adv_filter_policy);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
-BOOLEAN btsnd_hcic_ble_read_adv_chnl_tx_power (void)
+bool    btsnd_hcic_ble_read_adv_chnl_tx_power (void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD;
     p->offset = 0;
@@ -105,14 +105,14 @@
     UINT8_TO_STREAM  (pp, HCIC_PARAM_SIZE_READ_CMD);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 
 }
 
-BOOLEAN btsnd_hcic_ble_set_adv_data (UINT8 data_len, UINT8 *p_data)
+bool    btsnd_hcic_ble_set_adv_data (uint8_t data_len, uint8_t *p_data)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA + 1;
     p->offset = 0;
@@ -133,12 +133,12 @@
     }
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
 
-    return (TRUE);
+    return (true);
 }
-BOOLEAN btsnd_hcic_ble_set_scan_rsp_data (UINT8 data_len, UINT8 *p_scan_rsp)
+bool    btsnd_hcic_ble_set_scan_rsp_data (uint8_t data_len, uint8_t *p_scan_rsp)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_WRITE_SCAN_RSP + 1;
     p->offset = 0;
@@ -161,13 +161,13 @@
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
 
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_set_adv_enable (UINT8 adv_enable)
+bool    btsnd_hcic_ble_set_adv_enable (uint8_t adv_enable)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_ADV_ENABLE;
     p->offset = 0;
@@ -178,14 +178,14 @@
     UINT8_TO_STREAM (pp, adv_enable);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
-BOOLEAN btsnd_hcic_ble_set_scan_params (UINT8 scan_type,
-                                          UINT16 scan_int, UINT16 scan_win,
-                                          UINT8 addr_type_own, UINT8 scan_filter_policy)
+bool    btsnd_hcic_ble_set_scan_params (uint8_t scan_type,
+                                          uint16_t scan_int, uint16_t scan_win,
+                                          uint8_t addr_type_own, uint8_t scan_filter_policy)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_WRITE_SCAN_PARAM;
     p->offset = 0;
@@ -200,13 +200,13 @@
     UINT8_TO_STREAM (pp, scan_filter_policy);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_set_scan_enable (UINT8 scan_enable, UINT8 duplicate)
+bool    btsnd_hcic_ble_set_scan_enable (uint8_t scan_enable, uint8_t duplicate)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_WRITE_SCAN_ENABLE;
     p->offset = 0;
@@ -218,20 +218,20 @@
     UINT8_TO_STREAM (pp, duplicate);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
 /* link layer connection management commands */
-BOOLEAN btsnd_hcic_ble_create_ll_conn (UINT16 scan_int, UINT16 scan_win,
-                                       UINT8 init_filter_policy,
-                                       UINT8 addr_type_peer, BD_ADDR bda_peer,
-                                       UINT8 addr_type_own,
-                                       UINT16 conn_int_min, UINT16 conn_int_max,
-                                       UINT16 conn_latency, UINT16 conn_timeout,
-                                       UINT16 min_ce_len, UINT16 max_ce_len)
+bool    btsnd_hcic_ble_create_ll_conn (uint16_t scan_int, uint16_t scan_win,
+                                       uint8_t init_filter_policy,
+                                       uint8_t addr_type_peer, BD_ADDR bda_peer,
+                                       uint8_t addr_type_own,
+                                       uint16_t conn_int_min, uint16_t conn_int_max,
+                                       uint16_t conn_latency, uint16_t conn_timeout,
+                                       uint16_t min_ce_len, uint16_t max_ce_len)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_CREATE_LL_CONN;
     p->offset = 0;
@@ -256,13 +256,13 @@
     UINT16_TO_STREAM (pp, max_ce_len);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_create_conn_cancel (void)
+bool    btsnd_hcic_ble_create_conn_cancel (void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_CREATE_CONN_CANCEL;
     p->offset = 0;
@@ -271,13 +271,13 @@
     UINT8_TO_STREAM  (pp, HCIC_PARAM_SIZE_BLE_CREATE_CONN_CANCEL);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_clear_white_list (void)
+bool    btsnd_hcic_ble_clear_white_list (void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CLEAR_WHITE_LIST;
     p->offset = 0;
@@ -286,13 +286,13 @@
     UINT8_TO_STREAM  (pp, HCIC_PARAM_SIZE_CLEAR_WHITE_LIST);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_add_white_list (UINT8 addr_type, BD_ADDR bda)
+bool    btsnd_hcic_ble_add_white_list (uint8_t addr_type, BD_ADDR bda)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ADD_WHITE_LIST;
     p->offset = 0;
@@ -304,13 +304,13 @@
     BDADDR_TO_STREAM (pp, bda);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_remove_from_white_list (UINT8 addr_type, BD_ADDR bda)
+bool    btsnd_hcic_ble_remove_from_white_list (uint8_t addr_type, BD_ADDR bda)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REMOVE_WHITE_LIST;
     p->offset = 0;
@@ -322,16 +322,16 @@
     BDADDR_TO_STREAM (pp, bda);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_upd_ll_conn_params (UINT16 handle,
-                                           UINT16 conn_int_min, UINT16 conn_int_max,
-                                           UINT16 conn_latency, UINT16 conn_timeout,
-                                           UINT16 min_ce_len, UINT16 max_ce_len)
+bool    btsnd_hcic_ble_upd_ll_conn_params (uint16_t handle,
+                                           uint16_t conn_int_min, uint16_t conn_int_max,
+                                           uint16_t conn_latency, uint16_t conn_timeout,
+                                           uint16_t min_ce_len, uint16_t max_ce_len)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_UPD_LL_CONN_PARAMS;
     p->offset = 0;
@@ -349,13 +349,13 @@
     UINT16_TO_STREAM (pp, max_ce_len);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_set_host_chnl_class (UINT8  chnl_map[HCIC_BLE_CHNL_MAP_SIZE])
+bool    btsnd_hcic_ble_set_host_chnl_class (uint8_t chnl_map[HCIC_BLE_CHNL_MAP_SIZE])
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_HOST_CHNL_CLASS;
     p->offset = 0;
@@ -366,13 +366,13 @@
     ARRAY_TO_STREAM (pp, chnl_map, HCIC_BLE_CHNL_MAP_SIZE);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_read_chnl_map (UINT16 handle)
+bool    btsnd_hcic_ble_read_chnl_map (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CHNL_MAP;
     p->offset = 0;
@@ -383,13 +383,13 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_read_remote_feat (UINT16 handle)
+bool    btsnd_hcic_ble_read_remote_feat (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_READ_REMOTE_FEAT;
     p->offset = 0;
@@ -400,16 +400,16 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
 /* security management commands */
-BOOLEAN btsnd_hcic_ble_encrypt (UINT8 *key, UINT8 key_len,
-                                UINT8 *plain_text, UINT8 pt_len,
+bool    btsnd_hcic_ble_encrypt (uint8_t *key, uint8_t key_len,
+                                uint8_t *plain_text, uint8_t pt_len,
                                 void *p_cmd_cplt_cback)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_ENCRYPT;
     p->offset = sizeof(void *);
@@ -431,13 +431,13 @@
     ARRAY_TO_STREAM (pp, plain_text, pt_len);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_rand (void *p_cmd_cplt_cback)
+bool    btsnd_hcic_ble_rand (void *p_cmd_cplt_cback)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_RAND;
     p->offset = sizeof(void *);
@@ -449,14 +449,14 @@
     UINT8_TO_STREAM  (pp, HCIC_PARAM_SIZE_BLE_RAND);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_start_enc (UINT16 handle, UINT8 rand[HCIC_BLE_RAND_DI_SIZE],
-                                UINT16 ediv, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE])
+bool    btsnd_hcic_ble_start_enc (uint16_t handle, uint8_t rand[HCIC_BLE_RAND_DI_SIZE],
+                                uint16_t ediv, uint8_t ltk[HCIC_BLE_ENCRYT_KEY_SIZE])
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_START_ENC;
     p->offset = 0;
@@ -470,13 +470,13 @@
     ARRAY_TO_STREAM (pp, ltk, HCIC_BLE_ENCRYT_KEY_SIZE);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_ltk_req_reply (UINT16 handle, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE])
+bool    btsnd_hcic_ble_ltk_req_reply (uint16_t handle, uint8_t ltk[HCIC_BLE_ENCRYT_KEY_SIZE])
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_LTK_REQ_REPLY;
     p->offset = 0;
@@ -488,13 +488,13 @@
     ARRAY_TO_STREAM (pp, ltk, HCIC_BLE_ENCRYT_KEY_SIZE);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_ltk_req_neg_reply (UINT16 handle)
+bool    btsnd_hcic_ble_ltk_req_neg_reply (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_LTK_REQ_NEG_REPLY;
     p->offset = 0;
@@ -505,13 +505,13 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_receiver_test(UINT8 rx_freq)
+bool    btsnd_hcic_ble_receiver_test(uint8_t rx_freq)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1;
     p->offset = 0;
@@ -522,13 +522,13 @@
     UINT8_TO_STREAM (pp, rx_freq);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_transmitter_test(UINT8 tx_freq, UINT8 test_data_len, UINT8 payload)
+bool    btsnd_hcic_ble_transmitter_test(uint8_t tx_freq, uint8_t test_data_len, uint8_t payload)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM3;
     p->offset = 0;
@@ -541,13 +541,13 @@
     UINT8_TO_STREAM (pp, payload);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_test_end(void)
+bool    btsnd_hcic_ble_test_end(void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD;
     p->offset = 0;
@@ -556,13 +556,13 @@
     UINT8_TO_STREAM  (pp, HCIC_PARAM_SIZE_READ_CMD);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_read_host_supported (void)
+bool    btsnd_hcic_ble_read_host_supported (void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD;
     p->offset = 0;
@@ -571,18 +571,18 @@
     UINT8_TO_STREAM  (pp, HCIC_PARAM_SIZE_READ_CMD);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
+#if (BLE_LLT_INCLUDED == TRUE)
 
-BOOLEAN btsnd_hcic_ble_rc_param_req_reply(  UINT16 handle,
-                                            UINT16 conn_int_min, UINT16 conn_int_max,
-                                            UINT16 conn_latency, UINT16 conn_timeout,
-                                            UINT16 min_ce_len, UINT16 max_ce_len  )
+bool    btsnd_hcic_ble_rc_param_req_reply(  uint16_t handle,
+                                            uint16_t conn_int_min, uint16_t conn_int_max,
+                                            uint16_t conn_latency, uint16_t conn_timeout,
+                                            uint16_t min_ce_len, uint16_t max_ce_len  )
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_REPLY;
     p->offset = 0;
@@ -599,13 +599,13 @@
     UINT16_TO_STREAM (pp, max_ce_len);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_rc_param_req_neg_reply(UINT16 handle, UINT8 reason)
+bool    btsnd_hcic_ble_rc_param_req_neg_reply(uint16_t handle, uint8_t reason)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_NEG_REPLY;
     p->offset = 0;
@@ -617,16 +617,16 @@
     UINT8_TO_STREAM (pp, reason);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 #endif
 
-BOOLEAN btsnd_hcic_ble_add_device_resolving_list (UINT8 addr_type_peer, BD_ADDR bda_peer,
-    UINT8 irk_peer[HCIC_BLE_IRK_SIZE],
-    UINT8 irk_local[HCIC_BLE_IRK_SIZE])
+bool    btsnd_hcic_ble_add_device_resolving_list (uint8_t addr_type_peer, BD_ADDR bda_peer,
+    uint8_t irk_peer[HCIC_BLE_IRK_SIZE],
+    uint8_t irk_local[HCIC_BLE_IRK_SIZE])
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_ADD_DEV_RESOLVING_LIST;
     p->offset = 0;
@@ -640,13 +640,13 @@
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
 
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_rm_device_resolving_list (UINT8 addr_type_peer, BD_ADDR bda_peer)
+bool    btsnd_hcic_ble_rm_device_resolving_list (uint8_t addr_type_peer, BD_ADDR bda_peer)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_RM_DEV_RESOLVING_LIST;
     p->offset = 0;
@@ -658,13 +658,13 @@
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
 
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_clear_resolving_list (void)
+bool    btsnd_hcic_ble_clear_resolving_list (void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_CLEAR_RESOLVING_LIST;
     p->offset = 0;
@@ -674,13 +674,13 @@
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
 
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_read_resolvable_addr_peer (UINT8 addr_type_peer, BD_ADDR bda_peer)
+bool    btsnd_hcic_ble_read_resolvable_addr_peer (uint8_t addr_type_peer, BD_ADDR bda_peer)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_PEER;
     p->offset = 0;
@@ -692,13 +692,13 @@
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
 
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_read_resolvable_addr_local (UINT8 addr_type_peer, BD_ADDR bda_peer)
+bool    btsnd_hcic_ble_read_resolvable_addr_local (uint8_t addr_type_peer, BD_ADDR bda_peer)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_LOCAL;
     p->offset = 0;
@@ -710,13 +710,13 @@
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
 
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_set_addr_resolution_enable (UINT8 addr_resolution_enable)
+bool    btsnd_hcic_ble_set_addr_resolution_enable (uint8_t addr_resolution_enable)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_SET_ADDR_RESOLUTION_ENABLE;
     p->offset = 0;
@@ -727,13 +727,13 @@
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
 
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_set_rand_priv_addr_timeout (UINT16 rpa_timout)
+bool    btsnd_hcic_ble_set_rand_priv_addr_timeout (uint16_t rpa_timout)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_SET_RAND_PRIV_ADDR_TIMOUT;
     p->offset = 0;
@@ -744,13 +744,13 @@
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
 
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_ble_set_data_length(UINT16 conn_handle, UINT16 tx_octets, UINT16 tx_time)
+bool    btsnd_hcic_ble_set_data_length(uint16_t conn_handle, uint16_t tx_octets, uint16_t tx_time)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_SET_DATA_LENGTH;
     p->offset = 0;
@@ -763,7 +763,7 @@
     UINT16_TO_STREAM(pp, tx_time);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return TRUE;
+    return true;
 }
 
 #endif
diff --git a/stack/hcic/hcicmds.c b/stack/hcic/hcicmds.c
index 34fce49..ad0072c 100644
--- a/stack/hcic/hcicmds.c
+++ b/stack/hcic/hcicmds.c
@@ -35,10 +35,10 @@
 
 #include "btm_int.h"    /* Included for UIPC_* macro definitions */
 
-BOOLEAN btsnd_hcic_inquiry(const LAP inq_lap, UINT8 duration, UINT8 response_cnt)
+bool    btsnd_hcic_inquiry(const LAP inq_lap, uint8_t duration, uint8_t response_cnt)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_INQUIRY;
     p->offset = 0;
@@ -51,13 +51,13 @@
     UINT8_TO_STREAM (pp, response_cnt);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_inq_cancel(void)
+bool    btsnd_hcic_inq_cancel(void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_INQ_CANCEL;
     p->offset = 0;
@@ -65,14 +65,14 @@
     UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_INQ_CANCEL);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_per_inq_mode (UINT16 max_period, UINT16 min_period,
-                                 const LAP inq_lap, UINT8 duration, UINT8 response_cnt)
+bool    btsnd_hcic_per_inq_mode (uint16_t max_period, uint16_t min_period,
+                                 const LAP inq_lap, uint8_t duration, uint8_t response_cnt)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PER_INQ_MODE;
     p->offset = 0;
@@ -87,13 +87,13 @@
     UINT8_TO_STREAM  (pp, response_cnt);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_exit_per_inq (void)
+bool    btsnd_hcic_exit_per_inq (void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_EXIT_PER_INQ;
     p->offset = 0;
@@ -101,16 +101,16 @@
     UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_EXIT_PER_INQ);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
 
-BOOLEAN btsnd_hcic_create_conn(BD_ADDR dest, UINT16 packet_types,
-                               UINT8 page_scan_rep_mode, UINT8 page_scan_mode,
-                               UINT16 clock_offset, UINT8 allow_switch)
+bool    btsnd_hcic_create_conn(BD_ADDR dest, uint16_t packet_types,
+                               uint8_t page_scan_rep_mode, uint8_t page_scan_mode,
+                               uint16_t clock_offset, uint8_t allow_switch)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
 #ifndef BT_10A
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN;
@@ -134,13 +134,13 @@
     UINT8_TO_STREAM  (pp, allow_switch);
 #endif
     btm_acl_paging (p, dest);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_disconnect (UINT16 handle, UINT8 reason)
+bool    btsnd_hcic_disconnect (uint16_t handle, uint8_t reason)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_DISCONNECT;
     p->offset = 0;
@@ -151,14 +151,14 @@
     UINT8_TO_STREAM  (pp, reason);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-#if BTM_SCO_INCLUDED == TRUE
-BOOLEAN btsnd_hcic_add_SCO_conn (UINT16 handle, UINT16 packet_types)
+#if (BTM_SCO_INCLUDED == TRUE)
+bool    btsnd_hcic_add_SCO_conn (uint16_t handle, uint16_t packet_types)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ADD_SCO_CONN;
     p->offset = 0;
@@ -170,14 +170,14 @@
     UINT16_TO_STREAM (pp, packet_types);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 #endif /* BTM_SCO_INCLUDED */
 
-BOOLEAN btsnd_hcic_create_conn_cancel(BD_ADDR dest)
+bool    btsnd_hcic_create_conn_cancel(BD_ADDR dest)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN_CANCEL;
     p->offset = 0;
@@ -188,13 +188,13 @@
     BDADDR_TO_STREAM (pp, dest);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_accept_conn (BD_ADDR dest, UINT8 role)
+bool    btsnd_hcic_accept_conn (BD_ADDR dest, uint8_t role)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ACCEPT_CONN;
     p->offset = 0;
@@ -206,13 +206,13 @@
 
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_reject_conn (BD_ADDR dest, UINT8 reason)
+bool    btsnd_hcic_reject_conn (BD_ADDR dest, uint8_t reason)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REJECT_CONN;
     p->offset = 0;
@@ -225,13 +225,13 @@
 
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr, LINK_KEY link_key)
+bool    btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr, LINK_KEY link_key)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY;
     p->offset = 0;
@@ -243,13 +243,13 @@
     ARRAY16_TO_STREAM (pp, link_key);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr)
+bool    btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY;
     p->offset = 0;
@@ -260,14 +260,14 @@
     BDADDR_TO_STREAM (pp, bd_addr);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr, UINT8 pin_code_len,
+bool    btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr, uint8_t pin_code_len,
                                     PIN_CODE pin_code)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
     int i;
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY;
@@ -287,13 +287,13 @@
 
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr)
+bool    btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY;
     p->offset = 0;
@@ -304,13 +304,13 @@
     BDADDR_TO_STREAM (pp, bd_addr);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_change_conn_type (UINT16 handle, UINT16 packet_types)
+bool    btsnd_hcic_change_conn_type (uint16_t handle, uint16_t packet_types)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CHANGE_CONN_TYPE;
     p->offset = 0;
@@ -322,13 +322,13 @@
     UINT16_TO_STREAM (pp, packet_types);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_auth_request (UINT16 handle)
+bool    btsnd_hcic_auth_request (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE;
     p->offset = 0;
@@ -339,13 +339,13 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_set_conn_encrypt (UINT16 handle, BOOLEAN enable)
+bool    btsnd_hcic_set_conn_encrypt (uint16_t handle, bool    enable)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_CONN_ENCRYPT;
     p->offset = 0;
@@ -357,14 +357,14 @@
     UINT8_TO_STREAM  (pp, enable);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_rmt_name_req (BD_ADDR bd_addr, UINT8 page_scan_rep_mode,
-                                 UINT8 page_scan_mode, UINT16 clock_offset)
+bool    btsnd_hcic_rmt_name_req (BD_ADDR bd_addr, uint8_t page_scan_rep_mode,
+                                 uint8_t page_scan_mode, uint16_t clock_offset)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_NAME_REQ;
     p->offset = 0;
@@ -378,13 +378,13 @@
     UINT16_TO_STREAM (pp, clock_offset);
 
     btm_acl_paging (p, bd_addr);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_rmt_name_req_cancel (BD_ADDR bd_addr)
+bool    btsnd_hcic_rmt_name_req_cancel (BD_ADDR bd_addr)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL;
     p->offset = 0;
@@ -395,13 +395,13 @@
     BDADDR_TO_STREAM (pp, bd_addr);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_rmt_features_req (UINT16 handle)
+bool    btsnd_hcic_rmt_features_req (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE;
     p->offset = 0;
@@ -412,13 +412,13 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_rmt_ext_features (UINT16 handle, UINT8 page_num)
+bool    btsnd_hcic_rmt_ext_features (uint16_t handle, uint8_t page_num)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_EXT_FEATURES;
     p->offset = 0;
@@ -430,13 +430,13 @@
     UINT8_TO_STREAM (pp, page_num);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_rmt_ver_req (UINT16 handle)
+bool    btsnd_hcic_rmt_ver_req (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE;
     p->offset = 0;
@@ -447,13 +447,13 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_read_rmt_clk_offset (UINT16 handle)
+bool    btsnd_hcic_read_rmt_clk_offset (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE;
     p->offset = 0;
@@ -464,13 +464,13 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_read_lmp_handle (UINT16 handle)
+bool    btsnd_hcic_read_lmp_handle (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE;
     p->offset = 0;
@@ -481,15 +481,15 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_setup_esco_conn (UINT16 handle, UINT32 tx_bw,
-                                    UINT32 rx_bw, UINT16 max_latency, UINT16 voice,
-                                    UINT8 retrans_effort, UINT16 packet_types)
+bool    btsnd_hcic_setup_esco_conn (uint16_t handle, uint32_t tx_bw,
+                                    uint32_t rx_bw, uint16_t max_latency, uint16_t voice,
+                                    uint8_t retrans_effort, uint16_t packet_types)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SETUP_ESCO;
     p->offset = 0;
@@ -506,16 +506,16 @@
     UINT16_TO_STREAM (pp, packet_types);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr, UINT32 tx_bw,
-                                     UINT32 rx_bw, UINT16 max_latency,
-                                     UINT16 content_fmt, UINT8 retrans_effort,
-                                     UINT16 packet_types)
+bool    btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr, uint32_t tx_bw,
+                                     uint32_t rx_bw, uint16_t max_latency,
+                                     uint16_t content_fmt, uint8_t retrans_effort,
+                                     uint16_t packet_types)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ACCEPT_ESCO;
     p->offset = 0;
@@ -532,13 +532,13 @@
     UINT16_TO_STREAM (pp, packet_types);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, UINT8 reason)
+bool    btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, uint8_t reason)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REJECT_ESCO;
     p->offset = 0;
@@ -550,14 +550,14 @@
     UINT8_TO_STREAM  (pp, reason);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_hold_mode (UINT16 handle, UINT16 max_hold_period,
-                              UINT16 min_hold_period)
+bool    btsnd_hcic_hold_mode (uint16_t handle, uint16_t max_hold_period,
+                              uint16_t min_hold_period)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_HOLD_MODE;
     p->offset = 0;
@@ -570,15 +570,15 @@
     UINT16_TO_STREAM (pp, min_hold_period);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_sniff_mode (UINT16 handle, UINT16 max_sniff_period,
-                               UINT16 min_sniff_period, UINT16 sniff_attempt,
-                               UINT16 sniff_timeout)
+bool    btsnd_hcic_sniff_mode (uint16_t handle, uint16_t max_sniff_period,
+                               uint16_t min_sniff_period, uint16_t sniff_attempt,
+                               uint16_t sniff_timeout)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SNIFF_MODE;
     p->offset = 0;
@@ -593,13 +593,13 @@
     UINT16_TO_STREAM (pp, sniff_timeout);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_exit_sniff_mode (UINT16 handle)
+bool    btsnd_hcic_exit_sniff_mode (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE;
     p->offset = 0;
@@ -610,14 +610,14 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return TRUE;
+    return true;
 }
 
-BOOLEAN btsnd_hcic_park_mode (UINT16 handle, UINT16 beacon_max_interval,
-                              UINT16 beacon_min_interval)
+bool    btsnd_hcic_park_mode (uint16_t handle, uint16_t beacon_max_interval,
+                              uint16_t beacon_min_interval)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PARK_MODE;
     p->offset = 0;
@@ -630,13 +630,13 @@
     UINT16_TO_STREAM (pp, beacon_min_interval);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_exit_park_mode (UINT16 handle)
+bool    btsnd_hcic_exit_park_mode (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE;
     p->offset = 0;
@@ -647,15 +647,15 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return TRUE;
+    return true;
 }
 
-BOOLEAN btsnd_hcic_qos_setup (UINT16 handle, UINT8 flags, UINT8 service_type,
-                              UINT32 token_rate, UINT32 peak, UINT32 latency,
-                              UINT32 delay_var)
+bool    btsnd_hcic_qos_setup (uint16_t handle, uint8_t flags, uint8_t service_type,
+                              uint32_t token_rate, uint32_t peak, uint32_t latency,
+                              uint32_t delay_var)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_QOS_SETUP;
     p->offset = 0;
@@ -672,13 +672,13 @@
     UINT32_TO_STREAM (pp, delay_var);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_switch_role (BD_ADDR bd_addr, UINT8 role)
+bool    btsnd_hcic_switch_role (BD_ADDR bd_addr, uint8_t role)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SWITCH_ROLE;
     p->offset = 0;
@@ -690,13 +690,13 @@
     UINT8_TO_STREAM  (pp, role);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_policy_set (UINT16 handle, UINT16 settings)
+bool    btsnd_hcic_write_policy_set (uint16_t handle, uint16_t settings)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_POLICY_SET;
     p->offset = 0;
@@ -707,13 +707,13 @@
     UINT16_TO_STREAM (pp, settings);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_def_policy_set (UINT16 settings)
+bool    btsnd_hcic_write_def_policy_set (uint16_t settings)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET;
     p->offset = 0;
@@ -723,14 +723,14 @@
     UINT16_TO_STREAM (pp, settings);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_set_event_filter (UINT8 filt_type, UINT8 filt_cond_type,
-                                     UINT8 *filt_cond, UINT8 filt_cond_len)
+bool    btsnd_hcic_set_event_filter (uint8_t filt_type, uint8_t filt_cond_type,
+                                     uint8_t *filt_cond, uint8_t filt_cond_len)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->offset = 0;
 
@@ -738,8 +738,8 @@
 
     if (filt_type)
     {
-        p->len = (UINT16)(HCIC_PREAMBLE_SIZE + 2 + filt_cond_len);
-        UINT8_TO_STREAM (pp, (UINT8)(2 + filt_cond_len));
+        p->len = (uint16_t)(HCIC_PREAMBLE_SIZE + 2 + filt_cond_len);
+        UINT8_TO_STREAM (pp, (uint8_t)(2 + filt_cond_len));
 
         UINT8_TO_STREAM (pp, filt_type);
         UINT8_TO_STREAM (pp, filt_cond_type);
@@ -766,20 +766,20 @@
     }
     else
     {
-        p->len = (UINT16)(HCIC_PREAMBLE_SIZE + 1);
+        p->len = (uint16_t)(HCIC_PREAMBLE_SIZE + 1);
         UINT8_TO_STREAM (pp, 1);
 
         UINT8_TO_STREAM (pp, filt_type);
     }
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_pin_type (UINT8 type)
+bool    btsnd_hcic_write_pin_type (uint8_t type)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1;
     p->offset = 0;
@@ -790,13 +790,13 @@
     UINT8_TO_STREAM (pp, type);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag)
+bool    btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, bool    delete_all_flag)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_DELETE_STORED_KEY;
     p->offset = 0;
@@ -808,14 +808,14 @@
     UINT8_TO_STREAM  (pp, delete_all_flag);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_change_name (BD_NAME name)
+bool    btsnd_hcic_change_name (BD_NAME name)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
-    UINT16 len = strlen((char *)name) + 1;
+    uint8_t *pp = (uint8_t *)(p + 1);
+    uint16_t len = strlen((char *)name) + 1;
 
     memset(pp, 0, HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CHANGE_NAME);
 
@@ -831,13 +831,13 @@
     ARRAY_TO_STREAM (pp, name, len);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_read_name (void)
+bool    btsnd_hcic_read_name (void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD;
     p->offset = 0;
@@ -846,13 +846,13 @@
     UINT8_TO_STREAM  (pp,  HCIC_PARAM_SIZE_READ_CMD);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_page_tout (UINT16 timeout)
+bool    btsnd_hcic_write_page_tout (uint16_t timeout)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM2;
     p->offset = 0;
@@ -863,13 +863,13 @@
     UINT16_TO_STREAM  (pp, timeout);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_scan_enable (UINT8 flag)
+bool    btsnd_hcic_write_scan_enable (uint8_t flag)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1;
     p->offset = 0;
@@ -880,13 +880,13 @@
     UINT8_TO_STREAM  (pp, flag);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_pagescan_cfg(UINT16 interval, UINT16 window)
+bool    btsnd_hcic_write_pagescan_cfg(uint16_t interval, uint16_t window)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG;
     p->offset = 0;
@@ -898,13 +898,13 @@
     UINT16_TO_STREAM (pp, window);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_inqscan_cfg(UINT16 interval, UINT16 window)
+bool    btsnd_hcic_write_inqscan_cfg(uint16_t interval, uint16_t window)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG;
     p->offset = 0;
@@ -916,13 +916,13 @@
     UINT16_TO_STREAM (pp, window);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_auth_enable (UINT8 flag)
+bool    btsnd_hcic_write_auth_enable (uint8_t flag)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1;
     p->offset = 0;
@@ -933,13 +933,13 @@
     UINT8_TO_STREAM (pp, flag);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_dev_class(DEV_CLASS dev_class)
+bool    btsnd_hcic_write_dev_class(DEV_CLASS dev_class)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM3;
     p->offset = 0;
@@ -950,13 +950,13 @@
     DEVCLASS_TO_STREAM (pp, dev_class);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_voice_settings(UINT16 flags)
+bool    btsnd_hcic_write_voice_settings(uint16_t flags)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM2;
     p->offset = 0;
@@ -967,13 +967,13 @@
     UINT16_TO_STREAM (pp, flags);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_auto_flush_tout (UINT16 handle, UINT16 tout)
+bool    btsnd_hcic_write_auto_flush_tout (uint16_t handle, uint16_t tout)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT;
     p->offset = 0;
@@ -985,13 +985,13 @@
     UINT16_TO_STREAM (pp, tout);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_read_tx_power (UINT16 handle, UINT8 type)
+bool    btsnd_hcic_read_tx_power (uint16_t handle, uint8_t type)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_TX_POWER;
     p->offset = 0;
@@ -1003,14 +1003,14 @@
     UINT8_TO_STREAM  (pp, type);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_host_num_xmitted_pkts (UINT8 num_handles, UINT16 *handle,
-                                          UINT16 *num_pkts)
+bool    btsnd_hcic_host_num_xmitted_pkts (uint8_t num_handles, uint16_t *handle,
+                                          uint16_t *num_pkts)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + 1 + (num_handles * 4);
     p->offset = 0;
@@ -1026,13 +1026,13 @@
     }
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_link_super_tout (UINT8 local_controller_id, UINT16 handle, UINT16 timeout)
+bool    btsnd_hcic_write_link_super_tout (uint8_t local_controller_id, uint16_t handle, uint16_t timeout)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT;
     p->offset = 0;
@@ -1044,13 +1044,13 @@
     UINT16_TO_STREAM (pp, timeout);
 
     btu_hcif_send_cmd (local_controller_id,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_cur_iac_lap (UINT8 num_cur_iac, LAP * const iac_lap)
+bool    btsnd_hcic_write_cur_iac_lap (uint8_t num_cur_iac, LAP * const iac_lap)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + 1 + (LAP_LEN * num_cur_iac);
     p->offset = 0;
@@ -1064,19 +1064,19 @@
         LAP_TO_STREAM (pp, iac_lap[i]);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
 /******************************************
 **    Lisbon Features
 *******************************************/
-#if BTM_SSR_INCLUDED == TRUE
+#if (BTM_SSR_INCLUDED == TRUE)
 
-BOOLEAN btsnd_hcic_sniff_sub_rate(UINT16 handle, UINT16 max_lat,
-                                  UINT16 min_remote_lat, UINT16 min_local_lat)
+bool    btsnd_hcic_sniff_sub_rate(uint16_t handle, uint16_t max_lat,
+                                  uint16_t min_remote_lat, uint16_t min_local_lat)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SNIFF_SUB_RATE;
     p->offset = 0;
@@ -1090,15 +1090,15 @@
     UINT16_TO_STREAM  (pp, min_local_lat);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 #endif /* BTM_SSR_INCLUDED */
 
 /**** Extended Inquiry Response Commands ****/
-void btsnd_hcic_write_ext_inquiry_response (void *buffer, UINT8 fec_req)
+void btsnd_hcic_write_ext_inquiry_response (void *buffer, uint8_t fec_req)
 {
     BT_HDR *p = (BT_HDR *)buffer;
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_EXT_INQ_RESP;
     p->offset = 0;
@@ -1111,11 +1111,11 @@
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
 }
 
-BOOLEAN btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, UINT8 capability,
-                                UINT8 oob_present, UINT8 auth_req)
+bool    btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, uint8_t capability,
+                                uint8_t oob_present, uint8_t auth_req)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_IO_CAP_RESP;
     p->offset = 0;
@@ -1129,13 +1129,13 @@
     UINT8_TO_STREAM  (pp, auth_req);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, UINT8 err_code)
+bool    btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, uint8_t err_code)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY;
     p->offset = 0;
@@ -1147,13 +1147,13 @@
     UINT8_TO_STREAM  (pp, err_code);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_read_local_oob_data (void)
+bool    btsnd_hcic_read_local_oob_data (void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_LOCAL_OOB;
     p->offset = 0;
@@ -1162,13 +1162,13 @@
     UINT8_TO_STREAM  (pp, HCIC_PARAM_SIZE_R_LOCAL_OOB);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, BOOLEAN is_yes)
+bool    btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, bool    is_yes)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_UCONF_REPLY;
     p->offset = 0;
@@ -1189,13 +1189,13 @@
     BDADDR_TO_STREAM (pp, bd_addr);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, UINT32 value)
+bool    btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, uint32_t value)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_U_PKEY_REPLY;
     p->offset = 0;
@@ -1207,13 +1207,13 @@
     UINT32_TO_STREAM (pp, value);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr)
+bool    btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY;
     p->offset = 0;
@@ -1224,13 +1224,13 @@
     BDADDR_TO_STREAM (pp, bd_addr);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, UINT8 *p_c, UINT8 *p_r)
+bool    btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, uint8_t *p_c, uint8_t *p_r)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REM_OOB_REPLY;
     p->offset = 0;
@@ -1243,13 +1243,13 @@
     ARRAY16_TO_STREAM (pp, p_r);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr)
+bool    btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY;
     p->offset = 0;
@@ -1260,14 +1260,14 @@
     BDADDR_TO_STREAM (pp, bd_addr);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
 
-BOOLEAN btsnd_hcic_read_inq_tx_power (void)
+bool    btsnd_hcic_read_inq_tx_power (void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_TX_POWER;
     p->offset = 0;
@@ -1276,13 +1276,13 @@
     UINT8_TO_STREAM  (pp, HCIC_PARAM_SIZE_R_TX_POWER);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, UINT8 notif)
+bool    btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, uint8_t notif)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF;
     p->offset = 0;
@@ -1294,16 +1294,16 @@
     UINT8_TO_STREAM (pp, notif);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
 /**** end of Simple Pairing Commands ****/
 
-#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
-BOOLEAN btsnd_hcic_enhanced_flush (UINT16 handle, UINT8 packet_type)
+#if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
+bool    btsnd_hcic_enhanced_flush (uint16_t handle, uint8_t packet_type)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ENHANCED_FLUSH;
     p->offset = 0;
@@ -1314,7 +1314,7 @@
     UINT8_TO_STREAM  (pp, packet_type);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 #endif
 
@@ -1322,10 +1322,10 @@
 ** End of Lisbon Commands
 **************************/
 
-BOOLEAN btsnd_hcic_get_link_quality (UINT16 handle)
+bool    btsnd_hcic_get_link_quality (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE;
     p->offset = 0;
@@ -1336,13 +1336,13 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_read_rssi (UINT16 handle)
+bool    btsnd_hcic_read_rssi (uint16_t handle)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE;
     p->offset = 0;
@@ -1353,13 +1353,13 @@
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_enable_test_mode (void)
+bool    btsnd_hcic_enable_test_mode (void)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD;
     p->offset = 0;
@@ -1368,13 +1368,13 @@
     UINT8_TO_STREAM  (pp,  HCIC_PARAM_SIZE_READ_CMD);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_inqscan_type (UINT8 type)
+bool    btsnd_hcic_write_inqscan_type (uint8_t type)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1;
     p->offset = 0;
@@ -1385,13 +1385,13 @@
     UINT8_TO_STREAM  (pp, type);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_inquiry_mode (UINT8 mode)
+bool    btsnd_hcic_write_inquiry_mode (uint8_t mode)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1;
     p->offset = 0;
@@ -1402,13 +1402,13 @@
     UINT8_TO_STREAM  (pp, mode);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
-BOOLEAN btsnd_hcic_write_pagescan_type (UINT8 type)
+bool    btsnd_hcic_write_pagescan_type (uint8_t type)
 {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1;
     p->offset = 0;
@@ -1419,7 +1419,7 @@
     UINT8_TO_STREAM  (pp, type);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);
-    return (TRUE);
+    return (true);
 }
 
 /* Must have room to store BT_HDR + max VSC length + callback pointer */
@@ -1427,11 +1427,11 @@
 #error "HCI_CMD_BUF_SIZE must be larger than 268"
 #endif
 
-void btsnd_hcic_vendor_spec_cmd (void *buffer, UINT16 opcode, UINT8 len,
-                                 UINT8 *p_data, void *p_cmd_cplt_cback)
+void btsnd_hcic_vendor_spec_cmd (void *buffer, uint16_t opcode, uint8_t len,
+                                 uint8_t *p_data, void *p_cmd_cplt_cback)
 {
     BT_HDR *p = (BT_HDR *)buffer;
-    UINT8 *pp = (UINT8 *)(p + 1);
+    uint8_t *pp = (uint8_t *)(p + 1);
 
     p->len    = HCIC_PREAMBLE_SIZE + len;
     p->offset = sizeof(void *);
diff --git a/stack/hid/hid_conn.h b/stack/hid/hid_conn.h
index 211efbd..49a6ebd 100644
--- a/stack/hid/hid_conn.h
+++ b/stack/hid/hid_conn.h
@@ -39,7 +39,7 @@
 #define HID_CONN_STATE_DISCONNECTING    (5)
 #define HID_CONN_STATE_SECURITY         (6)
 
-    UINT8             conn_state;
+    uint8_t           conn_state;
 
 #define HID_CONN_FLAGS_IS_ORIG              (0x01)
 #define HID_CONN_FLAGS_HIS_CTRL_CFG_DONE    (0x02)
@@ -50,13 +50,13 @@
 #define HID_CONN_FLAGS_CONGESTED            (0x20)
 #define HID_CONN_FLAGS_INACTIVE             (0x40)
 
-    UINT8             conn_flags;
+    uint8_t           conn_flags;
 
-    UINT8             ctrl_id;
-    UINT16            ctrl_cid;
-    UINT16            intr_cid;
-    UINT16            rem_mtu_size;
-    UINT16            disc_reason;                       /* Reason for disconnecting (for HID_HDEV_EVT_CLOSE) */
+    uint8_t           ctrl_id;
+    uint16_t          ctrl_cid;
+    uint16_t          intr_cid;
+    uint16_t          rem_mtu_size;
+    uint16_t          disc_reason;                       /* Reason for disconnecting (for HID_HDEV_EVT_CLOSE) */
     alarm_t           *process_repage_timer;
 } tHID_CONN;
 
diff --git a/stack/hid/hidh_api.c b/stack/hid/hidh_api.c
index d74b817..d1ad7f7 100644
--- a/stack/hid/hidh_api.c
+++ b/stack/hid/hidh_api.c
@@ -35,11 +35,11 @@
 #include "btu.h"
 #include "btm_int.h"
 
-#if HID_DYNAMIC_MEMORY == FALSE
+#if (HID_DYNAMIC_MEMORY == FALSE)
 tHID_HOST_CTB   hh_cb;
 #endif
 
-static void hidh_search_callback (UINT16 sdp_result);
+static void hidh_search_callback (uint16_t sdp_result);
 
 /*******************************************************************************
 **
@@ -50,7 +50,7 @@
 ** Returns          tHID_STATUS
 **
 *******************************************************************************/
-tHID_STATUS HID_HostGetSDPRecord ( BD_ADDR addr, tSDP_DISCOVERY_DB *p_db, UINT32 db_len,
+tHID_STATUS HID_HostGetSDPRecord ( BD_ADDR addr, tSDP_DISCOVERY_DB *p_db, uint32_t db_len,
                                    tHID_HOST_SDP_CALLBACK *sdp_cback )
 {
     tSDP_UUID   uuid_list;
@@ -67,17 +67,17 @@
     if (SDP_ServiceSearchRequest (addr, p_db, hidh_search_callback))
     {
         hh_cb.sdp_cback = sdp_cback ;
-        hh_cb.sdp_busy = TRUE;
+        hh_cb.sdp_busy = true;
         return HID_SUCCESS;
     }
     else
         return HID_ERR_NO_RESOURCES;
 }
 
-void hidh_get_str_attr( tSDP_DISC_REC *p_rec, UINT16 attr_id, UINT16 max_len, char *str )
+void hidh_get_str_attr( tSDP_DISC_REC *p_rec, uint16_t attr_id, uint16_t max_len, char *str )
 {
     tSDP_DISC_ATTR          *p_attr;
-    UINT16                  name_len;
+    uint16_t                name_len;
 
     if ((p_attr = SDP_FindAttributeInRec(p_rec, attr_id)) != NULL)
     {
@@ -97,19 +97,19 @@
 }
 
 
-static void hidh_search_callback (UINT16 sdp_result)
+static void hidh_search_callback (uint16_t sdp_result)
 {
     tSDP_DISCOVERY_DB       *p_db = hh_cb.p_sdp_db;
     tSDP_DISC_REC           *p_rec;
     tSDP_DISC_ATTR          *p_attr, *p_subattr1, *p_subattr2, *p_repdesc;
     tBT_UUID                hid_uuid;
     tHID_DEV_SDP_INFO       *p_nvi = &hh_cb.sdp_rec;
-    UINT16                  attr_mask = 0;
+    uint16_t                attr_mask = 0;
 
     hid_uuid.len       = LEN_UUID_16;
     hid_uuid.uu.uuid16 = UUID_SERVCLASS_HUMAN_INTERFACE;
 
-    hh_cb.sdp_busy = FALSE;
+    hh_cb.sdp_busy = false;
 
     if (sdp_result != SDP_SUCCESS)
     {
@@ -139,7 +139,7 @@
     }
 
     if ((p_nvi->dscp_info.dl_len = SDP_DISC_ATTR_LEN(p_repdesc->attr_len_type)) != 0)
-        p_nvi->dscp_info.dsc_list = (UINT8 *) &p_repdesc->attr_value;
+        p_nvi->dscp_info.dsc_list = (uint8_t *) &p_repdesc->attr_value;
 
     if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_VIRTUAL_CABLE)) != NULL) &&
         (p_attr->attr_value.v.u8) )
@@ -263,7 +263,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-UINT8 HID_HostSetTraceLevel (UINT8 new_level)
+uint8_t HID_HostSetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         hh_cb.trace_level = new_level;
@@ -297,7 +297,7 @@
     }
 
     hh_cb.callback = dev_cback ;
-    hh_cb.reg_flag = TRUE;
+    hh_cb.reg_flag = true;
 
     return (HID_SUCCESS);
 }
@@ -313,7 +313,7 @@
 *******************************************************************************/
 tHID_STATUS HID_HostDeregister(void)
 {
-    UINT8 i;
+    uint8_t i;
 
     if( !hh_cb.reg_flag )
         return (HID_ERR_NOT_REGISTERED);
@@ -324,7 +324,7 @@
     }
 
     hidh_conn_dereg();
-    hh_cb.reg_flag = FALSE;
+    hh_cb.reg_flag = false;
 
     return (HID_SUCCESS) ;
 }
@@ -338,7 +338,7 @@
 ** Returns          tHID_STATUS
 **
 *******************************************************************************/
-tHID_STATUS HID_HostAddDev ( BD_ADDR addr, UINT16 attr_mask, UINT8 *handle )
+tHID_STATUS HID_HostAddDev ( BD_ADDR addr, uint16_t attr_mask, uint8_t *handle )
 {
     int i;
     /* Find an entry for this device in hh_cb.devices array */
@@ -366,7 +366,7 @@
 
     if (!hh_cb.devices[i].in_use)
     {
-        hh_cb.devices[i].in_use = TRUE;
+        hh_cb.devices[i].in_use = true;
         memcpy( hh_cb.devices[i].addr, addr, sizeof( BD_ADDR ) ) ;
         hh_cb.devices[i].state = HID_DEV_NO_CONN;
         hh_cb.devices[i].conn_tries = 0 ;
@@ -390,7 +390,7 @@
 ** Returns          tHID_STATUS
 **
 *******************************************************************************/
-tHID_STATUS HID_HostRemoveDev ( UINT8 dev_handle )
+tHID_STATUS HID_HostRemoveDev ( uint8_t dev_handle )
 {
     if( !hh_cb.reg_flag )
         return (HID_ERR_NOT_REGISTERED);
@@ -399,7 +399,7 @@
         return HID_ERR_INVALID_PARAM;
 
     HID_HostCloseDev( dev_handle ) ;
-    hh_cb.devices[dev_handle].in_use = FALSE;
+    hh_cb.devices[dev_handle].in_use = false;
     hh_cb.devices[dev_handle].conn.conn_state = HID_CONN_STATE_UNUSED;
     hh_cb.devices[dev_handle].conn.ctrl_cid = hh_cb.devices[dev_handle].conn.intr_cid = 0;
     hh_cb.devices[dev_handle].attr_mask = 0;
@@ -416,7 +416,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-tHID_STATUS HID_HostOpenDev ( UINT8 dev_handle )
+tHID_STATUS HID_HostOpenDev ( uint8_t dev_handle )
 {
     if( !hh_cb.reg_flag )
         return (HID_ERR_NOT_REGISTERED);
@@ -443,8 +443,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-tHID_STATUS HID_HostWriteDev( UINT8 dev_handle, UINT8 t_type,
-                              UINT8 param, UINT16 data, UINT8 report_id, BT_HDR *pbuf  )
+tHID_STATUS HID_HostWriteDev( uint8_t dev_handle, uint8_t t_type,
+                              uint8_t param, uint16_t data, uint8_t report_id, BT_HDR *pbuf  )
 {
     tHID_STATUS status = HID_SUCCESS;
 
@@ -483,7 +483,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-tHID_STATUS HID_HostCloseDev( UINT8 dev_handle )
+tHID_STATUS HID_HostCloseDev( uint8_t dev_handle )
 {
     if( !hh_cb.reg_flag )
         return (HID_ERR_NOT_REGISTERED);
@@ -499,44 +499,44 @@
     return hidh_conn_disconnect( dev_handle );
 }
 
-tHID_STATUS HID_HostSetSecurityLevel(const char serv_name[], UINT8 sec_lvl )
+tHID_STATUS HID_HostSetSecurityLevel(const char serv_name[], uint8_t sec_lvl )
 {
-    if (!BTM_SetSecurityLevel (FALSE, serv_name, BTM_SEC_SERVICE_HIDH_SEC_CTRL,
+    if (!BTM_SetSecurityLevel (false, serv_name, BTM_SEC_SERVICE_HIDH_SEC_CTRL,
                                sec_lvl, HID_PSM_CONTROL, BTM_SEC_PROTO_HID, HID_SEC_CHN))
     {
         HIDH_TRACE_ERROR ("Security Registration 1 failed");
         return (HID_ERR_NO_RESOURCES);
     }
 
-    if (!BTM_SetSecurityLevel (TRUE, serv_name, BTM_SEC_SERVICE_HIDH_SEC_CTRL,
+    if (!BTM_SetSecurityLevel (true, serv_name, BTM_SEC_SERVICE_HIDH_SEC_CTRL,
                                sec_lvl, HID_PSM_CONTROL, BTM_SEC_PROTO_HID, HID_SEC_CHN))
     {
         HIDH_TRACE_ERROR ("Security Registration 2 failed");
         return (HID_ERR_NO_RESOURCES);
     }
 
-    if (!BTM_SetSecurityLevel (FALSE, serv_name, BTM_SEC_SERVICE_HIDH_NOSEC_CTRL,
+    if (!BTM_SetSecurityLevel (false, serv_name, BTM_SEC_SERVICE_HIDH_NOSEC_CTRL,
                                BTM_SEC_NONE, HID_PSM_CONTROL, BTM_SEC_PROTO_HID, HID_NOSEC_CHN))
     {
         HIDH_TRACE_ERROR ("Security Registration 3 failed");
         return (HID_ERR_NO_RESOURCES);
     }
 
-    if (!BTM_SetSecurityLevel (TRUE, serv_name, BTM_SEC_SERVICE_HIDH_NOSEC_CTRL,
+    if (!BTM_SetSecurityLevel (true, serv_name, BTM_SEC_SERVICE_HIDH_NOSEC_CTRL,
                                BTM_SEC_NONE, HID_PSM_CONTROL, BTM_SEC_PROTO_HID, HID_NOSEC_CHN))
     {
         HIDH_TRACE_ERROR ("Security Registration 4 failed");
         return (HID_ERR_NO_RESOURCES);
     }
 
-    if (!BTM_SetSecurityLevel (TRUE, serv_name, BTM_SEC_SERVICE_HIDH_INTR,
+    if (!BTM_SetSecurityLevel (true, serv_name, BTM_SEC_SERVICE_HIDH_INTR,
                                BTM_SEC_NONE, HID_PSM_INTERRUPT, BTM_SEC_PROTO_HID, 0))
     {
         HIDH_TRACE_ERROR ("Security Registration 5 failed");
         return (HID_ERR_NO_RESOURCES);
     }
 
-    if (!BTM_SetSecurityLevel (FALSE, serv_name, BTM_SEC_SERVICE_HIDH_INTR,
+    if (!BTM_SetSecurityLevel (false, serv_name, BTM_SEC_SERVICE_HIDH_INTR,
                                BTM_SEC_NONE, HID_PSM_INTERRUPT, BTM_SEC_PROTO_HID, 0))
     {
         HIDH_TRACE_ERROR ("Security Registration 6 failed");
@@ -552,16 +552,16 @@
 **
 ** Description      check if this device is  of type HID Device
 **
-** Returns          TRUE if device is HID Device else FALSE
+** Returns          true if device is HID Device else false
 **
 *******************************************************************************/
-BOOLEAN hid_known_hid_device (BD_ADDR bd_addr)
+bool    hid_known_hid_device (BD_ADDR bd_addr)
 {
-    UINT8 i;
+    uint8_t i;
     tBTM_INQ_INFO *p_inq_info = BTM_InqDbRead(bd_addr);
 
      if ( !hh_cb.reg_flag )
-        return FALSE;
+        return false;
 
     /* First  check for class of device , if Inq DB has information about this device*/
     if (p_inq_info != NULL)
@@ -571,7 +571,7 @@
             == BTM_COD_MAJOR_PERIPHERAL )
         {
             HIDH_TRACE_DEBUG("hid_known_hid_device:dev found in InqDB & COD matches HID dev");
-            return TRUE;
+            return true;
         }
     }
     else
@@ -582,7 +582,7 @@
             ((p_dev_rec->dev_class[1] & BTM_COD_MAJOR_CLASS_MASK) == BTM_COD_MAJOR_PERIPHERAL ))
         {
             HIDH_TRACE_DEBUG("hid_known_hid_device:dev found in SecDevDB & COD matches HID dev");
-            return TRUE;
+            return true;
         }
     }
 
@@ -591,9 +591,9 @@
      {
          if ((hh_cb.devices[i].in_use) &&
             (memcmp(bd_addr, hh_cb.devices[i].addr, BD_ADDR_LEN) == 0))
-             return TRUE;
+             return true;
      }
     /* Check if this device is marked as HID Device in IOP Dev */
     HIDH_TRACE_DEBUG("hid_known_hid_device:remote is not HID device");
-    return FALSE;
+    return false;
 }
diff --git a/stack/hid/hidh_conn.c b/stack/hid/hidh_conn.c
index 8a6e626..9028bb1 100644
--- a/stack/hid/hidh_conn.c
+++ b/stack/hid/hidh_conn.c
@@ -48,21 +48,21 @@
 
 extern fixed_queue_t *btu_general_alarm_queue;
 
-static UINT8 find_conn_by_cid (UINT16 cid);
-static void hidh_conn_retry (UINT8 dhandle);
+static uint8_t find_conn_by_cid (uint16_t cid);
+static void hidh_conn_retry (uint8_t dhandle);
 
 /********************************************************************************/
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
-static void hidh_l2cif_connect_ind (BD_ADDR  bd_addr, UINT16 l2cap_cid,
-                                    UINT16 psm, UINT8 l2cap_id);
-static void hidh_l2cif_connect_cfm (UINT16 l2cap_cid, UINT16 result);
-static void hidh_l2cif_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
-static void hidh_l2cif_config_cfm (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
-static void hidh_l2cif_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed);
-static void hidh_l2cif_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg);
-static void hidh_l2cif_disconnect_cfm (UINT16 l2cap_cid, UINT16 result);
-static void hidh_l2cif_cong_ind (UINT16 l2cap_cid, BOOLEAN congested);
+static void hidh_l2cif_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid,
+                                    uint16_t psm, uint8_t l2cap_id);
+static void hidh_l2cif_connect_cfm (uint16_t l2cap_cid, uint16_t result);
+static void hidh_l2cif_config_ind (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
+static void hidh_l2cif_config_cfm (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
+static void hidh_l2cif_disconnect_ind (uint16_t l2cap_cid, bool    ack_needed);
+static void hidh_l2cif_data_ind (uint16_t l2cap_cid, BT_HDR *p_msg);
+static void hidh_l2cif_disconnect_cfm (uint16_t l2cap_cid, uint16_t result);
+static void hidh_l2cif_cong_ind (uint16_t l2cap_cid, bool    congested);
 
 static const tL2CAP_APPL_INFO hst_reg_info =
 {
@@ -95,9 +95,9 @@
     /* Initialize the L2CAP configuration. We only care about MTU and flush */
     memset(&hh_cb.l2cap_cfg, 0, sizeof(tL2CAP_CFG_INFO));
 
-    hh_cb.l2cap_cfg.mtu_present          = TRUE;
+    hh_cb.l2cap_cfg.mtu_present          = true;
     hh_cb.l2cap_cfg.mtu                  = HID_HOST_MTU;
-    hh_cb.l2cap_cfg.flush_to_present     = TRUE;
+    hh_cb.l2cap_cfg.flush_to_present     = true;
     hh_cb.l2cap_cfg.flush_to             = HID_HOST_FLUSH_TO;
 
     /* Now, register with L2CAP */
@@ -115,7 +115,7 @@
 
     for (xx = 0; xx < HID_HOST_MAX_DEVICES; xx++)
     {
-        hh_cb.devices[xx].in_use = FALSE ;
+        hh_cb.devices[xx].in_use = false ;
         hh_cb.devices[xx].conn.conn_state = HID_CONN_STATE_UNUSED;
     }
 
@@ -128,10 +128,10 @@
 **
 ** Description      This function disconnects a connection.
 **
-** Returns          TRUE if disconnect started, FALSE if already disconnected
+** Returns          true if disconnect started, false if already disconnected
 **
 *******************************************************************************/
-tHID_STATUS hidh_conn_disconnect (UINT8 dhandle)
+tHID_STATUS hidh_conn_disconnect (uint8_t dhandle)
 {
     tHID_CONN *p_hcon = &hh_cb.devices[dhandle].conn;
 
@@ -168,7 +168,7 @@
 **                  send security block L2C connection response.
 **
 *******************************************************************************/
-void hidh_sec_check_complete_term (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, UINT8 res)
+void hidh_sec_check_complete_term (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, uint8_t res)
 {
     tHID_HOST_DEV_CTB *p_dev= (tHID_HOST_DEV_CTB *) p_ref_data;
     UNUSED(bd_addr);
@@ -207,11 +207,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void hidh_l2cif_connect_ind (BD_ADDR  bd_addr, UINT16 l2cap_cid, UINT16 psm, UINT8 l2cap_id)
+static void hidh_l2cif_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid, uint16_t psm, uint8_t l2cap_id)
 {
     tHID_CONN    *p_hcon;
-    BOOLEAN      bAccept = TRUE;
-    UINT8        i = HID_HOST_MAX_DEVICES;
+    bool         bAccept = true;
+    uint8_t      i = HID_HOST_MAX_DEVICES;
     tHID_HOST_DEV_CTB *p_dev;
 
     HIDH_TRACE_EVENT ("HID-Host Rcvd L2CAP conn ind, PSM: 0x%04x  CID 0x%x", psm, l2cap_cid);
@@ -232,18 +232,18 @@
         if (p_hcon->ctrl_cid == 0)
         {
             HIDH_TRACE_WARNING ("HID-Host Rcvd INTR L2CAP conn ind, but no CTL channel");
-            bAccept = FALSE;
+            bAccept = false;
         }
         if (p_hcon->conn_state != HID_CONN_STATE_CONNECTING_INTR)
         {
             HIDH_TRACE_WARNING ("HID-Host Rcvd INTR L2CAP conn ind, wrong state: %d",
                                  p_hcon->conn_state);
-            bAccept = FALSE;
+            bAccept = false;
         }
     }
     else /* CTRL channel */
     {
-#if defined(HID_HOST_ACPT_NEW_CONN) && (HID_HOST_ACPT_NEW_CONN == TRUE)
+#if (HID_HOST_ACPT_NEW_CONN == TRUE)
         p_hcon->ctrl_cid = p_hcon->intr_cid = 0;
         p_hcon->conn_state = HID_CONN_STATE_UNUSED;
 #else
@@ -251,7 +251,7 @@
         {
             HIDH_TRACE_WARNING ("HID-Host - Rcvd CTL L2CAP conn ind, wrong state: %d",
                                  p_hcon->conn_state);
-            bAccept = FALSE;
+            bAccept = false;
         }
 #endif
     }
@@ -271,7 +271,7 @@
 
         p_hcon->conn_state = HID_CONN_STATE_SECURITY;
         if(btm_sec_mx_access_request (p_dev->addr, HID_PSM_CONTROL,
-            FALSE, BTM_SEC_PROTO_HID,
+            false, BTM_SEC_PROTO_HID,
             (p_dev->attr_mask & HID_SEC_REQUIRED) ? HID_SEC_CHN : HID_NOSEC_CHN,
             &hidh_sec_check_complete_term, p_dev) == BTM_CMD_STARTED)
         {
@@ -310,7 +310,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void hidh_try_repage(UINT8 dhandle)
+void hidh_try_repage(uint8_t dhandle)
 {
     tHID_HOST_DEV_CTB *device;
 
@@ -333,10 +333,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void hidh_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, UINT8 res)
+void hidh_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, uint8_t res)
 {
     tHID_HOST_DEV_CTB *p_dev = (tHID_HOST_DEV_CTB *) p_ref_data;
-    UINT8 dhandle;
+    uint8_t dhandle;
     UNUSED(bd_addr);
     UNUSED (transport);
 
@@ -384,11 +384,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void hidh_l2cif_connect_cfm (UINT16 l2cap_cid, UINT16 result)
+static void hidh_l2cif_connect_cfm (uint16_t l2cap_cid, uint16_t result)
 {
-    UINT8 dhandle;
+    uint8_t dhandle;
     tHID_CONN    *p_hcon = NULL;
-    UINT32  reason;
+    uint32_t reason;
     tHID_HOST_DEV_CTB *p_dev = NULL;
 
     /* Find CCB based on CID, and verify we are in a state to accept this message */
@@ -427,7 +427,7 @@
         else
 #endif
         {
-            reason = HID_L2CAP_CONN_FAIL | (UINT32) result ;
+            reason = HID_L2CAP_CONN_FAIL | (uint32_t) result ;
             hh_cb.callback( dhandle, hh_cb.devices[dhandle].addr, HID_HDEV_EVT_CLOSE, reason, NULL ) ;
         }
         return;
@@ -440,7 +440,7 @@
         p_hcon->disc_reason = HID_L2CAP_CONN_FAIL;  /* In case disconnection occurs before security is completed, then set CLOSE_EVT reason code to "connection failure" */
 
         btm_sec_mx_access_request (p_dev->addr, HID_PSM_CONTROL,
-            TRUE, BTM_SEC_PROTO_HID,
+            true, BTM_SEC_PROTO_HID,
             (p_dev->attr_mask & HID_SEC_REQUIRED) ? HID_SEC_CHN : HID_NOSEC_CHN,
             &hidh_sec_check_complete_orig, p_dev);
     }
@@ -465,11 +465,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void hidh_l2cif_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
+static void hidh_l2cif_config_ind (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
 {
-    UINT8 dhandle;
+    uint8_t dhandle;
     tHID_CONN    *p_hcon = NULL;
-    UINT32  reason;
+    uint32_t reason;
 
     /* Find CCB based on CID */
     if( (dhandle = find_conn_by_cid(l2cap_cid)) < HID_HOST_MAX_DEVICES )
@@ -492,8 +492,8 @@
         p_hcon->rem_mtu_size = p_cfg->mtu;
 
     /* For now, always accept configuration from the other side */
-    p_cfg->flush_to_present = FALSE;
-    p_cfg->mtu_present      = FALSE;
+    p_cfg->flush_to_present = false;
+    p_cfg->mtu_present      = false;
     p_cfg->result           = L2CAP_CFG_OK;
 
     L2CA_ConfigRsp (l2cap_cid, p_cfg);
@@ -549,11 +549,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void hidh_l2cif_config_cfm (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
+static void hidh_l2cif_config_cfm (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
 {
-    UINT8 dhandle;
+    uint8_t dhandle;
     tHID_CONN    *p_hcon = NULL;
-    UINT32  reason;
+    uint32_t reason;
 
     HIDH_TRACE_EVENT ("HID-Host Rcvd cfg cfm, CID: 0x%x  Result: %d", l2cap_cid, p_cfg->result);
 
@@ -571,7 +571,7 @@
     if (p_cfg->result != L2CAP_CFG_OK)
     {
         hidh_conn_disconnect (dhandle);
-        reason = HID_L2CAP_CFG_FAIL | (UINT32) p_cfg->result ;
+        reason = HID_L2CAP_CFG_FAIL | (uint32_t) p_cfg->result ;
         hh_cb.callback( dhandle, hh_cb.devices[dhandle].addr, HID_HDEV_EVT_CLOSE, reason, NULL ) ;
         return;
     }
@@ -627,12 +627,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void hidh_l2cif_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed)
+static void hidh_l2cif_disconnect_ind (uint16_t l2cap_cid, bool    ack_needed)
 {
-    UINT8 dhandle;
+    uint8_t dhandle;
     tHID_CONN    *p_hcon = NULL;
-    UINT16 disc_res = HCI_SUCCESS;
-    UINT16 hid_close_evt_reason;
+    uint16_t disc_res = HCI_SUCCESS;
+    uint16_t hid_close_evt_reason;
 
     /* Find CCB based on CID */
     if( (dhandle = find_conn_by_cid(l2cap_cid)) < HID_HOST_MAX_DEVICES )
@@ -710,9 +710,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void hidh_l2cif_disconnect_cfm (UINT16 l2cap_cid, UINT16 result)
+static void hidh_l2cif_disconnect_cfm (uint16_t l2cap_cid, uint16_t result)
 {
-    UINT8 dhandle;
+    uint8_t dhandle;
     tHID_CONN    *p_hcon = NULL;
     UNUSED(result);
 
@@ -758,9 +758,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void hidh_l2cif_cong_ind (UINT16 l2cap_cid, BOOLEAN congested)
+static void hidh_l2cif_cong_ind (uint16_t l2cap_cid, bool    congested)
 {
-    UINT8 dhandle;
+    uint8_t dhandle;
     tHID_CONN    *p_hcon = NULL;
 
     /* Find CCB based on CID */
@@ -800,11 +800,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void hidh_l2cif_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg)
+static void hidh_l2cif_data_ind (uint16_t l2cap_cid, BT_HDR *p_msg)
 {
-    UINT8           *p_data = (UINT8 *)(p_msg + 1) + p_msg->offset;
-    UINT8           ttype, param, rep_type, evt;
-    UINT8 dhandle;
+    uint8_t         *p_data = (uint8_t *)(p_msg + 1) + p_msg->offset;
+    uint8_t         ttype, param, rep_type, evt;
+    uint8_t dhandle;
     tHID_CONN    *p_hcon = NULL;
 
     HIDH_TRACE_DEBUG ("HID-Host hidh_l2cif_data_ind [l2cap_cid=0x%04x]", l2cap_cid);
@@ -880,19 +880,19 @@
 ** Returns          tHID_STATUS
 **
 *******************************************************************************/
-tHID_STATUS hidh_conn_snd_data (UINT8 dhandle, UINT8 trans_type, UINT8 param,
-                                UINT16 data, UINT8 report_id, BT_HDR *buf)
+tHID_STATUS hidh_conn_snd_data (uint8_t dhandle, uint8_t trans_type, uint8_t param,
+                                uint16_t data, uint8_t report_id, BT_HDR *buf)
 {
     tHID_CONN   *p_hcon = &hh_cb.devices[dhandle].conn;
     BT_HDR      *p_buf;
-    UINT8       *p_out;
-    UINT16      bytes_copied;
-    BOOLEAN     seg_req = FALSE;
-    UINT16      data_size;
-    UINT16      cid;
-    UINT16      buf_size;
-    UINT8       use_data = 0 ;
-    BOOLEAN     blank_datc = FALSE;
+    uint8_t     *p_out;
+    uint16_t    bytes_copied;
+    bool        seg_req = false;
+    uint16_t    data_size;
+    uint16_t    cid;
+    uint16_t    buf_size;
+    uint8_t     use_data = 0 ;
+    bool        blank_datc = false;
 
     if (!BTM_IsAclConnectionUp(hh_cb.devices[dhandle].addr, BT_TRANSPORT_BR_EDR))
     {
@@ -938,17 +938,17 @@
             p_buf = (BT_HDR *)osi_malloc(buf_size);
 
             p_buf->offset = L2CAP_MIN_OFFSET;
-            seg_req = FALSE;
+            seg_req = false;
             data_size = 0;
             bytes_copied = 0;
-            blank_datc = FALSE;
+            blank_datc = false;
         }
         else if ( (buf->len > (p_hcon->rem_mtu_size - 1)))
         {
             p_buf = (BT_HDR *)osi_malloc(buf_size);
 
             p_buf->offset = L2CAP_MIN_OFFSET;
-            seg_req = TRUE;
+            seg_req = true;
             data_size = buf->len;
             bytes_copied = p_hcon->rem_mtu_size - 1;
         }
@@ -956,12 +956,12 @@
         {
             p_buf = buf ;
             p_buf->offset -= 1;
-            seg_req = FALSE;
+            seg_req = false;
             data_size = buf->len;
             bytes_copied = buf->len;
         }
 
-        p_out         = (UINT8 *)(p_buf + 1) + p_buf->offset;
+        p_out         = (uint8_t *)(p_buf + 1) + p_buf->offset;
         *p_out++      = HID_BUILD_HDR(trans_type, param);
 
         /* If report ID required for this device */
@@ -974,7 +974,7 @@
 
         if (seg_req)
         {
-            memcpy (p_out, (((UINT8 *)(buf+1)) + buf->offset), bytes_copied);
+            memcpy (p_out, (((uint8_t *)(buf+1)) + buf->offset), bytes_copied);
             buf->offset += bytes_copied;
             buf->len -= bytes_copied;
         }
@@ -1000,7 +1000,7 @@
         else if( bytes_copied == (p_hcon->rem_mtu_size - 1) )
         {
             trans_type = HID_TRANS_DATAC;
-            blank_datc = TRUE;
+            blank_datc = true;
         }
 
     } while ((data_size != 0) || blank_datc ) ;
@@ -1016,10 +1016,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-tHID_STATUS hidh_conn_initiate (UINT8 dhandle)
+tHID_STATUS hidh_conn_initiate (uint8_t dhandle)
 {
-    UINT8   service_id = BTM_SEC_SERVICE_HIDH_NOSEC_CTRL;
-    UINT32  mx_chan_id = HID_NOSEC_CHN;
+    uint8_t service_id = BTM_SEC_SERVICE_HIDH_NOSEC_CTRL;
+    uint32_t mx_chan_id = HID_NOSEC_CHN;
 
     tHID_HOST_DEV_CTB *p_dev = &hh_cb.devices[dhandle];
 
@@ -1066,9 +1066,9 @@
 ** Returns          address of control block, or NULL if not found
 **
 *******************************************************************************/
-static UINT8 find_conn_by_cid (UINT16 cid)
+static uint8_t find_conn_by_cid (uint16_t cid)
 {
-    UINT8      xx;
+    uint8_t    xx;
 
     for (xx = 0; xx < HID_HOST_MAX_DEVICES; xx++)
     {
@@ -1095,7 +1095,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void hidh_conn_retry(  UINT8 dhandle )
+static void hidh_conn_retry(  uint8_t dhandle )
 {
     tHID_HOST_DEV_CTB *p_dev = &hh_cb.devices[dhandle];
 
diff --git a/stack/hid/hidh_int.h b/stack/hid/hidh_int.h
index 5594831..6af0977 100644
--- a/stack/hid/hidh_int.h
+++ b/stack/hid/hidh_int.h
@@ -40,13 +40,13 @@
 
 typedef struct per_device_ctb
 {
-    BOOLEAN        in_use;
+    bool           in_use;
     BD_ADDR        addr;  /* BD-Addr of the host device */
-    UINT16         attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03- reconn_initiate;
+    uint16_t       attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03- reconn_initiate;
     			                 0x04- sdp_disable; */
-    UINT8          state;  /* Device state if in HOST-KNOWN mode */
-    UINT8          conn_substate;
-    UINT8          conn_tries; /* Remembers to the number of connection attempts while CONNECTING */
+    uint8_t        state;  /* Device state if in HOST-KNOWN mode */
+    uint8_t        conn_substate;
+    uint8_t        conn_tries; /* Remembers to the number of connection attempts while CONNECTING */
 
     tHID_CONN      conn; /* L2CAP channel info */
 } tHID_HOST_DEV_CTB;
@@ -59,27 +59,27 @@
 
 #define MAX_SERVICE_DB_SIZE    4000
 
-    BOOLEAN                 sdp_busy;
+    bool                    sdp_busy;
     tHID_HOST_SDP_CALLBACK  *sdp_cback;
     tSDP_DISCOVERY_DB       *p_sdp_db;
     tHID_DEV_SDP_INFO       sdp_rec;
-    BOOLEAN                 reg_flag;
-    UINT8                   trace_level;
+    bool                    reg_flag;
+    uint8_t                 trace_level;
 } tHID_HOST_CTB;
 
-extern tHID_STATUS hidh_conn_snd_data(UINT8 dhandle, UINT8 trans_type, UINT8 param, \
-                                      UINT16 data,UINT8 rpt_id, BT_HDR *buf);
+extern tHID_STATUS hidh_conn_snd_data(uint8_t dhandle, uint8_t trans_type, uint8_t param, \
+                                      uint16_t data,uint8_t rpt_id, BT_HDR *buf);
 extern tHID_STATUS hidh_conn_reg (void);
 extern void hidh_conn_dereg( void );
-extern tHID_STATUS hidh_conn_disconnect (UINT8 dhandle);
-extern tHID_STATUS hidh_conn_initiate (UINT8 dhandle);
+extern tHID_STATUS hidh_conn_disconnect (uint8_t dhandle);
+extern tHID_STATUS hidh_conn_initiate (uint8_t dhandle);
 extern void hidh_process_repage_timer_timeout(void *data);
-extern void hidh_try_repage(UINT8 dhandle);
+extern void hidh_try_repage(uint8_t dhandle);
 
 /******************************************************************************
 ** Main Control Block
 *******************************************************************************/
-#if HID_DYNAMIC_MEMORY == FALSE
+#if (HID_DYNAMIC_MEMORY == FALSE)
 extern tHID_HOST_CTB  hh_cb;
 #else
 extern tHID_HOST_CTB *hidh_cb_ptr;
diff --git a/stack/include/a2d_api.h b/stack/include/a2d_api.h
index b2f2abb..1debf3d 100644
--- a/stack/include/a2d_api.h
+++ b/stack/include/a2d_api.h
@@ -89,7 +89,7 @@
 #define A2D_BAD_CP_TYPE       0xE0  /* The requested CP Type is not supported. */
 #define A2D_BAD_CP_FORMAT     0xE1  /* The format of Content Protection Service Capability/Content Protection Scheme Dependent Data is not correct. */
 
-typedef UINT8 tA2D_STATUS;
+typedef uint8_t tA2D_STATUS;
 
 /* the return values from A2D_BitsSet() */
 #define A2D_SET_ONE_BIT         1   /* one and only one bit is set */
@@ -104,9 +104,9 @@
  * to hold the result service search. */
 typedef struct
 {
-    UINT32              db_len;  /* Length, in bytes, of the discovery database */
-    UINT16              num_attr;/* The number of attributes in p_attrs */
-    UINT16             *p_attrs; /* The attributes filter. If NULL, A2DP API sets the attribute filter
+    uint32_t            db_len;  /* Length, in bytes, of the discovery database */
+    uint16_t            num_attr;/* The number of attributes in p_attrs */
+    uint16_t           *p_attrs; /* The attributes filter. If NULL, A2DP API sets the attribute filter
                                   * to be ATTR_ID_SERVICE_CLASS_ID_LIST, ATTR_ID_BT_PROFILE_DESC_LIST,
                                   * ATTR_ID_SUPPORTED_FEATURES, ATTR_ID_SERVICE_NAME and ATTR_ID_PROVIDER_NAME.
                                   * If not NULL, the input is taken as the filter. */
@@ -115,18 +115,18 @@
 /* This data type is used in tA2D_FIND_CBACK to report the result of the SDP discovery process. */
 typedef struct
 {
-    UINT16  service_len;    /* Length, in bytes, of the service name */
-    UINT16  provider_len;   /* Length, in bytes, of the provider name */
-    char *  p_service_name; /* Pointer the service name.  This character string may not be null terminated.
-                             * Use the service_len parameter to safely copy this string */
-    char *  p_provider_name;/* Pointer the provider name.  This character string may not be null terminated.
-                             * Use the provider_len parameter to safely copy this string */
-    UINT16  features;       /* Profile supported features */
-    UINT16  avdt_version;   /* AVDTP protocol version */
+    uint16_t service_len;    /* Length, in bytes, of the service name */
+    uint16_t provider_len;   /* Length, in bytes, of the provider name */
+    char *   p_service_name; /* Pointer the service name.  This character string may not be null terminated.
+                              * Use the service_len parameter to safely copy this string */
+    char *   p_provider_name;/* Pointer the provider name.  This character string may not be null terminated.
+                              * Use the provider_len parameter to safely copy this string */
+    uint16_t features;       /* Profile supported features */
+    uint16_t avdt_version;   /* AVDTP protocol version */
 } tA2D_Service;
 
 /* This is the callback to notify the result of the SDP discovery process. */
-typedef void (tA2D_FIND_CBACK)(BOOLEAN found, tA2D_Service * p_service);
+typedef void (tA2D_FIND_CBACK)(bool    found, tA2D_Service * p_service);
 
 
 /*****************************************************************************
@@ -162,8 +162,8 @@
 **                  A2D_FAIL if function execution failed.
 **
 ******************************************************************************/
-extern tA2D_STATUS A2D_AddRecord(UINT16 service_uuid, char *p_service_name, char *p_provider_name,
-        UINT16 features, UINT32 sdp_handle);
+extern tA2D_STATUS A2D_AddRecord(uint16_t service_uuid, char *p_service_name, char *p_provider_name,
+        uint16_t features, uint32_t sdp_handle);
 
 /******************************************************************************
 **
@@ -200,7 +200,7 @@
 **                  A2D_FAIL if function execution failed.
 **
 ******************************************************************************/
-extern tA2D_STATUS A2D_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
+extern tA2D_STATUS A2D_FindService(uint16_t service_uuid, BD_ADDR bd_addr,
                                    tA2D_SDP_DB_PARAMS *p_db, tA2D_FIND_CBACK *p_cback);
 
 /******************************************************************************
@@ -224,7 +224,7 @@
 **                  the input parameter is 0xff.
 **
 ******************************************************************************/
-extern UINT8 A2D_SetTraceLevel (UINT8 new_level);
+extern uint8_t A2D_SetTraceLevel (uint8_t new_level);
 
 /******************************************************************************
 ** Function         A2D_BitsSet
@@ -234,7 +234,7 @@
 **                  A2D_SET_ZERO_BIT, if all bits clear
 **                  A2D_SET_MULTL_BIT, if multiple bits are set
 ******************************************************************************/
-extern UINT8 A2D_BitsSet(UINT8 num);
+extern uint8_t A2D_BitsSet(uint8_t num);
 
 #ifdef __cplusplus
 }
diff --git a/stack/include/a2d_sbc.h b/stack/include/a2d_sbc.h
index 9db009e..4a4c3b0 100644
--- a/stack/include/a2d_sbc.h
+++ b/stack/include/a2d_sbc.h
@@ -80,13 +80,13 @@
 /* data type for the SBC Codec Information Element*/
 typedef struct
 {
-    UINT8   samp_freq;      /* Sampling frequency */
-    UINT8   ch_mode;        /* Channel mode */
-    UINT8   block_len;      /* Block length */
-    UINT8   num_subbands;   /* Number of subbands */
-    UINT8   alloc_mthd;     /* Allocation method */
-    UINT8   max_bitpool;    /* Maximum bitpool */
-    UINT8   min_bitpool;    /* Minimum bitpool */
+    uint8_t samp_freq;      /* Sampling frequency */
+    uint8_t ch_mode;        /* Channel mode */
+    uint8_t block_len;      /* Block length */
+    uint8_t num_subbands;   /* Number of subbands */
+    uint8_t alloc_mthd;     /* Allocation method */
+    uint8_t max_bitpool;    /* Maximum bitpool */
+    uint8_t min_bitpool;    /* Minimum bitpool */
 } tA2D_SBC_CIE;
 
 
@@ -101,7 +101,7 @@
 **
 ** Returns          nothing.
 ******************************************************************************/
-extern void A2D_SbcChkFrInit(UINT8 *p_pkt);
+extern void A2D_SbcChkFrInit(uint8_t *p_pkt);
 
 /******************************************************************************
 **
@@ -111,7 +111,7 @@
 **
 ** Returns          nothing.
 ******************************************************************************/
-extern void A2D_SbcDescramble(UINT8 *p_pkt, UINT16 len);
+extern void A2D_SbcDescramble(uint8_t *p_pkt, uint16_t len);
 
 /******************************************************************************
 **
@@ -131,8 +131,8 @@
 ** Returns          A2D_SUCCESS if function execution succeeded.
 **                  Error status code, otherwise.
 ******************************************************************************/
-extern tA2D_STATUS A2D_BldSbcInfo(UINT8 media_type, tA2D_SBC_CIE *p_ie,
-                                  UINT8 *p_result);
+extern tA2D_STATUS A2D_BldSbcInfo(uint8_t media_type, tA2D_SBC_CIE *p_ie,
+                                  uint8_t *p_result);
 
 /******************************************************************************
 **
@@ -144,7 +144,7 @@
 **                  Input Parameters:
 **                      p_info:  the byte sequence to parse.
 **
-**                      for_caps:  TRUE, if the byte sequence is for get capabilities response.
+**                      for_caps:  true, if the byte sequence is for get capabilities response.
 **
 **                  Output Parameters:
 **                      p_ie:  The SBC Codec Information Element information.
@@ -152,8 +152,8 @@
 ** Returns          A2D_SUCCESS if function execution succeeded.
 **                  Error status code, otherwise.
 ******************************************************************************/
-extern tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, const UINT8 *p_info,
-                                   BOOLEAN for_caps);
+extern tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, const uint8_t *p_info,
+                                   bool    for_caps);
 
 /******************************************************************************
 **
@@ -177,8 +177,8 @@
 **
 ** Returns          void.
 ******************************************************************************/
-extern void A2D_BldSbcMplHdr(UINT8 *p_dst, BOOLEAN frag, BOOLEAN start,
-                             BOOLEAN last, UINT8 num);
+extern void A2D_BldSbcMplHdr(uint8_t *p_dst, bool    frag, bool    start,
+                             bool    last, uint8_t num);
 
 /******************************************************************************
 **
@@ -202,9 +202,9 @@
 **
 ** Returns          void.
 ******************************************************************************/
-extern void A2D_ParsSbcMplHdr(UINT8 *p_src, BOOLEAN *p_frag,
-                              BOOLEAN *p_start, BOOLEAN *p_last,
-                              UINT8 *p_num);
+extern void A2D_ParsSbcMplHdr(uint8_t *p_src, bool    *p_frag,
+                              bool    *p_start, bool    *p_last,
+                              uint8_t *p_num);
 #ifdef __cplusplus
 }
 #endif
diff --git a/stack/include/avct_api.h b/stack/include/avct_api.h
index c0f8996..f16228f 100644
--- a/stack/include/avct_api.h
+++ b/stack/include/avct_api.h
@@ -104,21 +104,21 @@
 *****************************************************************************/
 
 /* Control callback function. */
-typedef void (tAVCT_CTRL_CBACK)(UINT8 handle, UINT8 event, UINT16 result,
+typedef void (tAVCT_CTRL_CBACK)(uint8_t handle, uint8_t event, uint16_t result,
                                 BD_ADDR peer_addr);
 
 /* Message callback function */
 /* p_pkt->layer_specific is AVCT_DATA_CTRL or AVCT_DATA_BROWSE */
-typedef void (tAVCT_MSG_CBACK)(UINT8 handle, UINT8 label, UINT8 cr,
+typedef void (tAVCT_MSG_CBACK)(uint8_t handle, uint8_t label, uint8_t cr,
                                BT_HDR *p_pkt);
 
 /* Structure used by AVCT_CreateConn. */
 typedef struct {
     tAVCT_CTRL_CBACK    *p_ctrl_cback;      /* Control callback */
     tAVCT_MSG_CBACK     *p_msg_cback;       /* Message callback */
-    UINT16              pid;                /* Profile ID */
-    UINT8               role;               /* Initiator/acceptor role */
-    UINT8               control;        /* Control role (Control/Target) */
+    uint16_t            pid;                /* Profile ID */
+    uint8_t             role;               /* Initiator/acceptor role */
+    uint8_t             control;        /* Control role (Control/Target) */
 } tAVCT_CC;
 
 /*****************************************************************************
@@ -139,7 +139,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVCT_Register(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask);
+extern void AVCT_Register(uint16_t mtu, uint16_t mtu_br, uint8_t sec_mask);
 
 /*******************************************************************************
 **
@@ -173,7 +173,7 @@
 ** Returns          AVCT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVCT_CreateConn(UINT8 *p_handle, tAVCT_CC *p_cc,
+extern uint16_t AVCT_CreateConn(uint8_t *p_handle, tAVCT_CC *p_cc,
                               BD_ADDR peer_addr);
 
 /*******************************************************************************
@@ -189,7 +189,7 @@
 ** Returns          AVCT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVCT_RemoveConn(UINT8 handle);
+extern uint16_t AVCT_RemoveConn(uint8_t handle);
 
 /*******************************************************************************
 **
@@ -207,7 +207,7 @@
 ** Returns          AVCT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVCT_CreateBrowse(UINT8 handle, UINT8 role);
+extern uint16_t AVCT_CreateBrowse(uint8_t handle, uint8_t role);
 
 /*******************************************************************************
 **
@@ -222,7 +222,7 @@
 ** Returns          AVCT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVCT_RemoveBrowse(UINT8 handle);
+extern uint16_t AVCT_RemoveBrowse(uint8_t handle);
 
 /*******************************************************************************
 **
@@ -234,7 +234,7 @@
 ** Returns          the peer browsing channel MTU.
 **
 *******************************************************************************/
-extern UINT16 AVCT_GetBrowseMtu (UINT8 handle);
+extern uint16_t AVCT_GetBrowseMtu (uint8_t handle);
 
 /*******************************************************************************
 **
@@ -246,7 +246,7 @@
 ** Returns          the peer MTU size.
 **
 *******************************************************************************/
-extern UINT16 AVCT_GetPeerMtu (UINT8 handle);
+extern uint16_t AVCT_GetPeerMtu (uint8_t handle);
 
 /*******************************************************************************
 **
@@ -269,7 +269,7 @@
 ** Returns          AVCT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVCT_MsgReq(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR *p_msg);
+extern uint16_t AVCT_MsgReq(uint8_t handle, uint8_t label, uint8_t cr, BT_HDR *p_msg);
 
 #ifdef __cplusplus
 }
diff --git a/stack/include/avdt_api.h b/stack/include/avdt_api.h
index db32d3e..1679c29 100644
--- a/stack/include/avdt_api.h
+++ b/stack/include/avdt_api.h
@@ -90,7 +90,7 @@
 #define AVDT_RTCP_PT_SR         200     /* the packet type - SR (Sender Report) */
 #define AVDT_RTCP_PT_RR         201     /* the packet type - RR (Receiver Report) */
 #define AVDT_RTCP_PT_SDES       202     /* the packet type - SDES (Source Description) */
-typedef UINT8 AVDT_REPORT_TYPE;
+typedef uint8_t AVDT_REPORT_TYPE;
 
 #define AVDT_RTCP_SDES_CNAME    1       /* SDES item CNAME */
 #ifndef AVDT_MAX_CNAME_SIZE
@@ -208,80 +208,80 @@
 
 typedef struct
 {
-    UINT32  ntp_sec;        /* NTP time: seconds relative to 0h UTC on 1 January 1900 */
-    UINT32  ntp_frac;       /* NTP time: the fractional part */
-    UINT32  rtp_time;       /* timestamp in RTP header */
-    UINT32  pkt_count;      /* sender's packet count: since starting transmission
+    uint32_t ntp_sec;        /* NTP time: seconds relative to 0h UTC on 1 January 1900 */
+    uint32_t ntp_frac;       /* NTP time: the fractional part */
+    uint32_t rtp_time;       /* timestamp in RTP header */
+    uint32_t pkt_count;      /* sender's packet count: since starting transmission
                              * up until the time this SR packet was generated. */
-    UINT32  octet_count;    /* sender's octet count: same comment */
+    uint32_t octet_count;    /* sender's octet count: same comment */
 } tAVDT_SENDER_INFO;
 
 typedef struct
 {
-    UINT8   frag_lost;      /* fraction lost since last RR */
-    UINT32  packet_lost;    /* cumulative number of packets lost since the beginning */
-    UINT32  seq_num_rcvd;   /* extended highest sequence number received */
-    UINT32  jitter;         /* interarrival jitter */
-    UINT32  lsr;            /* last SR timestamp */
-    UINT32  dlsr;           /* delay since last SR */
+    uint8_t frag_lost;      /* fraction lost since last RR */
+    uint32_t packet_lost;    /* cumulative number of packets lost since the beginning */
+    uint32_t seq_num_rcvd;   /* extended highest sequence number received */
+    uint32_t jitter;         /* interarrival jitter */
+    uint32_t lsr;            /* last SR timestamp */
+    uint32_t dlsr;           /* delay since last SR */
 } tAVDT_REPORT_BLK;
 
 typedef union
 {
     tAVDT_SENDER_INFO   sr;
     tAVDT_REPORT_BLK    rr;
-    UINT8               cname[AVDT_MAX_CNAME_SIZE + 1];
+    uint8_t             cname[AVDT_MAX_CNAME_SIZE + 1];
 } tAVDT_REPORT_DATA;
 
 /* This structure contains parameters which are set at registration. */
 typedef struct {
-    UINT16      ctrl_mtu;   /* L2CAP MTU of the AVDTP signaling channel */
-    UINT8       ret_tout;   /* AVDTP signaling retransmission timeout */
-    UINT8       sig_tout;   /* AVDTP signaling message timeout */
-    UINT8       idle_tout;  /* AVDTP idle signaling channel timeout */
-    UINT8       sec_mask;   /* Security mask for BTM_SetSecurityLevel() */
+    uint16_t    ctrl_mtu;   /* L2CAP MTU of the AVDTP signaling channel */
+    uint8_t     ret_tout;   /* AVDTP signaling retransmission timeout */
+    uint8_t     sig_tout;   /* AVDTP signaling message timeout */
+    uint8_t     idle_tout;  /* AVDTP idle signaling channel timeout */
+    uint8_t     sec_mask;   /* Security mask for BTM_SetSecurityLevel() */
 } tAVDT_REG;
 
 /* This structure contains the SEP information.  This information is
 ** transferred during the discovery procedure.
 */
 typedef struct {
-    BOOLEAN     in_use;         /* TRUE if stream is currently in use */
-    UINT8       seid;           /* Stream endpoint identifier */
-    UINT8       media_type;     /* Media type */
-    UINT8       tsep;           /* SEP type */
+    bool        in_use;         /* true if stream is currently in use */
+    uint8_t     seid;           /* Stream endpoint identifier */
+    uint8_t     media_type;     /* Media type */
+    uint8_t     tsep;           /* SEP type */
 } tAVDT_SEP_INFO;
 
 /* This structure contains the SEP configuration. */
 typedef struct {
-    UINT8   codec_info[AVDT_CODEC_SIZE];        /* Codec capabilities array */
-    UINT8   protect_info[AVDT_PROTECT_SIZE];    /* Content protection capabilities */
-    UINT8   num_codec;                          /* Number of media codec information elements */
-    UINT8   num_protect;                        /* Number of content protection information elements */
-    UINT16  psc_mask;                           /* Protocol service capabilities mask */
-    UINT8   recov_type;                         /* Recovery type */
-    UINT8   recov_mrws;                         /* Maximum recovery window size */
-    UINT8   recov_mnmp;                         /* Recovery maximum number of media packets */
-    UINT8   hdrcmp_mask;                        /* Header compression capabilities */
-#if AVDT_MULTIPLEXING == TRUE
-    UINT8   mux_mask;                           /* Multiplexing capabilities. AVDT_MUX_XXX bits can be combined with a bitwise OR */
-    UINT8   mux_tsid_media;                     /* TSID for media transport session */
-    UINT8   mux_tcid_media;                     /* TCID for media transport session */
-    UINT8   mux_tsid_report;                    /* TSID for reporting transport session */
-    UINT8   mux_tcid_report;                    /* TCID for reporting transport session */
-    UINT8   mux_tsid_recov;                     /* TSID for recovery transport session */
-    UINT8   mux_tcid_recov;                     /* TCID for recovery transport session */
+    uint8_t codec_info[AVDT_CODEC_SIZE];        /* Codec capabilities array */
+    uint8_t protect_info[AVDT_PROTECT_SIZE];    /* Content protection capabilities */
+    uint8_t num_codec;                          /* Number of media codec information elements */
+    uint8_t num_protect;                        /* Number of content protection information elements */
+    uint16_t psc_mask;                           /* Protocol service capabilities mask */
+    uint8_t recov_type;                         /* Recovery type */
+    uint8_t recov_mrws;                         /* Maximum recovery window size */
+    uint8_t recov_mnmp;                         /* Recovery maximum number of media packets */
+    uint8_t hdrcmp_mask;                        /* Header compression capabilities */
+#if (AVDT_MULTIPLEXING == TRUE)
+    uint8_t mux_mask;                           /* Multiplexing capabilities. AVDT_MUX_XXX bits can be combined with a bitwise OR */
+    uint8_t mux_tsid_media;                     /* TSID for media transport session */
+    uint8_t mux_tcid_media;                     /* TCID for media transport session */
+    uint8_t mux_tsid_report;                    /* TSID for reporting transport session */
+    uint8_t mux_tcid_report;                    /* TCID for reporting transport session */
+    uint8_t mux_tsid_recov;                     /* TSID for recovery transport session */
+    uint8_t mux_tcid_recov;                     /* TCID for recovery transport session */
 #endif
 } tAVDT_CFG;
 
 /* Header structure for callback event parameters. */
 typedef struct {
-    UINT8           err_code;           /* Zero if operation succeeded; nonzero if operation failed */
-    UINT8           err_param;          /* Error parameter included for some events */
-    UINT8           label;              /* Transaction label */
-    UINT8           seid;               /* For internal use only */
-    UINT8           sig_id;             /* For internal use only */
-    UINT8           ccb_idx;            /* For internal use only */
+    uint8_t         err_code;           /* Zero if operation succeeded; nonzero if operation failed */
+    uint8_t         err_param;          /* Error parameter included for some events */
+    uint8_t         label;              /* Transaction label */
+    uint8_t         seid;               /* For internal use only */
+    uint8_t         sig_id;             /* For internal use only */
+    uint8_t         ccb_idx;            /* For internal use only */
 } tAVDT_EVT_HDR;
 
 /* This data structure is associated with the AVDT_GETCAP_CFM_EVT,
@@ -296,14 +296,14 @@
 typedef struct {
     tAVDT_EVT_HDR   hdr;                /* Event header */
     tAVDT_CFG       *p_cfg;             /* Pointer to configuration for this SEP */
-    UINT8           int_seid;           /* Stream endpoint ID of stream initiating the operation */
+    uint8_t         int_seid;           /* Stream endpoint ID of stream initiating the operation */
 } tAVDT_SETCONFIG;
 
 /* This data structure is associated with the AVDT_OPEN_IND_EVT and AVDT_OPEN_CFM_EVT. */
 typedef struct {
     tAVDT_EVT_HDR   hdr;                /* Event header */
-    UINT16          peer_mtu;           /* Transport channel L2CAP MTU of the peer */
-    UINT16          lcid;               /* L2CAP LCID for media channel */
+    uint16_t        peer_mtu;           /* Transport channel L2CAP MTU of the peer */
+    uint16_t        lcid;               /* L2CAP LCID for media channel */
 } tAVDT_OPEN;
 
 /* This data structure is associated with the AVDT_SECURITY_IND_EVT
@@ -311,21 +311,21 @@
 */
 typedef struct {
     tAVDT_EVT_HDR   hdr;                /* Event header */
-    UINT8           *p_data;            /* Pointer to security data */
-    UINT16          len;                /* Length in bytes of the security data */
+    uint8_t         *p_data;            /* Pointer to security data */
+    uint16_t        len;                /* Length in bytes of the security data */
 } tAVDT_SECURITY;
 
 /* This data structure is associated with the AVDT_DISCOVER_CFM_EVT. */
 typedef struct {
     tAVDT_EVT_HDR   hdr;                /* Event header */
     tAVDT_SEP_INFO  *p_sep_info;        /* Pointer to SEP information */
-    UINT8           num_seps;           /* Number of stream endpoints */
+    uint8_t         num_seps;           /* Number of stream endpoints */
 } tAVDT_DISCOVER;
 
 /* This data structure is associated with the AVDT_DELAY_REPORT_EVT. */
 typedef struct {
     tAVDT_EVT_HDR   hdr;                /* Event header */
-    UINT16          delay;              /* Delay value */
+    uint16_t        delay;              /* Delay value */
 } tAVDT_DELAY_RPT;
 
 /* Union of all control callback event data structures */
@@ -354,37 +354,37 @@
 ** endpoints and for the AVDT_DiscoverReq() and AVDT_GetCapReq() functions.
 **
 */
-typedef void (tAVDT_CTRL_CBACK)(UINT8 handle, BD_ADDR bd_addr, UINT8 event,
+typedef void (tAVDT_CTRL_CBACK)(uint8_t handle, BD_ADDR bd_addr, uint8_t event,
                                 tAVDT_CTRL *p_data);
 
 /* This is the data callback function.  It is executed when AVDTP has a media
 ** packet ready for the application.  This function is required for SNK
 ** endpoints and not applicable for SRC endpoints.
 */
-typedef void (tAVDT_DATA_CBACK)(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp,
-                                UINT8 m_pt);
+typedef void (tAVDT_DATA_CBACK)(uint8_t handle, BT_HDR *p_pkt, uint32_t time_stamp,
+                                uint8_t m_pt);
 
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
 /* This is the second version of the data callback function. This version uses
 ** application buffer assigned by AVDT_SetMediaBuf. Caller can assign different
 ** buffer during callback or can leave the current buffer for further using.
 ** This callback is called when AVDTP has a media packet ready for the application.
 ** This function is required for SNK endpoints and not applicable for SRC endpoints.
 */
-typedef void (tAVDT_MEDIA_CBACK)(UINT8 handle, UINT8 *p_payload, UINT32 payload_len,
-                                UINT32 time_stamp, UINT16 seq_num, UINT8 m_pt, UINT8 marker);
+typedef void (tAVDT_MEDIA_CBACK)(uint8_t handle, uint8_t *p_payload, uint32_t payload_len,
+                                uint32_t time_stamp, uint16_t seq_num, uint8_t m_pt, uint8_t marker);
 #endif
 
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
 /* This is the report callback function.  It is executed when AVDTP has a reporting
 ** packet ready for the application.  This function is required for streams
 ** created with AVDT_PSC_REPORT.
 */
-typedef void (tAVDT_REPORT_CBACK)(UINT8 handle, AVDT_REPORT_TYPE type,
+typedef void (tAVDT_REPORT_CBACK)(uint8_t handle, AVDT_REPORT_TYPE type,
                                 tAVDT_REPORT_DATA *p_data);
 #endif
 
-typedef UINT16 (tAVDT_GETCAP_REQ) (BD_ADDR bd_addr, UINT8 seid, tAVDT_CFG *p_cfg, tAVDT_CTRL_CBACK *p_cback);
+typedef uint16_t (tAVDT_GETCAP_REQ) (BD_ADDR bd_addr, uint8_t seid, tAVDT_CFG *p_cfg, tAVDT_CTRL_CBACK *p_cback);
 
 /* This structure contains information required when a stream is created.
 ** It is passed to the AVDT_CreateStream() function.
@@ -393,24 +393,24 @@
     tAVDT_CFG           cfg;            /* SEP configuration */
     tAVDT_CTRL_CBACK    *p_ctrl_cback;  /* Control callback function */
     tAVDT_DATA_CBACK    *p_data_cback;  /* Data callback function */
-#if AVDT_MULTIPLEXING == TRUE
+#if (AVDT_MULTIPLEXING == TRUE)
     tAVDT_MEDIA_CBACK   *p_media_cback; /* Media callback function. It will be called only if p_data_cback is NULL */
 #endif
-#if AVDT_REPORTING == TRUE
+#if (AVDT_REPORTING == TRUE)
     tAVDT_REPORT_CBACK  *p_report_cback;/* Report callback function. */
 #endif
-    UINT16              mtu;            /* The L2CAP MTU of the transport channel */
-    UINT16              flush_to;       /* The L2CAP flush timeout of the transport channel */
-    UINT8               tsep;           /* SEP type */
-    UINT8               media_type;     /* Media type */
-    UINT16              nsc_mask;       /* Nonsupported protocol command messages */
+    uint16_t            mtu;            /* The L2CAP MTU of the transport channel */
+    uint16_t            flush_to;       /* The L2CAP flush timeout of the transport channel */
+    uint8_t             tsep;           /* SEP type */
+    uint8_t             media_type;     /* Media type */
+    uint16_t            nsc_mask;       /* Nonsupported protocol command messages */
 } tAVDT_CS;
 
 /* AVDT data option mask is used in the write request */
 #define AVDT_DATA_OPT_NONE      0x00         /* No option still add RTP header */
 #define AVDT_DATA_OPT_NO_RTP   (0x01 << 0)   /* Skip adding RTP header */
 
-typedef UINT8 tAVDT_DATA_OPT_MASK;
+typedef uint8_t tAVDT_DATA_OPT_MASK;
 
 
 
@@ -469,7 +469,7 @@
 ** Function         AVDT_SINK_Deactivate
 **
 ** Description      Deactivate SEP of A2DP Sink. In Use parameter is adjusted.
-**                  In Use will be made TRUE in case of activation. A2DP SRC
+**                  In Use will be made true in case of activation. A2DP SRC
 **                  will receive in_use as true and will not open A2DP Sink
 **                  connection
 **
@@ -488,7 +488,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-extern void AVDT_AbortReq(UINT8 handle);
+extern void AVDT_AbortReq(uint8_t handle);
 
 /*******************************************************************************
 **
@@ -504,7 +504,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_CreateStream(UINT8 *p_handle, tAVDT_CS *p_cs);
+extern uint16_t AVDT_CreateStream(uint8_t *p_handle, tAVDT_CS *p_cs);
 
 /*******************************************************************************
 **
@@ -520,7 +520,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_RemoveStream(UINT8 handle);
+extern uint16_t AVDT_RemoveStream(uint8_t handle);
 
 /*******************************************************************************
 **
@@ -548,8 +548,8 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_DiscoverReq(BD_ADDR bd_addr, tAVDT_SEP_INFO *p_sep_info,
-                               UINT8 max_seps, tAVDT_CTRL_CBACK *p_cback);
+extern uint16_t AVDT_DiscoverReq(BD_ADDR bd_addr, tAVDT_SEP_INFO *p_sep_info,
+                               uint8_t max_seps, tAVDT_CTRL_CBACK *p_cback);
 
 
 /*******************************************************************************
@@ -576,7 +576,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_GetCapReq(BD_ADDR bd_addr, UINT8 seid, tAVDT_CFG *p_cfg,
+extern uint16_t AVDT_GetCapReq(BD_ADDR bd_addr, uint8_t seid, tAVDT_CFG *p_cfg,
                              tAVDT_CTRL_CBACK *p_cback);
 
 /*******************************************************************************
@@ -603,7 +603,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_GetAllCapReq(BD_ADDR bd_addr, UINT8 seid, tAVDT_CFG *p_cfg,
+extern uint16_t AVDT_GetAllCapReq(BD_ADDR bd_addr, uint8_t seid, tAVDT_CFG *p_cfg,
                                 tAVDT_CTRL_CBACK *p_cback);
 
 /*******************************************************************************
@@ -617,7 +617,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_DelayReport(UINT8 handle, UINT8 seid, UINT16 delay);
+extern uint16_t AVDT_DelayReport(uint8_t handle, uint8_t seid, uint16_t delay);
 
 /*******************************************************************************
 **
@@ -632,7 +632,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_OpenReq(UINT8 handle, BD_ADDR bd_addr, UINT8 seid,
+extern uint16_t AVDT_OpenReq(uint8_t handle, BD_ADDR bd_addr, uint8_t seid,
                            tAVDT_CFG *p_cfg);
 
 
@@ -648,8 +648,8 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_ConfigRsp(UINT8 handle, UINT8 label, UINT8 error_code,
-                             UINT8 category);
+extern uint16_t AVDT_ConfigRsp(uint8_t handle, uint8_t label, uint8_t error_code,
+                             uint8_t category);
 
 /*******************************************************************************
 **
@@ -665,7 +665,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_StartReq(UINT8 *p_handles, UINT8 num_handles);
+extern uint16_t AVDT_StartReq(uint8_t *p_handles, uint8_t num_handles);
 
 /*******************************************************************************
 **
@@ -682,7 +682,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_SuspendReq(UINT8 *p_handles, UINT8 num_handles);
+extern uint16_t AVDT_SuspendReq(uint8_t *p_handles, uint8_t num_handles);
 
 /*******************************************************************************
 **
@@ -698,7 +698,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_CloseReq(UINT8 handle);
+extern uint16_t AVDT_CloseReq(uint8_t handle);
 
 /*******************************************************************************
 **
@@ -716,7 +716,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_ReconfigReq(UINT8 handle, tAVDT_CFG *p_cfg);
+extern uint16_t AVDT_ReconfigReq(uint8_t handle, tAVDT_CFG *p_cfg);
 
 /*******************************************************************************
 **
@@ -730,8 +730,8 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_ReconfigRsp(UINT8 handle, UINT8 label, UINT8 error_code,
-                               UINT8 category);
+extern uint16_t AVDT_ReconfigRsp(uint8_t handle, uint8_t label, uint8_t error_code,
+                               uint8_t category);
 
 /*******************************************************************************
 **
@@ -747,7 +747,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_SecurityReq(UINT8 handle, UINT8 *p_data, UINT16 len);
+extern uint16_t AVDT_SecurityReq(uint8_t handle, uint8_t *p_data, uint16_t len);
 
 /*******************************************************************************
 **
@@ -763,8 +763,8 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_SecurityRsp(UINT8 handle, UINT8 label, UINT8 error_code,
-                               UINT8 *p_data, UINT16 len);
+extern uint16_t AVDT_SecurityRsp(uint8_t handle, uint8_t label, uint8_t error_code,
+                               uint8_t *p_data, uint16_t len);
 
 /*******************************************************************************
 **
@@ -799,8 +799,8 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_WriteReq(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp,
-                            UINT8 m_pt);
+extern uint16_t AVDT_WriteReq(uint8_t handle, BT_HDR *p_pkt, uint32_t time_stamp,
+                            uint8_t m_pt);
 /*******************************************************************************
 **
 ** Function         AVDT_WriteReqOpt
@@ -837,8 +837,8 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_WriteReqOpt(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp,
-                               UINT8 m_pt, tAVDT_DATA_OPT_MASK opt);
+extern uint16_t AVDT_WriteReqOpt(uint8_t handle, BT_HDR *p_pkt, uint32_t time_stamp,
+                               uint8_t m_pt, tAVDT_DATA_OPT_MASK opt);
 
 /*******************************************************************************
 **
@@ -855,7 +855,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_ConnectReq(BD_ADDR bd_addr, UINT8 sec_mask,
+extern uint16_t AVDT_ConnectReq(BD_ADDR bd_addr, uint8_t sec_mask,
                               tAVDT_CTRL_CBACK *p_cback);
 
 /*******************************************************************************
@@ -870,7 +870,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_DisconnectReq(BD_ADDR bd_addr, tAVDT_CTRL_CBACK *p_cback);
+extern uint16_t AVDT_DisconnectReq(BD_ADDR bd_addr, tAVDT_CTRL_CBACK *p_cback);
 
 /*******************************************************************************
 **
@@ -881,7 +881,7 @@
 ** Returns          CID if successful, otherwise 0.
 **
 *******************************************************************************/
-extern UINT16 AVDT_GetL2CapChannel(UINT8 handle);
+extern uint16_t AVDT_GetL2CapChannel(uint8_t handle);
 
 /*******************************************************************************
 **
@@ -892,7 +892,7 @@
 ** Returns          CID if successful, otherwise 0.
 **
 *******************************************************************************/
-extern UINT16 AVDT_GetSignalChannel(UINT8 handle, BD_ADDR bd_addr);
+extern uint16_t AVDT_GetSignalChannel(uint8_t handle, BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
@@ -912,7 +912,7 @@
 ** Returns          AVDT_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern UINT16 AVDT_SetMediaBuf(UINT8 handle, UINT8 *p_buf, UINT32 buf_len);
+extern uint16_t AVDT_SetMediaBuf(uint8_t handle, uint8_t *p_buf, uint32_t buf_len);
 
 /*******************************************************************************
 **
@@ -925,7 +925,7 @@
 ** Returns
 **
 *******************************************************************************/
-extern UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
+extern uint16_t AVDT_SendReport(uint8_t handle, AVDT_REPORT_TYPE type,
                               tAVDT_REPORT_DATA *p_data);
 
 /******************************************************************************
@@ -949,7 +949,7 @@
 **                  the input parameter is 0xff.
 **
 ******************************************************************************/
-extern UINT8 AVDT_SetTraceLevel (UINT8 new_level);
+extern uint8_t AVDT_SetTraceLevel (uint8_t new_level);
 
 #ifdef __cplusplus
 }
diff --git a/stack/include/avdtc_api.h b/stack/include/avdtc_api.h
index 9f72aac..82591c5 100644
--- a/stack/include/avdtc_api.h
+++ b/stack/include/avdtc_api.h
@@ -50,8 +50,8 @@
 
 typedef struct {
     tAVDT_EVT_HDR   hdr;                        /* Event header */
-    UINT8           seid_list[AVDT_NUM_SEPS];   /* Array of SEID values */
-    UINT8           num_seps;                   /* Number of values in array */
+    uint8_t         seid_list[AVDT_NUM_SEPS];   /* Array of SEID values */
+    uint8_t         num_seps;                   /* Number of values in array */
 } tAVDT_MULTI;
 
 /* Union of all control callback event data structures */
@@ -62,7 +62,7 @@
     tAVDT_MULTI         suspend_ind;
 } tAVDTC_CTRL;
 
-typedef void tAVDTC_CTRL_CBACK(UINT8 handle, BD_ADDR bd_addr, UINT8 event, tAVDTC_CTRL *p_data);
+typedef void tAVDTC_CTRL_CBACK(uint8_t handle, BD_ADDR bd_addr, uint8_t event, tAVDTC_CTRL *p_data);
 
 /*******************************************************************************
 **
@@ -86,8 +86,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_DiscoverRsp(BD_ADDR bd_addr, UINT8 label,
-                              tAVDT_SEP_INFO sep_info[], UINT8 num_seps);
+extern void AVDTC_DiscoverRsp(BD_ADDR bd_addr, uint8_t label,
+                              tAVDT_SEP_INFO sep_info[], uint8_t num_seps);
 
 /*******************************************************************************
 **
@@ -98,7 +98,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_GetCapRsp(BD_ADDR bd_addr, UINT8 label, tAVDT_CFG *p_cap);
+extern void AVDTC_GetCapRsp(BD_ADDR bd_addr, uint8_t label, tAVDT_CFG *p_cap);
 
 /*******************************************************************************
 **
@@ -109,7 +109,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_GetAllCapRsp(BD_ADDR bd_addr, UINT8 label, tAVDT_CFG *p_cap);
+extern void AVDTC_GetAllCapRsp(BD_ADDR bd_addr, uint8_t label, tAVDT_CFG *p_cap);
 
 /*******************************************************************************
 **
@@ -120,7 +120,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_GetConfigReq(UINT8 handle);
+extern void AVDTC_GetConfigReq(uint8_t handle);
 
 /*******************************************************************************
 **
@@ -131,7 +131,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_GetConfigRsp(UINT8 handle, UINT8 label, tAVDT_CFG *p_cfg);
+extern void AVDTC_GetConfigRsp(uint8_t handle, uint8_t label, tAVDT_CFG *p_cfg);
 
 /*******************************************************************************
 **
@@ -142,7 +142,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_OpenReq(UINT8 handle);
+extern void AVDTC_OpenReq(uint8_t handle);
 
 /*******************************************************************************
 **
@@ -153,7 +153,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_OpenRsp(UINT8 handle, UINT8 label);
+extern void AVDTC_OpenRsp(uint8_t handle, uint8_t label);
 
 /*******************************************************************************
 **
@@ -164,7 +164,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_StartRsp(UINT8 *p_handles, UINT8 num_handles, UINT8 label);
+extern void AVDTC_StartRsp(uint8_t *p_handles, uint8_t num_handles, uint8_t label);
 
 /*******************************************************************************
 **
@@ -175,7 +175,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_CloseRsp(UINT8 handle, UINT8 label);
+extern void AVDTC_CloseRsp(uint8_t handle, uint8_t label);
 
 /*******************************************************************************
 **
@@ -186,7 +186,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_SuspendRsp(UINT8 *p_handles, UINT8 num_handles, UINT8 label);
+extern void AVDTC_SuspendRsp(uint8_t *p_handles, uint8_t num_handles, uint8_t label);
 
 /*******************************************************************************
 **
@@ -197,7 +197,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_AbortReq(UINT8 handle);
+extern void AVDTC_AbortReq(uint8_t handle);
 
 /*******************************************************************************
 **
@@ -208,7 +208,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_AbortRsp(UINT8 handle, UINT8 label);
+extern void AVDTC_AbortRsp(uint8_t handle, uint8_t label);
 
 /*******************************************************************************
 **
@@ -219,8 +219,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void AVDTC_Rej(UINT8 handle, BD_ADDR bd_addr, UINT8 cmd, UINT8 label,
-                      UINT8 err_code, UINT8 err_param);
+extern void AVDTC_Rej(uint8_t handle, BD_ADDR bd_addr, uint8_t cmd, uint8_t label,
+                      uint8_t err_code, uint8_t err_param);
 
 #ifdef __cplusplus
 }
diff --git a/stack/include/avrc_api.h b/stack/include/avrc_api.h
index a2effd7..8ef3f47 100644
--- a/stack/include/avrc_api.h
+++ b/stack/include/avrc_api.h
@@ -133,10 +133,10 @@
  * to hold the result service search. */
 typedef struct
 {
-    UINT32              db_len;  /* Length, in bytes, of the discovery database */
+    uint32_t            db_len;  /* Length, in bytes, of the discovery database */
     tSDP_DISCOVERY_DB  *p_db;    /* Pointer to the discovery database */
-    UINT16              num_attr;/* The number of attributes in p_attrs */
-    UINT16             *p_attrs; /* The attributes filter. If NULL, AVRCP API sets the attribute filter
+    uint16_t            num_attr;/* The number of attributes in p_attrs */
+    uint16_t           *p_attrs; /* The attributes filter. If NULL, AVRCP API sets the attribute filter
                                   * to be ATTR_ID_SERVICE_CLASS_ID_LIST, ATTR_ID_BT_PROFILE_DESC_LIST,
                                   * ATTR_ID_SUPPORTED_FEATURES, ATTR_ID_SERVICE_NAME and ATTR_ID_PROVIDER_NAME.
                                   * If not NULL, the input is taken as the filter. */
@@ -147,12 +147,12 @@
  * implementation of this callback function must copy the p_service_name
  * and p_provider_name parameters passed to it as they are not guaranteed
  * to remain after the callback function exits. */
-typedef void (tAVRC_FIND_CBACK) (UINT16 status);
+typedef void (tAVRC_FIND_CBACK) (uint16_t status);
 
 
 /* This is the control callback function.  This function passes events
  * listed in Table 20 to the application. */
-typedef void (tAVRC_CTRL_CBACK) (UINT8 handle, UINT8 event, UINT16 result,
+typedef void (tAVRC_CTRL_CBACK) (uint8_t handle, uint8_t event, uint16_t result,
              BD_ADDR peer_addr);
 
 
@@ -160,16 +160,16 @@
  * a message packet ready for the application.  The implementation of this
  * callback function must copy the tAVRC_MSG structure passed to it as it
  * is not guaranteed to remain after the callback function exits. */
-typedef void (tAVRC_MSG_CBACK) (UINT8 handle, UINT8 label, UINT8 opcode,
+typedef void (tAVRC_MSG_CBACK) (uint8_t handle, uint8_t label, uint8_t opcode,
              tAVRC_MSG *p_msg);
 
 typedef struct
 {
     tAVRC_CTRL_CBACK    *p_ctrl_cback;  /* pointer to application control callback */
     tAVRC_MSG_CBACK     *p_msg_cback;   /* pointer to application message callback */
-    UINT32              company_id;     /* the company ID  */
-    UINT8               conn;           /* Connection role (Initiator/acceptor) */
-    UINT8               control;        /* Control role (Control/Target) */
+    uint32_t            company_id;     /* the company ID  */
+    uint8_t             conn;           /* Connection role (Initiator/acceptor) */
+    uint8_t             control;        /* Control role (Control/Target) */
 } tAVRC_CONN_CB;
 
 
@@ -209,9 +209,9 @@
 **                  AVRC_NO_RESOURCES if not enough resources to build the SDP record.
 **
 ******************************************************************************/
-extern UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
-                char *p_provider_name, UINT16 categories, UINT32 sdp_handle,
-                BOOLEAN browse_supported, UINT16 profile_version);
+extern uint16_t AVRC_AddRecord(uint16_t service_uuid, char *p_service_name,
+                char *p_provider_name, uint16_t categories, uint32_t sdp_handle,
+                bool    browse_supported, uint16_t profile_version);
 
 /******************************************************************************
 **
@@ -250,7 +250,7 @@
 **                                    perform the service search.
 **
 ******************************************************************************/
-extern UINT16 AVRC_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
+extern uint16_t AVRC_FindService(uint16_t service_uuid, BD_ADDR bd_addr,
                                tAVRC_SDP_DB_PARAMS *p_db, tAVRC_FIND_CBACK *p_cback);
 
 /******************************************************************************
@@ -298,7 +298,7 @@
 **                  the connection.
 **
 ******************************************************************************/
-extern UINT16 AVRC_Open(UINT8 *p_handle, tAVRC_CONN_CB *p_ccb,
+extern uint16_t AVRC_Open(uint8_t *p_handle, tAVRC_CONN_CB *p_ccb,
                         BD_ADDR_PTR peer_addr);
 
 /******************************************************************************
@@ -319,7 +319,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-extern UINT16 AVRC_Close(UINT8 handle);
+extern uint16_t AVRC_Close(uint8_t handle);
 
 /******************************************************************************
 **
@@ -335,7 +335,7 @@
 **                  the connection.
 **
 ******************************************************************************/
-extern UINT16 AVRC_OpenBrowse(UINT8 handle, UINT8 conn_role);
+extern uint16_t AVRC_OpenBrowse(uint8_t handle, uint8_t conn_role);
 
 /******************************************************************************
 **
@@ -349,7 +349,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-extern UINT16 AVRC_CloseBrowse(UINT8 handle);
+extern uint16_t AVRC_CloseBrowse(uint8_t handle);
 
 /******************************************************************************
 **
@@ -367,7 +367,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-extern UINT16 AVRC_MsgReq (UINT8 handle, UINT8 label, UINT8 ctype, BT_HDR *p_pkt);
+extern uint16_t AVRC_MsgReq (uint8_t handle, uint8_t label, uint8_t ctype, BT_HDR *p_pkt);
 
 /******************************************************************************
 **
@@ -390,7 +390,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-extern UINT16 AVRC_UnitCmd(UINT8 handle, UINT8 label);
+extern uint16_t AVRC_UnitCmd(uint8_t handle, uint8_t label);
 
 /******************************************************************************
 **
@@ -417,7 +417,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-extern UINT16 AVRC_SubCmd(UINT8 handle, UINT8 label, UINT8 page);
+extern uint16_t AVRC_SubCmd(uint8_t handle, uint8_t label, uint8_t page);
 
 
 /******************************************************************************
@@ -443,7 +443,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-extern UINT16 AVRC_PassCmd(UINT8 handle, UINT8 label, tAVRC_MSG_PASS *p_msg);
+extern uint16_t AVRC_PassCmd(uint8_t handle, uint8_t label, tAVRC_MSG_PASS *p_msg);
 
 /******************************************************************************
 **
@@ -470,7 +470,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-extern UINT16 AVRC_PassRsp(UINT8 handle, UINT8 label, tAVRC_MSG_PASS *p_msg);
+extern uint16_t AVRC_PassRsp(uint8_t handle, uint8_t label, tAVRC_MSG_PASS *p_msg);
 
 
 /******************************************************************************
@@ -496,7 +496,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-extern UINT16 AVRC_VendorCmd(UINT8  handle, UINT8  label, tAVRC_MSG_VENDOR *p_msg);
+extern uint16_t AVRC_VendorCmd(uint8_t handle, uint8_t label, tAVRC_MSG_VENDOR *p_msg);
 
 
 /******************************************************************************
@@ -524,7 +524,7 @@
 **                  AVRC_BAD_HANDLE if handle is invalid.
 **
 ******************************************************************************/
-extern UINT16 AVRC_VendorRsp(UINT8  handle, UINT8  label, tAVRC_MSG_VENDOR *p_msg);
+extern uint16_t AVRC_VendorRsp(uint8_t handle, uint8_t label, tAVRC_MSG_VENDOR *p_msg);
 
 
 /******************************************************************************
@@ -548,7 +548,7 @@
 **                  the input parameter is 0xff.
 **
 ******************************************************************************/
-extern UINT8 AVRC_SetTraceLevel (UINT8 new_level);
+extern uint8_t AVRC_SetTraceLevel (uint8_t new_level);
 
 /*******************************************************************************
 **
@@ -587,7 +587,7 @@
 **
 *******************************************************************************/
 extern tAVRC_STS AVRC_ParsCommand (tAVRC_MSG *p_msg, tAVRC_COMMAND *p_result,
-                                   UINT8 *p_buf, UINT16 buf_len);
+                                   uint8_t *p_buf, uint16_t buf_len);
 
 /*******************************************************************************
 **
@@ -600,7 +600,7 @@
 **
 *******************************************************************************/
 extern tAVRC_STS AVRC_ParsResponse (tAVRC_MSG *p_msg, tAVRC_RESPONSE *p_result,
-                                    UINT8 *p_buf, UINT16 buf_len);
+                                    uint8_t *p_buf, uint16_t buf_len);
 
 /*******************************************************************************
 **
@@ -613,7 +613,7 @@
 **
 *******************************************************************************/
 extern tAVRC_STS AVRC_Ctrl_ParsResponse (tAVRC_MSG *p_msg, tAVRC_RESPONSE *p_result,
-   UINT8 *p_buf, UINT16* buf_len);
+   uint8_t *p_buf, uint16_t* buf_len);
 
 /*******************************************************************************
 **
@@ -639,7 +639,7 @@
 **                  Otherwise, the error code.
 **
 *******************************************************************************/
-extern tAVRC_STS AVRC_BldResponse( UINT8 handle, tAVRC_RESPONSE *p_rsp, BT_HDR **pp_pkt);
+extern tAVRC_STS AVRC_BldResponse( uint8_t handle, tAVRC_RESPONSE *p_rsp, BT_HDR **pp_pkt);
 
 /**************************************************************************
 **
@@ -647,11 +647,11 @@
 **
 ** Description      Check if correct AVC type is specified
 **
-** Returns          returns TRUE if it is valid
+** Returns          returns true if it is valid
 **
 **
 *******************************************************************************/
-extern BOOLEAN AVRC_IsValidAvcType(UINT8 pdu_id, UINT8 avc_type);
+extern bool    AVRC_IsValidAvcType(uint8_t pdu_id, uint8_t avc_type);
 
 /*******************************************************************************
 **
@@ -660,10 +660,10 @@
 ** Description      Check if the given attrib value is a valid one
 **
 **
-** Returns          returns TRUE if it is valid
+** Returns          returns true if it is valid
 **
 *******************************************************************************/
-extern BOOLEAN AVRC_IsValidPlayerAttr(UINT8 attr);
+extern bool    AVRC_IsValidPlayerAttr(uint8_t attr);
 
 #ifdef __cplusplus
 }
diff --git a/stack/include/avrc_defs.h b/stack/include/avrc_defs.h
index 4ce0139..5a605a6 100644
--- a/stack/include/avrc_defs.h
+++ b/stack/include/avrc_defs.h
@@ -47,21 +47,21 @@
 
 /* command type codes */
 #define AVRC_CMD_CTRL       0   /* Instruct a target to perform an operation */
-#define AVRC_CMD_STATUS     1   /* Check a deviceÂ’s current status */
+#define AVRC_CMD_STATUS     1   /* Check a device's current status */
 #define AVRC_CMD_SPEC_INQ   2   /* Check whether a target supports a particular
                                    control command; all operands are included */
-#define AVRC_CMD_NOTIF      3   /* Used for receiving notification of a change in a deviceÂ’s state */
+#define AVRC_CMD_NOTIF      3   /* Used for receiving notification of a change in a device's state */
 #define AVRC_CMD_GEN_INQ    4   /* Check whether a target supports a particular
                                    control command; operands are not included */
 
 /* response type codes */
 #define AVRC_RSP_NOT_IMPL   8   /* The target does not implement the command specified
                                    by the opcode and operand,
-                                   or doesnÂ’t implement the specified subunit */
+                                   or doesn't implement the specified subunit */
 #define AVRC_RSP_ACCEPT     9   /* The target executed or is executing the command */
 #define AVRC_RSP_REJ        10  /* The target implements the command specified by the
                                    opcode but cannot respond because the current state
-                                   of the target doesnÂ’t allow it */
+                                   of the target doesn't allow it */
 #define AVRC_RSP_IN_TRANS   11  /* The target implements the status command but it is
                                    in a state of transition; the status command may
                                    be retried at a future time */
@@ -70,7 +70,7 @@
                                    commands, the target returns stable and includes
                                    the status results */
 #define AVRC_RSP_CHANGED    13  /* The response frame contains a notification that the
-                                   target deviceÂ’s state has changed */
+                                   target device's state has changed */
 #define AVRC_RSP_INTERIM    15  /* For control commands, the target has accepted the
                                    request but cannot return information within 100
                                    milliseconds; for notify commands, the target accepted
@@ -248,7 +248,7 @@
 #define AVRC_STS_BAD_SEARCH_RES 0x14    /* No valid Search Results - The Search result list does not contain valid entries, e.g. after being invalidated due to change of browsed player   GetFolderItems */
 #define AVRC_STS_NO_AVAL_PLAYER 0x15    /* No available players ALL */
 #define AVRC_STS_ADDR_PLAYER_CHG 0x16   /* Addressed Player Changed - Register Notification */
-typedef UINT8 tAVRC_STS;
+typedef uint8_t tAVRC_STS;
 
 /* Define the Capability IDs
 */
@@ -285,7 +285,7 @@
 #define AVRC_BATTERY_STATUS_CRITICAL            0x02
 #define AVRC_BATTERY_STATUS_EXTERNAL            0x03
 #define AVRC_BATTERY_STATUS_FULL_CHARGE         0x04
-typedef UINT8 tAVRC_BATTERY_STATUS;
+typedef uint8_t tAVRC_BATTERY_STATUS;
 
 /* Define character set */
 #define AVRC_CHAR_SET_SIZE                      2
@@ -310,7 +310,7 @@
 #define AVRC_PLAYSTATE_FWD_SEEK                 0x03    /* Fwd Seek*/
 #define AVRC_PLAYSTATE_REV_SEEK                 0x04    /* Rev Seek*/
 #define AVRC_PLAYSTATE_ERROR                    0xFF    /* Error   */
-typedef UINT8 tAVRC_PLAYSTATE;
+typedef uint8_t tAVRC_PLAYSTATE;
 
 /* Define the events that can be registered for notifications
 */
@@ -344,13 +344,13 @@
 #define AVRC_SYSTEMSTATE_PWR_ON                 0x00
 #define AVRC_SYSTEMSTATE_PWR_OFF                0x01
 #define AVRC_SYSTEMSTATE_PWR_UNPLUGGED          0x02
-typedef UINT8 tAVRC_SYSTEMSTATE;
+typedef uint8_t tAVRC_SYSTEMSTATE;
 
 /* the frequently used character set ids */
-#define AVRC_CHARSET_ID_ASCII                  ((UINT16) 0x0003) /* ASCII */
-#define AVRC_CHARSET_ID_UTF8                   ((UINT16) 0x006a) /* UTF-8 */
-#define AVRC_CHARSET_ID_UTF16                  ((UINT16) 0x03f7) /* 1015 */
-#define AVRC_CHARSET_ID_UTF32                  ((UINT16) 0x03f9) /* 1017 */
+#define AVRC_CHARSET_ID_ASCII                  ((uint16_t) 0x0003) /* ASCII */
+#define AVRC_CHARSET_ID_UTF8                   ((uint16_t) 0x006a) /* UTF-8 */
+#define AVRC_CHARSET_ID_UTF16                  ((uint16_t) 0x03f7) /* 1015 */
+#define AVRC_CHARSET_ID_UTF32                  ((uint16_t) 0x03f9) /* 1017 */
 
 /*****************************************************************************
 **  Advanced Control
@@ -397,7 +397,7 @@
 #define AVRC_DIR_DOWN               0x01  /* Folder Down */
 
 #define AVRC_UID_SIZE               8
-typedef UINT8 tAVRC_UID[AVRC_UID_SIZE];
+typedef uint8_t tAVRC_UID[AVRC_UID_SIZE];
 
 /*****************************************************************************
 **  player attribute - supported features
@@ -757,32 +757,32 @@
 */
 typedef struct
 {
-    UINT8   ctype;          /* Command type.  */
-    UINT8   subunit_type;   /* Subunit type. */
-    UINT8   subunit_id;     /* Subunit ID.  This value is typically ignored in AVRCP,
+    uint8_t ctype;          /* Command type.  */
+    uint8_t subunit_type;   /* Subunit type. */
+    uint8_t subunit_id;     /* Subunit ID.  This value is typically ignored in AVRCP,
                              * except for VENDOR DEPENDENT messages when the value is
                              * vendor-dependent.  Value range is 0-7. */
-    UINT8   opcode;         /* Op Code (passthrough, vendor, etc) */
+    uint8_t opcode;         /* Op Code (passthrough, vendor, etc) */
 } tAVRC_HDR;
 
 /* This structure contains a UNIT INFO message. */
 typedef struct
 {
     tAVRC_HDR   hdr;        /* Message header. */
-    UINT32      company_id; /* Company identifier. */
-    UINT8       unit_type;  /* Unit type.  Uses the same values as subunit type. */
-    UINT8       unit;       /* This value is vendor dependent and typically zero.  */
+    uint32_t    company_id; /* Company identifier. */
+    uint8_t     unit_type;  /* Unit type.  Uses the same values as subunit type. */
+    uint8_t     unit;       /* This value is vendor dependent and typically zero.  */
 } tAVRC_MSG_UNIT;
 
 /* This structure contains a SUBUNIT INFO message. */
 typedef struct
 {
     tAVRC_HDR   hdr;        /* Message header. */
-    UINT8       subunit_type[AVRC_SUB_TYPE_LEN];
+    uint8_t     subunit_type[AVRC_SUB_TYPE_LEN];
                             /* Array containing subunit type values.  */
-    BOOLEAN     panel;      /* TRUE if the panel subunit type is in the
-                             * subunit_type array, FALSE otherwise. */
-    UINT8       page;       /* Specifies which part of the subunit type table is
+    bool        panel;      /* true if the panel subunit type is in the
+                             * subunit_type array, false otherwise. */
+    uint8_t     page;       /* Specifies which part of the subunit type table is
                              * returned.  For AVRCP it is typically zero.
                              * Value range is 0-7. */
 } tAVRC_MSG_SUB;
@@ -791,9 +791,9 @@
 typedef struct
 {
     tAVRC_HDR   hdr;        /* Message header. */
-    UINT32      company_id; /* Company identifier. */
-    UINT8      *p_vendor_data;/* Pointer to vendor dependent data. */
-    UINT16      vendor_len; /* Length in bytes of vendor dependent data. */
+    uint32_t    company_id; /* Company identifier. */
+    uint8_t    *p_vendor_data;/* Pointer to vendor dependent data. */
+    uint16_t    vendor_len; /* Length in bytes of vendor dependent data. */
 } tAVRC_MSG_VENDOR;
 
 /* PASS THROUGH message structure */
@@ -802,11 +802,11 @@
     tAVRC_HDR   hdr;        /* hdr.ctype Unused.
                              * hdr.subunit_type Unused.
                              * hdr.subunit_id Unused. */
-    UINT8       op_id;      /* Operation ID.  */
-    UINT8       state;      /* Keypress state.  */
-    UINT8      *p_pass_data;/* Pointer to data.  This parameter is only valid
+    uint8_t     op_id;      /* Operation ID.  */
+    uint8_t     state;      /* Keypress state.  */
+    uint8_t    *p_pass_data;/* Pointer to data.  This parameter is only valid
                              * when the op_id is AVRC_ID_VENDOR.*/
-    UINT8       pass_len;   /* Length in bytes of data. This parameter is only
+    uint8_t     pass_len;   /* Length in bytes of data. This parameter is only
                              * valid when the op_id is AVRC_ID_VENDOR.*/
 } tAVRC_MSG_PASS;
 
@@ -820,8 +820,8 @@
     tAVRC_HDR   hdr;            /* hdr.ctype AVRC_CMD or AVRC_RSP.
                                  * hdr.subunit_type Unused.
                                  * hdr.subunit_id Unused. */
-    UINT8      *p_browse_data;  /* Pointer to data.  */
-    UINT16      browse_len;     /* Length in bytes of data. */
+    uint8_t    *p_browse_data;  /* Pointer to data.  */
+    uint16_t    browse_len;     /* Length in bytes of data. */
     BT_HDR     *p_browse_pkt;   /* The GKI buffer received. Set to NULL, if the callback function wants to keep the buffer */
 } tAVRC_MSG_BROWSE;
 
@@ -837,26 +837,26 @@
 } tAVRC_MSG;
 
 /* macros */
-#define AVRC_IS_VALID_CAP_ID(a)           ((((a) == AVRC_CAP_COMPANY_ID) || ((a) == AVRC_CAP_EVENTS_SUPPORTED)) ? TRUE : FALSE)
+#define AVRC_IS_VALID_CAP_ID(a)           ((((a) == AVRC_CAP_COMPANY_ID) || ((a) == AVRC_CAP_EVENTS_SUPPORTED)) ? true : false)
 
 #define AVRC_IS_VALID_EVENT_ID(a)           ((((a) >= AVRC_EVT_PLAY_STATUS_CHANGE) && \
-                                              ((a) <= AVRC_EVT_VOLUME_CHANGE)) ? TRUE : FALSE)
+                                              ((a) <= AVRC_EVT_VOLUME_CHANGE)) ? true : false)
 
 #define AVRC_IS_VALID_ATTRIBUTE(a)          ((((((a) > 0) && (a) <= AVRC_PLAYER_SETTING_SCAN)) || \
-					      ((a) >= AVRC_PLAYER_SETTING_LOW_MENU_EXT)) ? TRUE : FALSE)
+					      ((a) >= AVRC_PLAYER_SETTING_LOW_MENU_EXT)) ? true : false)
 
 #define AVRC_IS_VALID_MEDIA_ATTRIBUTE(a)    (((a) >= AVRC_MEDIA_ATTR_ID_TITLE) && \
-                                             ((a) <= AVRC_MEDIA_ATTR_ID_PLAYING_TIME) ? TRUE : FALSE)
+                                             ((a) <= AVRC_MEDIA_ATTR_ID_PLAYING_TIME) ? true : false)
 
-#define AVRC_IS_VALID_BATTERY_STATUS(a)    (((a) <= AVRC_BATTERY_STATUS_FULL_CHARGE) ? TRUE : FALSE)
+#define AVRC_IS_VALID_BATTERY_STATUS(a)    (((a) <= AVRC_BATTERY_STATUS_FULL_CHARGE) ? true : false)
 
-#define AVRC_IS_VALID_SYSTEM_STATUS(a)    (((a) <= AVRC_SYSTEMSTATE_PWR_UNPLUGGED) ? TRUE : FALSE)
+#define AVRC_IS_VALID_SYSTEM_STATUS(a)    (((a) <= AVRC_SYSTEMSTATE_PWR_UNPLUGGED) ? true : false)
 
-#define AVRC_IS_VALID_GROUP(a)    (((a) <= AVRC_PDU_PREV_GROUP) ? TRUE : FALSE)
+#define AVRC_IS_VALID_GROUP(a)    (((a) <= AVRC_PDU_PREV_GROUP) ? true : false)
 
 /* Company ID is 24-bit integer We can not use the macros in bt_types.h */
-#define AVRC_CO_ID_TO_BE_STREAM(p, u32) {*(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)(u32); }
-#define AVRC_BE_STREAM_TO_CO_ID(u32, p) {(u32) = (((UINT32)(*((p) + 2))) + (((UINT32)(*((p) + 1))) << 8) + (((UINT32)(*(p))) << 16)); (p) += 3;}
+#define AVRC_CO_ID_TO_BE_STREAM(p, u32) {*(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 8); *(p)++ = (uint8_t)(u32); }
+#define AVRC_BE_STREAM_TO_CO_ID(u32, p) {(u32) = (((uint32_t)(*((p) + 2))) + (((uint32_t)(*((p) + 1))) << 8) + (((uint32_t)(*(p))) << 16)); (p) += 3;}
 
 /*****************************************************************************
 **  data type definitions
@@ -870,14 +870,14 @@
 *****************************************************************************/
 
 typedef struct {
-    UINT16              charset_id;
-    UINT16              str_len;
-    UINT8               *p_str;
+    uint16_t            charset_id;
+    uint16_t            str_len;
+    uint8_t             *p_str;
 } tAVRC_FULL_NAME;
 
 typedef struct {
-    UINT16              str_len;
-    UINT8               *p_str;
+    uint16_t            str_len;
+    uint8_t             *p_str;
 } tAVRC_NAME;
 
 #ifndef AVRC_CAP_MAX_NUM_COMP_ID
@@ -890,32 +890,32 @@
 
 typedef union
 {
-    UINT32  company_id[AVRC_CAP_MAX_NUM_COMP_ID];
-    UINT8   event_id[AVRC_CAP_MAX_NUM_EVT_ID];
+    uint32_t company_id[AVRC_CAP_MAX_NUM_COMP_ID];
+    uint8_t event_id[AVRC_CAP_MAX_NUM_EVT_ID];
 } tAVRC_CAPS_PARAM;
 
 typedef struct
 {
-    UINT8   attr_id;
-    UINT8   attr_val;
+    uint8_t attr_id;
+    uint8_t attr_val;
 } tAVRC_APP_SETTING;
 
 typedef struct
 {
-    UINT8   attr_id;
-    UINT16  charset_id;
-    UINT8   str_len;
-    UINT8   *p_str;
+    uint8_t attr_id;
+    uint16_t charset_id;
+    uint8_t str_len;
+    uint8_t *p_str;
 } tAVRC_APP_SETTING_TEXT;
 
-typedef UINT8 tAVRC_FEATURE_MASK[AVRC_FEATURE_MASK_SIZE];
+typedef uint8_t tAVRC_FEATURE_MASK[AVRC_FEATURE_MASK_SIZE];
 
 typedef struct
 {
-    UINT16              player_id;      /* A unique identifier for this media player.*/
-    UINT8               major_type;     /* Use AVRC_MJ_TYPE_AUDIO, AVRC_MJ_TYPE_VIDEO, AVRC_MJ_TYPE_BC_AUDIO, or AVRC_MJ_TYPE_BC_VIDEO.*/
-    UINT32              sub_type;       /* Use AVRC_SUB_TYPE_NONE, AVRC_SUB_TYPE_AUDIO_BOOK, or AVRC_SUB_TYPE_PODCAST*/
-    UINT8               play_status;    /* Use AVRC_PLAYSTATE_STOPPED, AVRC_PLAYSTATE_PLAYING, AVRC_PLAYSTATE_PAUSED, AVRC_PLAYSTATE_FWD_SEEK,
+    uint16_t            player_id;      /* A unique identifier for this media player.*/
+    uint8_t             major_type;     /* Use AVRC_MJ_TYPE_AUDIO, AVRC_MJ_TYPE_VIDEO, AVRC_MJ_TYPE_BC_AUDIO, or AVRC_MJ_TYPE_BC_VIDEO.*/
+    uint32_t            sub_type;       /* Use AVRC_SUB_TYPE_NONE, AVRC_SUB_TYPE_AUDIO_BOOK, or AVRC_SUB_TYPE_PODCAST*/
+    uint8_t             play_status;    /* Use AVRC_PLAYSTATE_STOPPED, AVRC_PLAYSTATE_PLAYING, AVRC_PLAYSTATE_PAUSED, AVRC_PLAYSTATE_FWD_SEEK,
                                             AVRC_PLAYSTATE_REV_SEEK, or AVRC_PLAYSTATE_ERROR*/
     tAVRC_FEATURE_MASK  features;       /* Supported feature bit mask*/
     tAVRC_FULL_NAME     name;           /* The player name, name length and character set id.*/
@@ -924,16 +924,16 @@
 typedef struct
 {
     tAVRC_UID           uid;            /* The uid of this folder */
-    UINT8               type;           /* Use AVRC_FOLDER_TYPE_MIXED, AVRC_FOLDER_TYPE_TITLES,
+    uint8_t             type;           /* Use AVRC_FOLDER_TYPE_MIXED, AVRC_FOLDER_TYPE_TITLES,
                                            AVRC_FOLDER_TYPE_ALNUMS, AVRC_FOLDER_TYPE_ARTISTS, AVRC_FOLDER_TYPE_GENRES,
                                            AVRC_FOLDER_TYPE_PLAYLISTS, or AVRC_FOLDER_TYPE_YEARS.*/
-    BOOLEAN             playable;       /* TRUE, if the folder can be played. */
+    bool                playable;       /* true, if the folder can be played. */
     tAVRC_FULL_NAME     name;           /* The folder name, name length and character set id. */
 } tAVRC_ITEM_FOLDER;
 
 typedef struct
 {
-    UINT32              attr_id;        /* Use AVRC_MEDIA_ATTR_ID_TITLE, AVRC_MEDIA_ATTR_ID_ARTIST, AVRC_MEDIA_ATTR_ID_ALBUM,
+    uint32_t            attr_id;        /* Use AVRC_MEDIA_ATTR_ID_TITLE, AVRC_MEDIA_ATTR_ID_ARTIST, AVRC_MEDIA_ATTR_ID_ALBUM,
                                            AVRC_MEDIA_ATTR_ID_TRACK_NUM, AVRC_MEDIA_ATTR_ID_NUM_TRACKS,
                                            AVRC_MEDIA_ATTR_ID_GENRE, AVRC_MEDIA_ATTR_ID_PLAYING_TIME */
     tAVRC_FULL_NAME     name;           /* The attribute value, value length and character set id. */
@@ -942,15 +942,15 @@
 typedef struct
 {
     tAVRC_UID           uid;            /* The uid of this media element item */
-    UINT8               type;           /* Use AVRC_MEDIA_TYPE_AUDIO or AVRC_MEDIA_TYPE_VIDEO. */
+    uint8_t             type;           /* Use AVRC_MEDIA_TYPE_AUDIO or AVRC_MEDIA_TYPE_VIDEO. */
     tAVRC_FULL_NAME     name;           /* The media name, name length and character set id. */
-    UINT8               attr_count;     /* The number of attributes in p_attr_list */
+    uint8_t             attr_count;     /* The number of attributes in p_attr_list */
     tAVRC_ATTR_ENTRY*   p_attr_list;    /* Attribute entry list. */
 } tAVRC_ITEM_MEDIA;
 
 typedef struct
 {
-    UINT8                   item_type;  /* AVRC_ITEM_PLAYER, AVRC_ITEM_FOLDER, or AVRC_ITEM_MEDIA */
+    uint8_t                 item_type;  /* AVRC_ITEM_PLAYER, AVRC_ITEM_FOLDER, or AVRC_ITEM_MEDIA */
     union
     {
         tAVRC_ITEM_PLAYER   player;     /* The properties of a media player item.*/
@@ -962,215 +962,215 @@
 /* GetCapability */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       capability_id;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     capability_id;
 } tAVRC_GET_CAPS_CMD;
 
 /* ListPlayerAppValues */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       attr_id;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     attr_id;
 } tAVRC_LIST_APP_VALUES_CMD;
 
 /* GetCurAppValue */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       num_attr;
-    UINT8       attrs[AVRC_MAX_APP_ATTR_SIZE];
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     num_attr;
+    uint8_t     attrs[AVRC_MAX_APP_ATTR_SIZE];
 } tAVRC_GET_CUR_APP_VALUE_CMD;
 
 /* SetAppValue */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       num_val;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     num_val;
     tAVRC_APP_SETTING   *p_vals;
 } tAVRC_SET_APP_VALUE_CMD;
 
 /* GetAppAttrTxt */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       num_attr;
-    UINT8       attrs[AVRC_MAX_APP_ATTR_SIZE];
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     num_attr;
+    uint8_t     attrs[AVRC_MAX_APP_ATTR_SIZE];
 } tAVRC_GET_APP_ATTR_TXT_CMD;
 
 /* GetAppValueTxt */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       attr_id;
-    UINT8       num_val;
-    UINT8       vals[AVRC_MAX_APP_ATTR_SIZE];
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     attr_id;
+    uint8_t     num_val;
+    uint8_t     vals[AVRC_MAX_APP_ATTR_SIZE];
 } tAVRC_GET_APP_VAL_TXT_CMD;
 
 /* InformCharset */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       num_id;
-    UINT16      charsets[AVRC_MAX_CHARSET_SIZE];
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     num_id;
+    uint16_t    charsets[AVRC_MAX_CHARSET_SIZE];
 } tAVRC_INFORM_CHARSET_CMD;
 
 /* InformBatteryStatus */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       battery_status;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     battery_status;
 } tAVRC_BATTERY_STATUS_CMD;
 
 /* GetElemAttrs */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       num_attr;
-    UINT32      attrs[AVRC_MAX_ELEM_ATTR_SIZE];
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     num_attr;
+    uint32_t    attrs[AVRC_MAX_ELEM_ATTR_SIZE];
 } tAVRC_GET_ELEM_ATTRS_CMD;
 
 /* RegNotify */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       event_id;
-    UINT32      param;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     event_id;
+    uint32_t    param;
 } tAVRC_REG_NOTIF_CMD;
 
 /* SetAddrPlayer */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT16      player_id;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint16_t    player_id;
 } tAVRC_SET_ADDR_PLAYER_CMD;
 
 /* SetBrowsedPlayer */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT16      player_id;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint16_t    player_id;
 } tAVRC_SET_BR_PLAYER_CMD;
 
 /* SetAbsVolume */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       volume;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     volume;
 } tAVRC_SET_VOLUME_CMD;
 
 /* GetFolderItems */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       scope;
-    UINT32      start_item;
-    UINT32      end_item;
-    UINT8       attr_count;
-    UINT32      *p_attr_list;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     scope;
+    uint32_t    start_item;
+    uint32_t    end_item;
+    uint8_t     attr_count;
+    uint32_t    *p_attr_list;
 } tAVRC_GET_ITEMS_CMD;
 
 /* ChangePath */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT16      uid_counter;
-    UINT8       direction;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint16_t    uid_counter;
+    uint8_t     direction;
     tAVRC_UID   folder_uid;
 } tAVRC_CHG_PATH_CMD;
 
 /* GetItemAttrs */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       scope;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     scope;
     tAVRC_UID   uid;
-    UINT16      uid_counter;
-    UINT8       attr_count;
-    UINT32      *p_attr_list;
+    uint16_t    uid_counter;
+    uint8_t     attr_count;
+    uint32_t    *p_attr_list;
 } tAVRC_GET_ATTRS_CMD;
 
 /* Search */
 typedef struct
 {
-    UINT8           pdu;
+    uint8_t         pdu;
     tAVRC_STS       status;
-    UINT8           opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t         opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
     tAVRC_FULL_NAME string;
 } tAVRC_SEARCH_CMD;
 
 /* PlayItem */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       scope;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     scope;
     tAVRC_UID   uid;
-    UINT16      uid_counter;
+    uint16_t    uid_counter;
 } tAVRC_PLAY_ITEM_CMD;
 
 /* AddToNowPlaying */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       scope;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     scope;
     tAVRC_UID   uid;
-    UINT16      uid_counter;
+    uint16_t    uid_counter;
 } tAVRC_ADD_TO_PLAY_CMD;
 
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
 } tAVRC_CMD;
 
 /* Continue and Abort */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
-    UINT8       target_pdu;
+    uint8_t     opcode;         /* Op Code (assigned by AVRC_BldCommand according to pdu) */
+    uint8_t     target_pdu;
 } tAVRC_NEXT_CMD;
 
 typedef union
 {
-    UINT8                       pdu;
+    uint8_t                     pdu;
     tAVRC_CMD                   cmd;
     tAVRC_GET_CAPS_CMD          get_caps;               /* GetCapability */
     tAVRC_CMD                   list_app_attr;          /* ListPlayerAppAttr */
@@ -1201,80 +1201,80 @@
 /* GetCapability */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT8       capability_id;
-    UINT8       count;
+    uint8_t     opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint8_t     capability_id;
+    uint8_t     count;
     tAVRC_CAPS_PARAM param;
 } tAVRC_GET_CAPS_RSP;
 
 /* ListPlayerAppAttr */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT8       num_attr;
-    UINT8       attrs[AVRC_MAX_APP_ATTR_SIZE];
+    uint8_t     opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint8_t     num_attr;
+    uint8_t     attrs[AVRC_MAX_APP_ATTR_SIZE];
 } tAVRC_LIST_APP_ATTR_RSP;
 
 /* ListPlayerAppValues */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT8       num_val;
-    UINT8       vals[AVRC_MAX_APP_ATTR_SIZE];
+    uint8_t     opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint8_t     num_val;
+    uint8_t     vals[AVRC_MAX_APP_ATTR_SIZE];
 } tAVRC_LIST_APP_VALUES_RSP;
 
 /* GetCurAppValue */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT8       num_val;
+    uint8_t     opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint8_t     num_val;
     tAVRC_APP_SETTING   *p_vals;
 } tAVRC_GET_CUR_APP_VALUE_RSP;
 
 /* GetAppAttrTxt */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT8       num_attr;
+    uint8_t     opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint8_t     num_attr;
     tAVRC_APP_SETTING_TEXT   *p_attrs;
 } tAVRC_GET_APP_ATTR_TXT_RSP;
 
 /* GetElemAttrs */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT8       num_attr;
+    uint8_t     opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint8_t     num_attr;
     tAVRC_ATTR_ENTRY   *p_attrs;
 } tAVRC_GET_ELEM_ATTRS_RSP;
 
 /* GetPlayStatus */
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT32      song_len;
-    UINT32      song_pos;
-    UINT8       play_status;
+    uint8_t     opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint32_t    song_len;
+    uint32_t    song_pos;
+    uint8_t     play_status;
 } tAVRC_GET_PLAY_STATUS_RSP;
 
 /* notification event parameter for AddressedPlayer change */
 typedef struct
 {
-    UINT16              player_id;
-    UINT16              uid_counter;
+    uint16_t            player_id;
+    uint16_t            uid_counter;
 } tAVRC_ADDR_PLAYER_PARAM;
 
 #ifndef AVRC_MAX_APP_SETTINGS
@@ -1284,106 +1284,106 @@
 /* notification event parameter for Player Application setting change */
 typedef struct
 {
-    UINT8               num_attr;
-    UINT8               attr_id[AVRC_MAX_APP_SETTINGS];
-    UINT8               attr_value[AVRC_MAX_APP_SETTINGS];
+    uint8_t             num_attr;
+    uint8_t             attr_id[AVRC_MAX_APP_SETTINGS];
+    uint8_t             attr_value[AVRC_MAX_APP_SETTINGS];
 } tAVRC_PLAYER_APP_PARAM;
 
 typedef union
 {
     tAVRC_PLAYSTATE         play_status;
     tAVRC_UID               track;
-    UINT32                  play_pos;
+    uint32_t                play_pos;
     tAVRC_BATTERY_STATUS    battery_status;
     tAVRC_SYSTEMSTATE       system_status;
     tAVRC_PLAYER_APP_PARAM  player_setting;
     tAVRC_ADDR_PLAYER_PARAM addr_player;
-    UINT16                  uid_counter;
-    UINT8                   volume;
+    uint16_t                uid_counter;
+    uint8_t                 volume;
 } tAVRC_NOTIF_RSP_PARAM;
 
 /* RegNotify */
 typedef struct
 {
-    UINT8                   pdu;
+    uint8_t                 pdu;
     tAVRC_STS               status;
-    UINT8                   opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT8                   event_id;
+    uint8_t                 opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint8_t                 event_id;
     tAVRC_NOTIF_RSP_PARAM   param;
 } tAVRC_REG_NOTIF_RSP;
 
 /* SetAbsVolume */
 typedef struct
 {
-    UINT8               pdu;
+    uint8_t             pdu;
     tAVRC_STS           status;
-    UINT8               opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT8               volume;
+    uint8_t             opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint8_t             volume;
 } tAVRC_SET_VOLUME_RSP;
 
 /* SetBrowsedPlayer */
 typedef struct
 {
-    UINT8               pdu;
+    uint8_t             pdu;
     tAVRC_STS           status;
-    UINT8               opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT16              uid_counter;
-    UINT32              num_items;
-    UINT16              charset_id;
-    UINT8               folder_depth;
+    uint8_t             opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint16_t            uid_counter;
+    uint32_t            num_items;
+    uint16_t            charset_id;
+    uint8_t             folder_depth;
     tAVRC_NAME          *p_folders;
 } tAVRC_SET_BR_PLAYER_RSP;
 
 /* GetFolderItems */
 typedef struct
 {
-    UINT8               pdu;
+    uint8_t             pdu;
     tAVRC_STS           status;
-    UINT8               opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT16              uid_counter;
-    UINT16              item_count;
+    uint8_t             opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint16_t            uid_counter;
+    uint16_t            item_count;
     tAVRC_ITEM          *p_item_list;
 } tAVRC_GET_ITEMS_RSP;
 
 /* ChangePath */
 typedef struct
 {
-    UINT8               pdu;
+    uint8_t             pdu;
     tAVRC_STS           status;
-    UINT8               opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT32              num_items;
+    uint8_t             opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint32_t            num_items;
 } tAVRC_CHG_PATH_RSP;
 
 /* GetItemAttrs */
 typedef struct
 {
-    UINT8               pdu;
+    uint8_t             pdu;
     tAVRC_STS           status;
-    UINT8               opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT8               attr_count;
+    uint8_t             opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint8_t             attr_count;
     tAVRC_ATTR_ENTRY    *p_attr_list;
 } tAVRC_GET_ATTRS_RSP;
 
 /* Search */
 typedef struct
 {
-    UINT8               pdu;
+    uint8_t             pdu;
     tAVRC_STS           status;
-    UINT8               opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
-    UINT16              uid_counter;
-    UINT32              num_items;
+    uint8_t             opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint16_t            uid_counter;
+    uint32_t            num_items;
 } tAVRC_SEARCH_RSP;
 
 typedef struct
 {
-    UINT8       pdu;
+    uint8_t     pdu;
     tAVRC_STS   status;
-    UINT8       opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
+    uint8_t     opcode;         /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
 } tAVRC_RSP;
 
 typedef union
 {
-    UINT8                           pdu;
+    uint8_t                         pdu;
     tAVRC_RSP                       rsp;
     tAVRC_GET_CAPS_RSP              get_caps;               /* GetCapability */
     tAVRC_LIST_APP_ATTR_RSP         list_app_attr;          /* ListPlayerAppAttr */
diff --git a/stack/include/bnep_api.h b/stack/include/bnep_api.h
index 0e8a4c9..41e4906 100644
--- a/stack/include/bnep_api.h
+++ b/stack/include/bnep_api.h
@@ -71,7 +71,7 @@
     BNEP_TX_FLOW_ON,                    /* tx data flow enabled */
     BNEP_TX_FLOW_OFF                    /* tx data flow disabled */
 
-}; typedef UINT8 tBNEP_RESULT;
+}; typedef uint8_t tBNEP_RESULT;
 
 
 /***************************
@@ -86,10 +86,10 @@
 **                  All values are used to indicate the reason for failure
 **              Flag to indicate if it is just a role change
 */
-typedef void (tBNEP_CONN_STATE_CB) (UINT16 handle,
+typedef void (tBNEP_CONN_STATE_CB) (uint16_t handle,
                                     BD_ADDR rem_bda,
                                     tBNEP_RESULT result,
-                                    BOOLEAN is_role_change);
+                                    bool    is_role_change);
 
 
 
@@ -100,11 +100,11 @@
 **              When BNEP calls this function profile should
 **              use BNEP_ConnectResp call to accept or reject the request
 */
-typedef void (tBNEP_CONNECT_IND_CB) (UINT16 handle,
+typedef void (tBNEP_CONNECT_IND_CB) (uint16_t handle,
                                      BD_ADDR bd_addr,
                                      tBT_UUID *remote_uuid,
                                      tBT_UUID *local_uuid,
-                                     BOOLEAN is_role_change);
+                                     bool    is_role_change);
 
 
 
@@ -116,12 +116,12 @@
 **              Pointer to the buffer
 **              Flag to indicate whether extension headers to be forwarded are present
 */
-typedef void (tBNEP_DATA_BUF_CB) (UINT16 handle,
-                                  UINT8 *src,
-                                  UINT8 *dst,
-                                  UINT16 protocol,
+typedef void (tBNEP_DATA_BUF_CB) (uint16_t handle,
+                                  uint8_t *src,
+                                  uint8_t *dst,
+                                  uint16_t protocol,
                                   BT_HDR *p_buf,
-                                  BOOLEAN fw_ext_present);
+                                  bool    fw_ext_present);
 
 
 /* Data received indication callback prototype. Parameters are
@@ -133,24 +133,24 @@
 **              Length of data
 **              Flag to indicate whether extension headers to be forwarded are present
 */
-typedef void (tBNEP_DATA_IND_CB) (UINT16 handle,
-                                  UINT8 *src,
-                                  UINT8 *dst,
-                                  UINT16 protocol,
-                                  UINT8 *p_data,
-                                  UINT16 len,
-                                  BOOLEAN fw_ext_present);
+typedef void (tBNEP_DATA_IND_CB) (uint16_t handle,
+                                  uint8_t *src,
+                                  uint8_t *dst,
+                                  uint16_t protocol,
+                                  uint8_t *p_data,
+                                  uint16_t len,
+                                  bool    fw_ext_present);
 
 /* Flow control callback for TX data. Parameters are
 **              Handle to the connection
 **              Event  flow status
 */
-typedef void (tBNEP_TX_DATA_FLOW_CB) (UINT16 handle,
+typedef void (tBNEP_TX_DATA_FLOW_CB) (uint16_t handle,
                                       tBNEP_RESULT  event);
 
 /* Filters received indication callback prototype. Parameters are
 **              Handle to the connection
-**              TRUE if the cb is called for indication
+**              true if the cb is called for indication
 **              Ignore this if it is indication, otherwise it is the result
 **                      for the filter set operation performed by the local
 **                      device
@@ -161,17 +161,17 @@
 **                      two bytes will be starting of the first range and
 **                      next two bytes will be ending of the range.
 */
-typedef void (tBNEP_FILTER_IND_CB) (UINT16 handle,
-                                    BOOLEAN indication,
+typedef void (tBNEP_FILTER_IND_CB) (uint16_t handle,
+                                    bool    indication,
                                     tBNEP_RESULT result,
-                                    UINT16 num_filters,
-                                    UINT8 *p_filters);
+                                    uint16_t num_filters,
+                                    uint8_t *p_filters);
 
 
 
 /* Multicast Filters received indication callback prototype. Parameters are
 **              Handle to the connection
-**              TRUE if the cb is called for indication
+**              true if the cb is called for indication
 **              Ignore this if it is indication, otherwise it is the result
 **                      for the filter set operation performed by the local
 **                      device
@@ -181,11 +181,11 @@
 **                      First six bytes will be starting of the first range and
 **                      next six bytes will be ending of the range.
 */
-typedef void (tBNEP_MFILTER_IND_CB) (UINT16 handle,
-                                     BOOLEAN indication,
+typedef void (tBNEP_MFILTER_IND_CB) (uint16_t handle,
+                                     bool    indication,
                                      tBNEP_RESULT result,
-                                     UINT16 num_mfilters,
-                                     UINT8 *p_mfilters);
+                                     uint16_t num_mfilters,
+                                     uint8_t *p_mfilters);
 
 /* This is the structure used by profile to register with BNEP */
 typedef struct
@@ -207,17 +207,17 @@
 {
 #define BNEP_STATUS_FAILE            0
 #define BNEP_STATUS_CONNECTED        1
-    UINT8             con_status;
+    uint8_t           con_status;
 
-    UINT16            l2cap_cid;
+    uint16_t          l2cap_cid;
     BD_ADDR           rem_bda;
-    UINT16            rem_mtu_size;
-    UINT16            xmit_q_depth;
+    uint16_t          rem_mtu_size;
+    uint16_t          xmit_q_depth;
 
-    UINT16            sent_num_filters;
-    UINT16            sent_mcast_filters;
-    UINT16            rcvd_num_filters;
-    UINT16            rcvd_mcast_filters;
+    uint16_t          sent_num_filters;
+    uint16_t          sent_mcast_filters;
+    uint16_t          rcvd_num_filters;
+    uint16_t          rcvd_mcast_filters;
     tBT_UUID          src_uuid;
     tBT_UUID          dst_uuid;
 
@@ -279,7 +279,7 @@
 extern tBNEP_RESULT BNEP_Connect (BD_ADDR p_rem_bda,
                                   tBT_UUID *src_uuid,
                                   tBT_UUID *dst_uuid,
-                                  UINT16 *p_handle);
+                                  uint16_t *p_handle);
 
 /*******************************************************************************
 **
@@ -296,7 +296,7 @@
 **                  BNEP_WRONG_STATE            if the responce is not expected
 **
 *******************************************************************************/
-extern tBNEP_RESULT BNEP_ConnectResp (UINT16 handle, tBNEP_RESULT resp);
+extern tBNEP_RESULT BNEP_ConnectResp (uint16_t handle, tBNEP_RESULT resp);
 
 /*******************************************************************************
 **
@@ -310,7 +310,7 @@
 **                  BNEP_WRONG_HANDLE           if no connection is not found
 **
 *******************************************************************************/
-extern tBNEP_RESULT BNEP_Disconnect (UINT16 handle);
+extern tBNEP_RESULT BNEP_Disconnect (uint16_t handle);
 
 /*******************************************************************************
 **
@@ -333,12 +333,12 @@
 **                  BNEP_SUCCESS            - If written successfully
 **
 *******************************************************************************/
-extern tBNEP_RESULT BNEP_WriteBuf (UINT16 handle,
-                                   UINT8 *p_dest_addr,
+extern tBNEP_RESULT BNEP_WriteBuf (uint16_t handle,
+                                   uint8_t *p_dest_addr,
                                    BT_HDR *p_buf,
-                                   UINT16 protocol,
-                                   UINT8 *p_src_addr,
-                                   BOOLEAN fw_ext_present);
+                                   uint16_t protocol,
+                                   uint8_t *p_src_addr,
+                                   bool    fw_ext_present);
 
 /*******************************************************************************
 **
@@ -362,13 +362,13 @@
 **                  BNEP_SUCCESS            - If written successfully
 **
 *******************************************************************************/
-extern tBNEP_RESULT  BNEP_Write (UINT16 handle,
-                                 UINT8 *p_dest_addr,
-                                 UINT8 *p_data,
-                                 UINT16 len,
-                                 UINT16 protocol,
-                                 UINT8 *p_src_addr,
-                                 BOOLEAN fw_ext_present);
+extern tBNEP_RESULT  BNEP_Write (uint16_t handle,
+                                 uint8_t *p_dest_addr,
+                                 uint8_t *p_data,
+                                 uint16_t len,
+                                 uint16_t protocol,
+                                 uint8_t *p_src_addr,
+                                 bool    fw_ext_present);
 
 /*******************************************************************************
 **
@@ -387,10 +387,10 @@
 **                  BNEP_SUCCESS                - if request sent successfully
 **
 *******************************************************************************/
-extern tBNEP_RESULT BNEP_SetProtocolFilters (UINT16 handle,
-                                             UINT16 num_filters,
-                                             UINT16 *p_start_array,
-                                             UINT16 *p_end_array);
+extern tBNEP_RESULT BNEP_SetProtocolFilters (uint16_t handle,
+                                             uint16_t num_filters,
+                                             uint16_t *p_start_array,
+                                             uint16_t *p_end_array);
 
 /*******************************************************************************
 **
@@ -411,10 +411,10 @@
 **                  BNEP_SUCCESS                - if request sent successfully
 **
 *******************************************************************************/
-extern tBNEP_RESULT BNEP_SetMulticastFilters (UINT16 handle,
-                                              UINT16 num_filters,
-                                              UINT8 *p_start_array,
-                                              UINT8 *p_end_array);
+extern tBNEP_RESULT BNEP_SetMulticastFilters (uint16_t handle,
+                                              uint16_t num_filters,
+                                              uint8_t *p_start_array,
+                                              uint8_t *p_end_array);
 
 /*******************************************************************************
 **
@@ -426,7 +426,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-extern UINT8 BNEP_SetTraceLevel (UINT8 new_level);
+extern uint8_t BNEP_SetTraceLevel (uint8_t new_level);
 
 /*******************************************************************************
 **
@@ -452,7 +452,7 @@
 **                  BNEP_WRONG_STATE        - if not in connected state
 **
 *******************************************************************************/
-extern tBNEP_RESULT BNEP_GetStatus (UINT16 handle, tBNEP_STATUS *p_status);
+extern tBNEP_RESULT BNEP_GetStatus (uint16_t handle, tBNEP_STATUS *p_status);
 
 
 
diff --git a/stack/include/bt_types.h b/stack/include/bt_types.h
index 99af3a0..8a93a27 100644
--- a/stack/include/bt_types.h
+++ b/stack/include/bt_types.h
@@ -23,23 +23,13 @@
 #include <stdbool.h>
 
 #ifndef FALSE
-#  define FALSE  false
+#  define FALSE false
 #endif
 
 #ifndef TRUE
-#  define TRUE   true
+#  define TRUE true
 #endif
 
-typedef uint8_t UINT8;
-typedef uint16_t UINT16;
-typedef uint32_t UINT32;
-typedef uint64_t UINT64;
-
-typedef int8_t INT8;
-typedef int16_t INT16;
-typedef int32_t INT32;
-typedef bool BOOLEAN;
-
 #ifdef __arm
 #  define PACKED  __packed
 #  define INLINE  __inline
@@ -221,45 +211,45 @@
 
 /* These macros extract the HCI opcodes from a buffer
 */
-#define HCI_GET_CMD_HDR_OPCODE(p)    (UINT16)((*((UINT8 *)((p) + 1) + (p)->offset) + \
-                                              (*((UINT8 *)((p) + 1) + (p)->offset + 1) << 8)))
-#define HCI_GET_CMD_HDR_PARAM_LEN(p) (UINT8)  (*((UINT8 *)((p) + 1) + (p)->offset + 2))
+#define HCI_GET_CMD_HDR_OPCODE(p)    (uint16_t)((*((uint8_t *)((p) + 1) + (p)->offset) + \
+                                              (*((uint8_t *)((p) + 1) + (p)->offset + 1) << 8)))
+#define HCI_GET_CMD_HDR_PARAM_LEN(p) (uint8_t)  (*((uint8_t *)((p) + 1) + (p)->offset + 2))
 
-#define HCI_GET_EVT_HDR_OPCODE(p)    (UINT8)(*((UINT8 *)((p) + 1) + (p)->offset))
-#define HCI_GET_EVT_HDR_PARAM_LEN(p) (UINT8)  (*((UINT8 *)((p) + 1) + (p)->offset + 1))
+#define HCI_GET_EVT_HDR_OPCODE(p)    (uint8_t)(*((uint8_t *)((p) + 1) + (p)->offset))
+#define HCI_GET_EVT_HDR_PARAM_LEN(p) (uint8_t)  (*((uint8_t *)((p) + 1) + (p)->offset + 1))
 
 
 /********************************************************************************
 ** Macros to get and put bytes to and from a stream (Little Endian format).
 */
-#define UINT64_TO_BE_STREAM(p, u64) {*(p)++ = (UINT8)((u64) >> 56);  *(p)++ = (UINT8)((u64) >> 48); *(p)++ = (UINT8)((u64) >> 40); *(p)++ = (UINT8)((u64) >> 32); \
-                                     *(p)++ = (UINT8)((u64) >> 24);  *(p)++ = (UINT8)((u64) >> 16); *(p)++ = (UINT8)((u64) >> 8); *(p)++ = (UINT8)(u64); }
-#define UINT32_TO_STREAM(p, u32) {*(p)++ = (UINT8)(u32); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 24);}
-#define UINT24_TO_STREAM(p, u24) {*(p)++ = (UINT8)(u24); *(p)++ = (UINT8)((u24) >> 8); *(p)++ = (UINT8)((u24) >> 16);}
-#define UINT16_TO_STREAM(p, u16) {*(p)++ = (UINT8)(u16); *(p)++ = (UINT8)((u16) >> 8);}
-#define UINT8_TO_STREAM(p, u8)   {*(p)++ = (UINT8)(u8);}
-#define INT8_TO_STREAM(p, u8)    {*(p)++ = (INT8)(u8);}
-#define ARRAY32_TO_STREAM(p, a)  {int ijk; for (ijk = 0; ijk < 32;           ijk++) *(p)++ = (UINT8) (a)[31 - ijk];}
-#define ARRAY16_TO_STREAM(p, a)  {int ijk; for (ijk = 0; ijk < 16;           ijk++) *(p)++ = (UINT8) (a)[15 - ijk];}
-#define ARRAY8_TO_STREAM(p, a)   {int ijk; for (ijk = 0; ijk < 8;            ijk++) *(p)++ = (UINT8) (a)[7 - ijk];}
-#define BDADDR_TO_STREAM(p, a)   {int ijk; for (ijk = 0; ijk < BD_ADDR_LEN;  ijk++) *(p)++ = (UINT8) (a)[BD_ADDR_LEN - 1 - ijk];}
-#define LAP_TO_STREAM(p, a)      {int ijk; for (ijk = 0; ijk < LAP_LEN;      ijk++) *(p)++ = (UINT8) (a)[LAP_LEN - 1 - ijk];}
-#define DEVCLASS_TO_STREAM(p, a) {int ijk; for (ijk = 0; ijk < DEV_CLASS_LEN;ijk++) *(p)++ = (UINT8) (a)[DEV_CLASS_LEN - 1 - ijk];}
-#define ARRAY_TO_STREAM(p, a, len) {int ijk; for (ijk = 0; ijk < (len);        ijk++) *(p)++ = (UINT8) (a)[ijk];}
-#define REVERSE_ARRAY_TO_STREAM(p, a, len)  {int ijk; for (ijk = 0; ijk < (len); ijk++) *(p)++ = (UINT8) (a)[(len) - 1 - ijk];}
+#define UINT64_TO_BE_STREAM(p, u64) {*(p)++ = (uint8_t)((u64) >> 56);  *(p)++ = (uint8_t)((u64) >> 48); *(p)++ = (uint8_t)((u64) >> 40); *(p)++ = (uint8_t)((u64) >> 32); \
+                                     *(p)++ = (uint8_t)((u64) >> 24);  *(p)++ = (uint8_t)((u64) >> 16); *(p)++ = (uint8_t)((u64) >> 8); *(p)++ = (uint8_t)(u64); }
+#define UINT32_TO_STREAM(p, u32) {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8); *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);}
+#define UINT24_TO_STREAM(p, u24) {*(p)++ = (uint8_t)(u24); *(p)++ = (uint8_t)((u24) >> 8); *(p)++ = (uint8_t)((u24) >> 16);}
+#define UINT16_TO_STREAM(p, u16) {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);}
+#define UINT8_TO_STREAM(p, u8)   {*(p)++ = (uint8_t)(u8);}
+#define INT8_TO_STREAM(p, u8)    {*(p)++ = (int8_t)(u8);}
+#define ARRAY32_TO_STREAM(p, a)  {int ijk; for (ijk = 0; ijk < 32;           ijk++) *(p)++ = (uint8_t) (a)[31 - ijk];}
+#define ARRAY16_TO_STREAM(p, a)  {int ijk; for (ijk = 0; ijk < 16;           ijk++) *(p)++ = (uint8_t) (a)[15 - ijk];}
+#define ARRAY8_TO_STREAM(p, a)   {int ijk; for (ijk = 0; ijk < 8;            ijk++) *(p)++ = (uint8_t) (a)[7 - ijk];}
+#define BDADDR_TO_STREAM(p, a)   {int ijk; for (ijk = 0; ijk < BD_ADDR_LEN;  ijk++) *(p)++ = (uint8_t) (a)[BD_ADDR_LEN - 1 - ijk];}
+#define LAP_TO_STREAM(p, a)      {int ijk; for (ijk = 0; ijk < LAP_LEN;      ijk++) *(p)++ = (uint8_t) (a)[LAP_LEN - 1 - ijk];}
+#define DEVCLASS_TO_STREAM(p, a) {int ijk; for (ijk = 0; ijk < DEV_CLASS_LEN;ijk++) *(p)++ = (uint8_t) (a)[DEV_CLASS_LEN - 1 - ijk];}
+#define ARRAY_TO_STREAM(p, a, len) {int ijk; for (ijk = 0; ijk < (len);        ijk++) *(p)++ = (uint8_t) (a)[ijk];}
+#define REVERSE_ARRAY_TO_STREAM(p, a, len)  {int ijk; for (ijk = 0; ijk < (len); ijk++) *(p)++ = (uint8_t) (a)[(len) - 1 - ijk];}
 
-#define STREAM_TO_UINT8(u8, p)   {(u8) = (UINT8)(*(p)); (p) += 1;}
-#define STREAM_TO_UINT16(u16, p) {(u16) = ((UINT16)(*(p)) + (((UINT16)(*((p) + 1))) << 8)); (p) += 2;}
-#define STREAM_TO_UINT24(u32, p) {(u32) = (((UINT32)(*(p))) + ((((UINT32)(*((p) + 1)))) << 8) + ((((UINT32)(*((p) + 2)))) << 16) ); (p) += 3;}
-#define STREAM_TO_UINT32(u32, p) {(u32) = (((UINT32)(*(p))) + ((((UINT32)(*((p) + 1)))) << 8) + ((((UINT32)(*((p) + 2)))) << 16) + ((((UINT32)(*((p) + 3)))) << 24)); (p) += 4;}
-#define STREAM_TO_BDADDR(a, p)   {int ijk; UINT8 *pbda = (UINT8 *)(a) + BD_ADDR_LEN - 1; for (ijk = 0; ijk < BD_ADDR_LEN; ijk++) *pbda-- = *(p)++;}
-#define STREAM_TO_ARRAY32(a, p)  {int ijk; UINT8 *_pa = (UINT8 *)(a) + 31; for (ijk = 0; ijk < 32; ijk++) *_pa-- = *(p)++;}
-#define STREAM_TO_ARRAY16(a, p)  {int ijk; UINT8 *_pa = (UINT8 *)(a) + 15; for (ijk = 0; ijk < 16; ijk++) *_pa-- = *(p)++;}
-#define STREAM_TO_ARRAY8(a, p)   {int ijk; UINT8 *_pa = (UINT8 *)(a) + 7; for (ijk = 0; ijk < 8; ijk++) *_pa-- = *(p)++;}
-#define STREAM_TO_DEVCLASS(a, p) {int ijk; UINT8 *_pa = (UINT8 *)(a) + DEV_CLASS_LEN - 1; for (ijk = 0; ijk < DEV_CLASS_LEN; ijk++) *_pa-- = *(p)++;}
-#define STREAM_TO_LAP(a, p)      {int ijk; UINT8 *plap = (UINT8 *)(a) + LAP_LEN - 1; for (ijk = 0; ijk < LAP_LEN; ijk++) *plap-- = *(p)++;}
-#define STREAM_TO_ARRAY(a, p, len) {int ijk; for (ijk = 0; ijk < (len); ijk++) ((UINT8 *) (a))[ijk] = *(p)++;}
-#define REVERSE_STREAM_TO_ARRAY(a, p, len) {int ijk; UINT8 *_pa = (UINT8 *)(a) + (len) - 1; for (ijk = 0; ijk < (len); ijk++) *_pa-- = *(p)++;}
+#define STREAM_TO_UINT8(u8, p)   {(u8) = (uint8_t)(*(p)); (p) += 1;}
+#define STREAM_TO_UINT16(u16, p) {(u16) = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;}
+#define STREAM_TO_UINT24(u32, p) {(u32) = (((uint32_t)(*(p))) + ((((uint32_t)(*((p) + 1)))) << 8) + ((((uint32_t)(*((p) + 2)))) << 16) ); (p) += 3;}
+#define STREAM_TO_UINT32(u32, p) {(u32) = (((uint32_t)(*(p))) + ((((uint32_t)(*((p) + 1)))) << 8) + ((((uint32_t)(*((p) + 2)))) << 16) + ((((uint32_t)(*((p) + 3)))) << 24)); (p) += 4;}
+#define STREAM_TO_BDADDR(a, p)   {int ijk; uint8_t *pbda = (uint8_t *)(a) + BD_ADDR_LEN - 1; for (ijk = 0; ijk < BD_ADDR_LEN; ijk++) *pbda-- = *(p)++;}
+#define STREAM_TO_ARRAY32(a, p)  {int ijk; uint8_t *_pa = (uint8_t *)(a) + 31; for (ijk = 0; ijk < 32; ijk++) *_pa-- = *(p)++;}
+#define STREAM_TO_ARRAY16(a, p)  {int ijk; uint8_t *_pa = (uint8_t *)(a) + 15; for (ijk = 0; ijk < 16; ijk++) *_pa-- = *(p)++;}
+#define STREAM_TO_ARRAY8(a, p)   {int ijk; uint8_t *_pa = (uint8_t *)(a) + 7; for (ijk = 0; ijk < 8; ijk++) *_pa-- = *(p)++;}
+#define STREAM_TO_DEVCLASS(a, p) {int ijk; uint8_t *_pa = (uint8_t *)(a) + DEV_CLASS_LEN - 1; for (ijk = 0; ijk < DEV_CLASS_LEN; ijk++) *_pa-- = *(p)++;}
+#define STREAM_TO_LAP(a, p)      {int ijk; uint8_t *plap = (uint8_t *)(a) + LAP_LEN - 1; for (ijk = 0; ijk < LAP_LEN; ijk++) *plap-- = *(p)++;}
+#define STREAM_TO_ARRAY(a, p, len) {int ijk; for (ijk = 0; ijk < (len); ijk++) ((uint8_t *) (a))[ijk] = *(p)++;}
+#define REVERSE_STREAM_TO_ARRAY(a, p, len) {int ijk; uint8_t *_pa = (uint8_t *)(a) + (len) - 1; for (ijk = 0; ijk < (len); ijk++) *_pa-- = *(p)++;}
 
 #define STREAM_SKIP_UINT8(p)  do { (p) += 1; } while (0)
 #define STREAM_SKIP_UINT16(p) do { (p) += 2; } while (0)
@@ -268,112 +258,112 @@
 ** Macros to get and put bytes to and from a field (Little Endian format).
 ** These are the same as to stream, except the pointer is not incremented.
 */
-#define UINT32_TO_FIELD(p, u32) {*(UINT8 *)(p) = (UINT8)(u32); *((UINT8 *)(p)+1) = (UINT8)((u32) >> 8); *((UINT8 *)(p)+2) = (UINT8)((u32) >> 16); *((UINT8 *)(p)+3) = (UINT8)((u32) >> 24);}
-#define UINT24_TO_FIELD(p, u24) {*(UINT8 *)(p) = (UINT8)(u24); *((UINT8 *)(p)+1) = (UINT8)((u24) >> 8); *((UINT8 *)(p)+2) = (UINT8)((u24) >> 16);}
-#define UINT16_TO_FIELD(p, u16) {*(UINT8 *)(p) = (UINT8)(u16); *((UINT8 *)(p)+1) = (UINT8)((u16) >> 8);}
-#define UINT8_TO_FIELD(p, u8)   {*(UINT8 *)(p) = (UINT8)(u8);}
+#define UINT32_TO_FIELD(p, u32) {*(uint8_t *)(p) = (uint8_t)(u32); *((uint8_t *)(p)+1) = (uint8_t)((u32) >> 8); *((uint8_t *)(p)+2) = (uint8_t)((u32) >> 16); *((uint8_t *)(p)+3) = (uint8_t)((u32) >> 24);}
+#define UINT24_TO_FIELD(p, u24) {*(uint8_t *)(p) = (uint8_t)(u24); *((uint8_t *)(p)+1) = (uint8_t)((u24) >> 8); *((uint8_t *)(p)+2) = (uint8_t)((u24) >> 16);}
+#define UINT16_TO_FIELD(p, u16) {*(uint8_t *)(p) = (uint8_t)(u16); *((uint8_t *)(p)+1) = (uint8_t)((u16) >> 8);}
+#define UINT8_TO_FIELD(p, u8)   {*(uint8_t *)(p) = (uint8_t)(u8);}
 
 
 /********************************************************************************
 ** Macros to get and put bytes to and from a stream (Big Endian format)
 */
-#define UINT32_TO_BE_STREAM(p, u32) {*(p)++ = (UINT8)((u32) >> 24);  *(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)(u32); }
-#define UINT24_TO_BE_STREAM(p, u24) {*(p)++ = (UINT8)((u24) >> 16); *(p)++ = (UINT8)((u24) >> 8); *(p)++ = (UINT8)(u24);}
-#define UINT16_TO_BE_STREAM(p, u16) {*(p)++ = (UINT8)((u16) >> 8); *(p)++ = (UINT8)(u16);}
-#define UINT8_TO_BE_STREAM(p, u8)   {*(p)++ = (UINT8)(u8);}
-#define ARRAY_TO_BE_STREAM(p, a, len) {int ijk; for (ijk = 0; ijk < (len); ijk++) *(p)++ = (UINT8) (a)[ijk];}
-#define ARRAY_TO_BE_STREAM_REVERSE(p, a, len) {int ijk; for (ijk = 0; ijk < (len); ijk++) *(p)++ = (UINT8) (a)[(len) - ijk - 1];}
+#define UINT32_TO_BE_STREAM(p, u32) {*(p)++ = (uint8_t)((u32) >> 24);  *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 8); *(p)++ = (uint8_t)(u32); }
+#define UINT24_TO_BE_STREAM(p, u24) {*(p)++ = (uint8_t)((u24) >> 16); *(p)++ = (uint8_t)((u24) >> 8); *(p)++ = (uint8_t)(u24);}
+#define UINT16_TO_BE_STREAM(p, u16) {*(p)++ = (uint8_t)((u16) >> 8); *(p)++ = (uint8_t)(u16);}
+#define UINT8_TO_BE_STREAM(p, u8)   {*(p)++ = (uint8_t)(u8);}
+#define ARRAY_TO_BE_STREAM(p, a, len) {int ijk; for (ijk = 0; ijk < (len); ijk++) *(p)++ = (uint8_t) (a)[ijk];}
+#define ARRAY_TO_BE_STREAM_REVERSE(p, a, len) {int ijk; for (ijk = 0; ijk < (len); ijk++) *(p)++ = (uint8_t) (a)[(len) - ijk - 1];}
 
-#define BE_STREAM_TO_UINT8(u8, p)   {(u8) = (UINT8)(*(p)); (p) += 1;}
-#define BE_STREAM_TO_UINT16(u16, p) {(u16) = (UINT16)(((UINT16)(*(p)) << 8) + (UINT16)(*((p) + 1))); (p) += 2;}
-#define BE_STREAM_TO_UINT24(u32, p) {(u32) = (((UINT32)(*((p) + 2))) + ((UINT32)(*((p) + 1)) << 8) + ((UINT32)(*(p)) << 16)); (p) += 3;}
-#define BE_STREAM_TO_UINT32(u32, p) {(u32) = ((UINT32)(*((p) + 3)) + ((UINT32)(*((p) + 2)) << 8) + ((UINT32)(*((p) + 1)) << 16) + ((UINT32)(*(p)) << 24)); (p) += 4;}
-#define BE_STREAM_TO_UINT64(u64, p) {(u64) = ((UINT64)(*((p) + 7)) + ((UINT64)(*((p) + 6)) << 8) + \
-                                    ((UINT64)(*((p) + 5)) << 16) + ((UINT64)(*((p) + 4)) << 24) + \
-                                    ((UINT64)(*((p) + 3)) << 32) + ((UINT64)(*((p) + 2)) << 40) + \
-                                    ((UINT64)(*((p) + 1)) << 48) + ((UINT64)(*(p)) << 56)); \
+#define BE_STREAM_TO_UINT8(u8, p)   {(u8) = (uint8_t)(*(p)); (p) += 1;}
+#define BE_STREAM_TO_UINT16(u16, p) {(u16) = (uint16_t)(((uint16_t)(*(p)) << 8) + (uint16_t)(*((p) + 1))); (p) += 2;}
+#define BE_STREAM_TO_UINT24(u32, p) {(u32) = (((uint32_t)(*((p) + 2))) + ((uint32_t)(*((p) + 1)) << 8) + ((uint32_t)(*(p)) << 16)); (p) += 3;}
+#define BE_STREAM_TO_UINT32(u32, p) {(u32) = ((uint32_t)(*((p) + 3)) + ((uint32_t)(*((p) + 2)) << 8) + ((uint32_t)(*((p) + 1)) << 16) + ((uint32_t)(*(p)) << 24)); (p) += 4;}
+#define BE_STREAM_TO_UINT64(u64, p) {(u64) = ((uint64_t)(*((p) + 7)) + ((uint64_t)(*((p) + 6)) << 8) + \
+                                    ((uint64_t)(*((p) + 5)) << 16) + ((uint64_t)(*((p) + 4)) << 24) + \
+                                    ((uint64_t)(*((p) + 3)) << 32) + ((uint64_t)(*((p) + 2)) << 40) + \
+                                    ((uint64_t)(*((p) + 1)) << 48) + ((uint64_t)(*(p)) << 56)); \
                                     (p) += 8;}
-#define BE_STREAM_TO_ARRAY(p, a, len) {int ijk; for (ijk = 0; ijk < (len); ijk++) ((UINT8 *) (a))[ijk] = *(p)++;}
+#define BE_STREAM_TO_ARRAY(p, a, len) {int ijk; for (ijk = 0; ijk < (len); ijk++) ((uint8_t *) (a))[ijk] = *(p)++;}
 
 
 /********************************************************************************
 ** Macros to get and put bytes to and from a field (Big Endian format).
 ** These are the same as to stream, except the pointer is not incremented.
 */
-#define UINT32_TO_BE_FIELD(p, u32) {*(UINT8 *)(p) = (UINT8)((u32) >> 24);  *((UINT8 *)(p)+1) = (UINT8)((u32) >> 16); *((UINT8 *)(p)+2) = (UINT8)((u32) >> 8); *((UINT8 *)(p)+3) = (UINT8)(u32); }
-#define UINT24_TO_BE_FIELD(p, u24) {*(UINT8 *)(p) = (UINT8)((u24) >> 16); *((UINT8 *)(p)+1) = (UINT8)((u24) >> 8); *((UINT8 *)(p)+2) = (UINT8)(u24);}
-#define UINT16_TO_BE_FIELD(p, u16) {*(UINT8 *)(p) = (UINT8)((u16) >> 8); *((UINT8 *)(p)+1) = (UINT8)(u16);}
-#define UINT8_TO_BE_FIELD(p, u8)   {*(UINT8 *)(p) = (UINT8)(u8);}
+#define UINT32_TO_BE_FIELD(p, u32) {*(uint8_t *)(p) = (uint8_t)((u32) >> 24);  *((uint8_t *)(p)+1) = (uint8_t)((u32) >> 16); *((uint8_t *)(p)+2) = (uint8_t)((u32) >> 8); *((uint8_t *)(p)+3) = (uint8_t)(u32); }
+#define UINT24_TO_BE_FIELD(p, u24) {*(uint8_t *)(p) = (uint8_t)((u24) >> 16); *((uint8_t *)(p)+1) = (uint8_t)((u24) >> 8); *((uint8_t *)(p)+2) = (uint8_t)(u24);}
+#define UINT16_TO_BE_FIELD(p, u16) {*(uint8_t *)(p) = (uint8_t)((u16) >> 8); *((uint8_t *)(p)+1) = (uint8_t)(u16);}
+#define UINT8_TO_BE_FIELD(p, u8)   {*(uint8_t *)(p) = (uint8_t)(u8);}
 
 
 /* Common Bluetooth field definitions */
 #define BD_ADDR_LEN     6                   /* Device address length */
-typedef UINT8 BD_ADDR[BD_ADDR_LEN];         /* Device address */
-typedef UINT8 *BD_ADDR_PTR;                 /* Pointer to Device Address */
+typedef uint8_t BD_ADDR[BD_ADDR_LEN];         /* Device address */
+typedef uint8_t *BD_ADDR_PTR;                 /* Pointer to Device Address */
 
 #define AMP_KEY_TYPE_GAMP       0
 #define AMP_KEY_TYPE_WIFI       1
 #define AMP_KEY_TYPE_UWB        2
-typedef UINT8 tAMP_KEY_TYPE;
+typedef uint8_t tAMP_KEY_TYPE;
 
 #define BT_OCTET8_LEN    8
-typedef UINT8 BT_OCTET8[BT_OCTET8_LEN];   /* octet array: size 16 */
+typedef uint8_t BT_OCTET8[BT_OCTET8_LEN];   /* octet array: size 16 */
 
 #define LINK_KEY_LEN    16
-typedef UINT8 LINK_KEY[LINK_KEY_LEN];       /* Link Key */
+typedef uint8_t LINK_KEY[LINK_KEY_LEN];       /* Link Key */
 
 #define AMP_LINK_KEY_LEN        32
-typedef UINT8 AMP_LINK_KEY[AMP_LINK_KEY_LEN];   /* Dedicated AMP and GAMP Link Keys */
+typedef uint8_t AMP_LINK_KEY[AMP_LINK_KEY_LEN];   /* Dedicated AMP and GAMP Link Keys */
 
 #define BT_OCTET16_LEN    16
-typedef UINT8 BT_OCTET16[BT_OCTET16_LEN];   /* octet array: size 16 */
+typedef uint8_t BT_OCTET16[BT_OCTET16_LEN];   /* octet array: size 16 */
 
 #define PIN_CODE_LEN    16
-typedef UINT8 PIN_CODE[PIN_CODE_LEN];       /* Pin Code (upto 128 bits) MSB is 0 */
-typedef UINT8 *PIN_CODE_PTR;                /* Pointer to Pin Code */
+typedef uint8_t PIN_CODE[PIN_CODE_LEN];       /* Pin Code (upto 128 bits) MSB is 0 */
+typedef uint8_t *PIN_CODE_PTR;                /* Pointer to Pin Code */
 
 #define BT_OCTET32_LEN    32
-typedef UINT8 BT_OCTET32[BT_OCTET32_LEN];   /* octet array: size 32 */
+typedef uint8_t BT_OCTET32[BT_OCTET32_LEN];   /* octet array: size 32 */
 
 #define DEV_CLASS_LEN   3
-typedef UINT8 DEV_CLASS[DEV_CLASS_LEN];     /* Device class */
-typedef UINT8 *DEV_CLASS_PTR;               /* Pointer to Device class */
+typedef uint8_t DEV_CLASS[DEV_CLASS_LEN];     /* Device class */
+typedef uint8_t *DEV_CLASS_PTR;               /* Pointer to Device class */
 
 #define EXT_INQ_RESP_LEN   3
-typedef UINT8 EXT_INQ_RESP[EXT_INQ_RESP_LEN];/* Extended Inquiry Response */
-typedef UINT8 *EXT_INQ_RESP_PTR;             /* Pointer to Extended Inquiry Response */
+typedef uint8_t EXT_INQ_RESP[EXT_INQ_RESP_LEN];/* Extended Inquiry Response */
+typedef uint8_t *EXT_INQ_RESP_PTR;             /* Pointer to Extended Inquiry Response */
 
 #define BD_NAME_LEN     248
-typedef UINT8 BD_NAME[BD_NAME_LEN + 1];         /* Device name */
-typedef UINT8 *BD_NAME_PTR;                 /* Pointer to Device name */
+typedef uint8_t BD_NAME[BD_NAME_LEN + 1];         /* Device name */
+typedef uint8_t *BD_NAME_PTR;                 /* Pointer to Device name */
 
 #define BD_FEATURES_LEN 8
-typedef UINT8 BD_FEATURES[BD_FEATURES_LEN]; /* LMP features supported by device */
+typedef uint8_t BD_FEATURES[BD_FEATURES_LEN]; /* LMP features supported by device */
 
 #define BT_EVENT_MASK_LEN  8
-typedef UINT8 BT_EVENT_MASK[BT_EVENT_MASK_LEN];   /* Event Mask */
+typedef uint8_t BT_EVENT_MASK[BT_EVENT_MASK_LEN];   /* Event Mask */
 
 #define LAP_LEN         3
-typedef UINT8 LAP[LAP_LEN];                 /* IAC as passed to Inquiry (LAP) */
-typedef UINT8 INQ_LAP[LAP_LEN];             /* IAC as passed to Inquiry (LAP) */
+typedef uint8_t LAP[LAP_LEN];                 /* IAC as passed to Inquiry (LAP) */
+typedef uint8_t INQ_LAP[LAP_LEN];             /* IAC as passed to Inquiry (LAP) */
 
 #define RAND_NUM_LEN    16
-typedef UINT8 RAND_NUM[RAND_NUM_LEN];
+typedef uint8_t RAND_NUM[RAND_NUM_LEN];
 
 #define ACO_LEN         12
-typedef UINT8 ACO[ACO_LEN];                 /* Authenticated ciphering offset */
+typedef uint8_t ACO[ACO_LEN];                 /* Authenticated ciphering offset */
 
 #define COF_LEN         12
-typedef UINT8 COF[COF_LEN];                 /* ciphering offset number */
+typedef uint8_t COF[COF_LEN];                 /* ciphering offset number */
 
 typedef struct {
-    UINT8               qos_flags;          /* TBD */
-    UINT8               service_type;       /* see below */
-    UINT32              token_rate;         /* bytes/second */
-    UINT32              token_bucket_size;  /* bytes */
-    UINT32              peak_bandwidth;     /* bytes/second */
-    UINT32              latency;            /* microseconds */
-    UINT32              delay_variation;    /* microseconds */
+    uint8_t             qos_flags;          /* TBD */
+    uint8_t             service_type;       /* see below */
+    uint32_t            token_rate;         /* bytes/second */
+    uint32_t            token_bucket_size;  /* bytes */
+    uint32_t            peak_bandwidth;     /* bytes/second */
+    uint32_t            latency;            /* microseconds */
+    uint32_t            delay_variation;    /* microseconds */
 } FLOW_SPEC;
 
 /* Values for service_type */
@@ -398,7 +388,7 @@
 #define ACCESS_CODE_BYTE_LEN            9
 #define SHORTENED_ACCESS_CODE_BIT_LEN   68
 
-typedef UINT8 ACCESS_CODE[ACCESS_CODE_BYTE_LEN];
+typedef uint8_t ACCESS_CODE[ACCESS_CODE_BYTE_LEN];
 
 #define SYNTH_TX                1           /* want synth code to TRANSMIT at this freq */
 #define SYNTH_RX                2           /* want synth code to RECEIVE at this freq */
@@ -415,13 +405,13 @@
 #define LEN_UUID_32     4
 #define LEN_UUID_128    16
 
-    UINT16          len;
+    uint16_t        len;
 
     union
     {
-        UINT16      uuid16;
-        UINT32      uuid32;
-        UINT8       uuid128[MAX_UUID_SIZE];
+        uint16_t    uuid16;
+        uint32_t    uuid32;
+        uint8_t     uuid128[MAX_UUID_SIZE];
     } uu;
 
 } tBT_UUID;
@@ -479,11 +469,11 @@
 
 typedef struct
 {
-    UINT32   is_connected;
-    INT32    rssi;
-    UINT32   bytes_sent;
-    UINT32   bytes_rcvd;
-    UINT32   duration;
+    uint32_t is_connected;
+    int32_t  rssi;
+    uint32_t bytes_sent;
+    uint32_t bytes_rcvd;
+    uint32_t duration;
 } tBT_CONN_STATS;
 
 #endif
@@ -498,13 +488,13 @@
 #define BLE_ADDR_RANDOM         0x01
 #define BLE_ADDR_PUBLIC_ID      0x02
 #define BLE_ADDR_RANDOM_ID      0x03
-typedef UINT8 tBLE_ADDR_TYPE;
+typedef uint8_t tBLE_ADDR_TYPE;
 #define BLE_ADDR_TYPE_MASK      (BLE_ADDR_RANDOM | BLE_ADDR_PUBLIC)
 
 #define BT_TRANSPORT_INVALID   0
 #define BT_TRANSPORT_BR_EDR    1
 #define BT_TRANSPORT_LE        2
-typedef UINT8 tBT_TRANSPORT;
+typedef uint8_t tBT_TRANSPORT;
 
 #define BLE_ADDR_IS_STATIC(x)   (((x)[0] & 0xC0) == 0xC0)
 
@@ -519,7 +509,7 @@
 #define BT_DEVICE_TYPE_BREDR   0x01
 #define BT_DEVICE_TYPE_BLE     0x02
 #define BT_DEVICE_TYPE_DUMO    0x03
-typedef UINT8 tBT_DEVICE_TYPE;
+typedef uint8_t tBT_DEVICE_TYPE;
 /*****************************************************************************/
 
 
@@ -538,7 +528,7 @@
 /* Define New Trace Type Definition */
 /* TRACE_CTRL_TYPE                  0x^^000000*/
 #define TRACE_CTRL_MASK             0xff000000
-#define TRACE_GET_CTRL(x)           ((((UINT32)(x)) & TRACE_CTRL_MASK) >> 24)
+#define TRACE_GET_CTRL(x)           ((((uint32_t)(x)) & TRACE_CTRL_MASK) >> 24)
 
 #define TRACE_CTRL_GENERAL          0x00000000
 #define TRACE_CTRL_STR_RESOURCE     0x01000000
@@ -547,7 +537,7 @@
 
 /* LAYER SPECIFIC                   0x00^^0000*/
 #define TRACE_LAYER_MASK            0x00ff0000
-#define TRACE_GET_LAYER(x)          ((((UINT32)(x)) & TRACE_LAYER_MASK) >> 16)
+#define TRACE_GET_LAYER(x)          ((((uint32_t)(x)) & TRACE_LAYER_MASK) >> 16)
 
 #define TRACE_LAYER_NONE            0x00000000
 #define TRACE_LAYER_USB             0x00010000
@@ -604,7 +594,7 @@
 
 /* TRACE_ORIGINATOR                 0x0000^^00*/
 #define TRACE_ORG_MASK              0x0000ff00
-#define TRACE_GET_ORG(x)            ((((UINT32)(x)) & TRACE_ORG_MASK) >> 8)
+#define TRACE_GET_ORG(x)            ((((uint32_t)(x)) & TRACE_ORG_MASK) >> 8)
 
 #define TRACE_ORG_STACK             0x00000000
 #define TRACE_ORG_HCI_TRANS         0x00000100
@@ -626,7 +616,7 @@
 
 /* TRACE_TYPE                       0x000000^^*/
 #define TRACE_TYPE_MASK             0x000000ff
-#define TRACE_GET_TYPE(x)           (((UINT32)(x)) & TRACE_TYPE_MASK)
+#define TRACE_GET_TYPE(x)           (((uint32_t)(x)) & TRACE_TYPE_MASK)
 
 #define TRACE_TYPE_ERROR            0x00000000
 #define TRACE_TYPE_WARNING          0x00000001
diff --git a/stack/include/btm_api.h b/stack/include/btm_api.h
index 97dad9d..f429c61 100644
--- a/stack/include/btm_api.h
+++ b/stack/include/btm_api.h
@@ -72,7 +72,7 @@
 
 typedef uint8_t tBTM_STATUS;
 
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
 typedef enum
 {
     BTM_BR_ONE,                         /*0 First state or BR/EDR scan 1*/
@@ -92,27 +92,27 @@
 #define BTM_DEVICE_ROLE_BR      0x01
 #define BTM_DEVICE_ROLE_DUAL    0x02
 #define BTM_MAX_DEVICE_ROLE     BTM_DEVICE_ROLE_DUAL
-typedef UINT8 tBTM_DEVICE_ROLE;
+typedef uint8_t tBTM_DEVICE_ROLE;
 
 /* Device name of peer (may be truncated to save space in BTM database) */
-typedef UINT8 tBTM_BD_NAME[BTM_MAX_REM_BD_NAME_LEN + 1];
+typedef uint8_t tBTM_BD_NAME[BTM_MAX_REM_BD_NAME_LEN + 1];
 
 /* Structure returned with local version information */
 typedef struct
 {
-    UINT8       hci_version;
-    UINT16      hci_revision;
-    UINT8       lmp_version;
-    UINT16      manufacturer;
-    UINT16      lmp_subversion;
+    uint8_t     hci_version;
+    uint16_t    hci_revision;
+    uint8_t     lmp_version;
+    uint16_t    manufacturer;
+    uint16_t    lmp_subversion;
 } tBTM_VERSION_INFO;
 
 /* Structure returned with Vendor Specific Command complete callback */
 typedef struct
 {
-    UINT16  opcode;
-    UINT16  param_len;
-    UINT8   *p_param_buf;
+    uint16_t opcode;
+    uint16_t param_len;
+    uint8_t  *p_param_buf;
 } tBTM_VSC_CMPL;
 
 #define  BTM_VSC_CMPL_DATA_SIZE  (BTM_MAX_VENDOR_SPECIFIC_LEN + sizeof(tBTM_VSC_CMPL))
@@ -131,7 +131,7 @@
     BTM_DEV_STATUS_CMD_TOUT
 };
 
-typedef UINT8 tBTM_DEV_STATUS;
+typedef uint8_t tBTM_DEV_STATUS;
 
 
 typedef void (tBTM_DEV_STATUS_CB) (tBTM_DEV_STATUS status);
@@ -141,7 +141,7 @@
 ** array of returned parameter bytes are included. This asynchronous event
 ** is enabled/disabled by calling BTM_RegisterForVSEvents().
 */
-typedef void (tBTM_VS_EVT_CB) (UINT8 len, UINT8 *p);
+typedef void (tBTM_VS_EVT_CB) (uint8_t len, uint8_t *p);
 
 
 /* General callback function for notifying an application that a synchronous
@@ -158,7 +158,7 @@
 ** Parameters are the BD Address of remote and the Dev Class of remote.
 ** If the app returns none zero, the connection or inquiry result will be dropped.
 */
-typedef UINT8 (tBTM_FILTER_CB) (BD_ADDR bd_addr, DEV_CLASS dc);
+typedef uint8_t (tBTM_FILTER_CB) (BD_ADDR bd_addr, DEV_CLASS dc);
 
 /*****************************************************************************
 **  DEVICE DISCOVERY - Inquiry, Remote Name, Discovery, Class of Device
@@ -496,7 +496,7 @@
 #define BTM_EIR_NOT_FOUND       1
 #define BTM_EIR_UNKNOWN         2
 
-typedef UINT8 tBTM_EIR_SEARCH_RESULT;
+typedef uint8_t tBTM_EIR_SEARCH_RESULT;
 
 #define BTM_EIR_FLAGS_TYPE                  HCI_EIR_FLAGS_TYPE                  /* 0x01 */
 #define BTM_EIR_MORE_16BITS_UUID_TYPE       HCI_EIR_MORE_16BITS_UUID_TYPE       /* 0x02 */
@@ -527,28 +527,28 @@
 #define BTM_BLE_SEC_ENCRYPT             1 /* encrypt the link using current key */
 #define BTM_BLE_SEC_ENCRYPT_NO_MITM     2
 #define BTM_BLE_SEC_ENCRYPT_MITM        3
-typedef UINT8   tBTM_BLE_SEC_ACT;
+typedef uint8_t tBTM_BLE_SEC_ACT;
 
 /************************************************************************************************
-** BTM Services MACROS handle array of UINT32 bits for more than 32 services
+** BTM Services MACROS handle array of uint32_t bits for more than 32 services
 *************************************************************************************************/
-/* Determine the number of UINT32's necessary for services */
+/* Determine the number of uint32_t's necessary for services */
 #define BTM_EIR_ARRAY_BITS          32          /* Number of bits in each array element */
-#define BTM_EIR_SERVICE_ARRAY_SIZE  (((UINT32)BTM_EIR_MAX_SERVICES / BTM_EIR_ARRAY_BITS) + \
-                                    (((UINT32)BTM_EIR_MAX_SERVICES % BTM_EIR_ARRAY_BITS) ? 1 : 0))
+#define BTM_EIR_SERVICE_ARRAY_SIZE  (((uint32_t)BTM_EIR_MAX_SERVICES / BTM_EIR_ARRAY_BITS) + \
+                                    (((uint32_t)BTM_EIR_MAX_SERVICES % BTM_EIR_ARRAY_BITS) ? 1 : 0))
 
 /* MACRO to set the service bit mask in a bit stream */
-#define BTM_EIR_SET_SERVICE(p, service)  (((UINT32 *)(p))[(((UINT32)(service)) / BTM_EIR_ARRAY_BITS)] |=  \
-                                    ((UINT32)1 << (((UINT32)(service)) % BTM_EIR_ARRAY_BITS)))
+#define BTM_EIR_SET_SERVICE(p, service)  (((uint32_t *)(p))[(((uint32_t)(service)) / BTM_EIR_ARRAY_BITS)] |=  \
+                                    ((uint32_t)1 << (((uint32_t)(service)) % BTM_EIR_ARRAY_BITS)))
 
 
 /* MACRO to clear the service bit mask in a bit stream */
-#define BTM_EIR_CLR_SERVICE(p, service)  (((UINT32 *)(p))[(((UINT32)(service)) / BTM_EIR_ARRAY_BITS)] &=  \
-                                    ~((UINT32)1 << (((UINT32)(service)) % BTM_EIR_ARRAY_BITS)))
+#define BTM_EIR_CLR_SERVICE(p, service)  (((uint32_t *)(p))[(((uint32_t)(service)) / BTM_EIR_ARRAY_BITS)] &=  \
+                                    ~((uint32_t)1 << (((uint32_t)(service)) % BTM_EIR_ARRAY_BITS)))
 
 /* MACRO to check the service bit mask in a bit stream */
-#define BTM_EIR_HAS_SERVICE(p, service)  ((((UINT32 *)(p))[(((UINT32)(service)) / BTM_EIR_ARRAY_BITS)] &  \
-                                    ((UINT32)1 << (((UINT32)(service)) % BTM_EIR_ARRAY_BITS))) >> (((UINT32)(service)) % BTM_EIR_ARRAY_BITS))
+#define BTM_EIR_HAS_SERVICE(p, service)  ((((uint32_t *)(p))[(((uint32_t)(service)) / BTM_EIR_ARRAY_BITS)] &  \
+                                    ((uint32_t)1 << (((uint32_t)(service)) % BTM_EIR_ARRAY_BITS))) >> (((uint32_t)(service)) % BTM_EIR_ARRAY_BITS))
 
 /* start of EIR in HCI buffer, 4 bytes = HCI Command(2) + Length(1) + FEC_Req(1) */
 #define BTM_HCI_EIR_OFFSET          (BT_HDR_SIZE + 4)
@@ -575,14 +575,14 @@
 
 typedef struct              /* contains the parameters passed to the inquiry functions */
 {
-    UINT8   mode;                       /* general or limited */
-    UINT8   duration;                   /* duration of the inquiry (1.28 sec increments) */
-    UINT8   max_resps;                  /* maximum number of responses to return */
-    BOOLEAN report_dup;                 /* report duplicated inquiry response with higher RSSI value */
-    UINT8   filter_cond_type;           /* new devices, BD ADDR, COD, or No filtering */
+    uint8_t mode;                       /* general or limited */
+    uint8_t duration;                   /* duration of the inquiry (1.28 sec increments) */
+    uint8_t max_resps;                  /* maximum number of responses to return */
+    bool    report_dup;                 /* report duplicated inquiry response with higher RSSI value */
+    uint8_t filter_cond_type;           /* new devices, BD ADDR, COD, or No filtering */
     tBTM_INQ_FILT_COND  filter_cond;    /* filter value based on filter cond type */
-#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
-    UINT8   intl_duration[4];              /*duration array storing the interleave scan's time portions*/
+#if (BTA_HOST_INTERLEAVE_SEARCH == TRUE)
+    uint8_t intl_duration[4];              /*duration array storing the interleave scan's time portions*/
 #endif
 } tBTM_INQ_PARMS;
 
@@ -595,7 +595,7 @@
 #define BTM_BLE_EVT_DISC_ADV        0x02
 #define BTM_BLE_EVT_NON_CONN_ADV    0x03
 #define BTM_BLE_EVT_SCAN_RSP        0x04
-typedef UINT8 tBTM_BLE_EVT_TYPE;
+typedef uint8_t tBTM_BLE_EVT_TYPE;
 #endif
 
 /* These are the fields returned in each device's response to the inquiry.  It
@@ -603,21 +603,21 @@
 */
 typedef struct
 {
-    UINT16      clock_offset;
+    uint16_t    clock_offset;
     BD_ADDR     remote_bd_addr;
     DEV_CLASS   dev_class;
-    UINT8       page_scan_rep_mode;
-    UINT8       page_scan_per_mode;
-    UINT8       page_scan_mode;
-    INT8        rssi;       /* Set to BTM_INQ_RES_IGNORE_RSSI if  not valid */
-    UINT32      eir_uuid[BTM_EIR_SERVICE_ARRAY_SIZE];
-    BOOLEAN     eir_complete_list;
+    uint8_t     page_scan_rep_mode;
+    uint8_t     page_scan_per_mode;
+    uint8_t     page_scan_mode;
+    int8_t      rssi;       /* Set to BTM_INQ_RES_IGNORE_RSSI if  not valid */
+    uint32_t    eir_uuid[BTM_EIR_SERVICE_ARRAY_SIZE];
+    bool        eir_complete_list;
 #if (BLE_INCLUDED == TRUE)
     tBT_DEVICE_TYPE         device_type;
-    UINT8       inq_result_type;
-    UINT8       ble_addr_type;
+    uint8_t     inq_result_type;
+    uint8_t     ble_addr_type;
     tBTM_BLE_EVT_TYPE       ble_evt_type;
-    UINT8                   flag;
+    uint8_t                 flag;
 #endif
 } tBTM_INQ_RESULTS;
 
@@ -629,14 +629,14 @@
 {
     tBTM_INQ_RESULTS    results;
 
-    BOOLEAN             appl_knows_rem_name;    /* set by application if it knows the remote name of the peer device.
+    bool                appl_knows_rem_name;    /* set by application if it knows the remote name of the peer device.
                                                    This is later used by application to determine if remote name request is
                                                    required to be done. Having the flag here avoid duplicate store of inquiry results */
-#if ( BLE_INCLUDED == TRUE)
-    UINT16          remote_name_len;
+#if (BLE_INCLUDED == TRUE)
+    uint16_t        remote_name_len;
     tBTM_BD_NAME    remote_name;
-    UINT8           remote_name_state;
-    UINT8           remote_name_type;
+    uint8_t         remote_name_state;
+    uint8_t         remote_name_type;
 #endif
 
 } tBTM_INQ_INFO;
@@ -646,26 +646,26 @@
 typedef struct
 {
     tBTM_STATUS status;
-    UINT8       num_resp;       /* Number of results from the current inquiry */
+    uint8_t     num_resp;       /* Number of results from the current inquiry */
 } tBTM_INQUIRY_CMPL;
 
 
 /* Structure returned with remote name  request */
 typedef struct
 {
-    UINT16      status;
+    uint16_t    status;
     BD_ADDR     bd_addr;
-    UINT16      length;
+    uint16_t    length;
     BD_NAME     remote_bd_name;
 } tBTM_REMOTE_DEV_NAME;
 
 typedef struct
 {
-    UINT8   pcm_intf_rate;  /* PCM interface rate: 0: 128kbps, 1: 256 kbps;
+    uint8_t pcm_intf_rate;  /* PCM interface rate: 0: 128kbps, 1: 256 kbps;
                                 2:512 bps; 3: 1024kbps; 4: 2048kbps */
-    UINT8   frame_type;     /* frame type: 0: short; 1: long */
-    UINT8   sync_mode;      /* sync mode: 0: slave; 1: master */
-    UINT8   clock_mode;     /* clock mode: 0: slave; 1: master */
+    uint8_t frame_type;     /* frame type: 0: short; 1: long */
+    uint8_t sync_mode;      /* sync mode: 0: slave; 1: master */
+    uint8_t clock_mode;     /* clock mode: 0: slave; 1: master */
 
 }tBTM_SCO_PCM_PARAM;
 
@@ -676,12 +676,12 @@
 ** changes. First param is inquiry database, second is if added to or removed
 ** from the inquiry database.
 */
-typedef void (tBTM_INQ_DB_CHANGE_CB) (void *p1, BOOLEAN is_new);
+typedef void (tBTM_INQ_DB_CHANGE_CB) (void *p1, bool    is_new);
 
 /* Callback function for notifications when the BTM gets inquiry response.
 ** First param is inquiry results database, second is pointer of EIR.
 */
-typedef void (tBTM_INQ_RESULTS_CB) (tBTM_INQ_RESULTS *p_inq_results, UINT8 *p_eir);
+typedef void (tBTM_INQ_RESULTS_CB) (tBTM_INQ_RESULTS *p_inq_results, uint8_t *p_eir);
 
 /*****************************************************************************
 **  ACL CHANNEL MANAGEMENT
@@ -724,8 +724,8 @@
 */
 typedef struct
 {
-    UINT8   hci_status;     /* HCI status returned with the event */
-    UINT8   role;           /* BTM_ROLE_MASTER or BTM_ROLE_SLAVE */
+    uint8_t hci_status;     /* HCI status returned with the event */
+    uint8_t role;           /* BTM_ROLE_MASTER or BTM_ROLE_SLAVE */
     BD_ADDR remote_bd_addr; /* Remote BD addr involved with the switch */
 } tBTM_ROLE_SWITCH_CMPL;
 
@@ -735,8 +735,8 @@
 typedef struct
 {
     FLOW_SPEC flow;
-    UINT16 handle;
-    UINT8 status;
+    uint16_t handle;
+    uint8_t status;
 } tBTM_QOS_SETUP_CMPL;
 
 
@@ -746,8 +746,8 @@
 typedef struct
 {
     tBTM_STATUS status;
-    UINT8       hci_status;
-    INT8        rssi;
+    uint8_t     hci_status;
+    int8_t      rssi;
     BD_ADDR     rem_bda;
 } tBTM_RSSI_RESULTS;
 
@@ -757,8 +757,8 @@
 typedef struct
 {
     tBTM_STATUS status;
-    UINT8       hci_status;
-    INT8        tx_power;
+    uint8_t     hci_status;
+    int8_t      tx_power;
     BD_ADDR     rem_bda;
 } tBTM_TX_POWER_RESULTS;
 
@@ -768,8 +768,8 @@
 typedef struct
 {
     tBTM_STATUS status;
-    UINT8       hci_status;
-    UINT8       link_quality;
+    uint8_t     hci_status;
+    uint8_t     link_quality;
     BD_ADDR     rem_bda;
 } tBTM_LINK_QUALITY_RESULTS;
 
@@ -779,8 +779,8 @@
 typedef struct
 {
     tBTM_STATUS status;
-    UINT8       hci_status;
-    INT8        tx_power;
+    uint8_t     hci_status;
+    int8_t      tx_power;
 } tBTM_INQ_TXPWR_RESULTS;
 
 enum
@@ -791,8 +791,8 @@
     BTM_BL_ROLE_CHG_EVT,
     BTM_BL_COLLISION_EVT
 };
-typedef UINT8 tBTM_BL_EVENT;
-typedef UINT16 tBTM_BL_EVENT_MASK;
+typedef uint8_t tBTM_BL_EVENT;
+typedef uint16_t tBTM_BL_EVENT_MASK;
 
 #define BTM_BL_CONN_MASK        0x0001
 #define BTM_BL_DISCN_MASK       0x0002
@@ -810,9 +810,9 @@
     BD_ADDR_PTR     p_bda;      /* The address of the newly connected device */
     DEV_CLASS_PTR   p_dc;       /* The device class */
     BD_NAME_PTR     p_bdn;      /* The device name */
-    UINT8          *p_features; /* pointer to the remote device's features page[0] (supported features page) */
-#if BLE_INCLUDED == TRUE
-    UINT16          handle;     /* connection handle */
+    uint8_t        *p_features; /* pointer to the remote device's features page[0] (supported features page) */
+#if (BLE_INCLUDED == TRUE)
+    uint16_t        handle;     /* connection handle */
     tBT_TRANSPORT   transport; /* link is LE or not */
 #endif
 } tBTM_BL_CONN_DATA;
@@ -822,8 +822,8 @@
 {
     tBTM_BL_EVENT   event;  /* The event reported. */
     BD_ADDR_PTR     p_bda;  /* The address of the disconnected device */
-#if BLE_INCLUDED == TRUE
-    UINT16          handle; /* disconnected connection handle */
+#if (BLE_INCLUDED == TRUE)
+    uint16_t        handle; /* disconnected connection handle */
     tBT_TRANSPORT   transport; /* link is LE link or not */
 #endif
 } tBTM_BL_DISCN_DATA;
@@ -840,9 +840,9 @@
 typedef struct
 {
     tBTM_BL_EVENT   event;  /* The event reported. */
-    UINT8           busy_level;/* when paging or inquiring, level is 10.
+    uint8_t         busy_level;/* when paging or inquiring, level is 10.
                                 * Otherwise, the number of ACL links. */
-    UINT8           busy_level_flags; /* Notifies actual inquiry/page activities */
+    uint8_t         busy_level_flags; /* Notifies actual inquiry/page activities */
 } tBTM_BL_UPDATE_DATA;
 
 /* the data type associated with BTM_BL_ROLE_CHG_EVT */
@@ -850,8 +850,8 @@
 {
     tBTM_BL_EVENT   event;      /* The event reported. */
     BD_ADDR_PTR     p_bda;      /* The address of the peer connected device */
-    UINT8           new_role;
-    UINT8           hci_status; /* HCI status returned with the event */
+    uint8_t         new_role;
+    uint8_t         hci_status; /* HCI status returned with the event */
 } tBTM_BL_ROLE_CHG_DATA;
 
 typedef union
@@ -875,15 +875,15 @@
 ** changes. First param is BD address, second is if added or removed.
 ** Registered through BTM_AclRegisterForChanges call.
 */
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 typedef void (tBTM_ACL_DB_CHANGE_CB) (BD_ADDR p_bda, DEV_CLASS p_dc,
-                                      BD_NAME p_bdn, UINT8 *features,
-                                      BOOLEAN is_new, UINT16 handle,
+                                      BD_NAME p_bdn, uint8_t *features,
+                                      bool    is_new, uint16_t handle,
                                       tBT_TRANSPORT transport);
 #else
 typedef void (tBTM_ACL_DB_CHANGE_CB) (BD_ADDR p_bda, DEV_CLASS p_dc,
-                                      BD_NAME p_bdn, UINT8 *features,
-                                      BOOLEAN is_new);
+                                      BD_NAME p_bdn, uint8_t *features,
+                                      bool    is_new);
 #endif
 /*****************************************************************************
 **  SCO CHANNEL MANAGEMENT
@@ -935,7 +935,7 @@
 ****************/
 #define BTM_LINK_TYPE_SCO           HCI_LINK_TYPE_SCO
 #define BTM_LINK_TYPE_ESCO          HCI_LINK_TYPE_ESCO
-typedef UINT8 tBTM_SCO_TYPE;
+typedef uint8_t tBTM_SCO_TYPE;
 
 
 /*******************
@@ -943,7 +943,7 @@
 ********************/
 #define BTM_SCO_ROUTE_PCM           HCI_BRCM_SCO_ROUTE_PCM
 #define BTM_SCO_ROUTE_HCI           HCI_BRCM_SCO_ROUTE_HCI
-typedef UINT8 tBTM_SCO_ROUTE_TYPE;
+typedef uint8_t tBTM_SCO_ROUTE_TYPE;
 
 
 /*******************
@@ -954,7 +954,7 @@
 #define BTM_SCO_CODEC_NONE          0x0000
 #define BTM_SCO_CODEC_CVSD          0x0001
 #define BTM_SCO_CODEC_MSBC          0x0002
-typedef UINT16 tBTM_SCO_CODEC_TYPE;
+typedef uint16_t tBTM_SCO_CODEC_TYPE;
 
 
 
@@ -965,17 +965,17 @@
 #define BTM_SCO_AIR_MODE_A_LAW          1
 #define BTM_SCO_AIR_MODE_CVSD           2
 #define BTM_SCO_AIR_MODE_TRANSPNT       3
-typedef UINT8 tBTM_SCO_AIR_MODE_TYPE;
+typedef uint8_t tBTM_SCO_AIR_MODE_TYPE;
 
 /*******************
 ** SCO Voice Settings
 ********************/
-#define BTM_VOICE_SETTING_CVSD  ((UINT16)  (HCI_INP_CODING_LINEAR          |   \
+#define BTM_VOICE_SETTING_CVSD  ((uint16_t)  (HCI_INP_CODING_LINEAR          |   \
                                             HCI_INP_DATA_FMT_2S_COMPLEMENT |   \
                                             HCI_INP_SAMPLE_SIZE_16BIT      |   \
                                             HCI_AIR_CODING_FORMAT_CVSD))
 
-#define BTM_VOICE_SETTING_TRANS ((UINT16)  (HCI_INP_CODING_LINEAR          |   \
+#define BTM_VOICE_SETTING_TRANS ((uint16_t)  (HCI_INP_CODING_LINEAR          |   \
                                             HCI_INP_DATA_FMT_2S_COMPLEMENT |   \
                                             HCI_INP_SAMPLE_SIZE_16BIT      |   \
                                             HCI_AIR_CODING_FORMAT_TRANSPNT))
@@ -990,13 +990,13 @@
     BTM_SCO_DATA_NONE,
     BTM_SCO_DATA_PAR_LOST
 };
-typedef UINT8 tBTM_SCO_DATA_FLAG;
+typedef uint8_t tBTM_SCO_DATA_FLAG;
 
 /***************************
 **  SCO Callback Functions
 ****************************/
-typedef void (tBTM_SCO_CB) (UINT16 sco_inx);
-typedef void (tBTM_SCO_DATA_CB) (UINT16 sco_inx, BT_HDR *p_data, tBTM_SCO_DATA_FLAG status);
+typedef void (tBTM_SCO_CB) (uint16_t sco_inx);
+typedef void (tBTM_SCO_DATA_CB) (uint16_t sco_inx, BT_HDR *p_data, tBTM_SCO_DATA_FLAG status);
 
 /******************
 **  eSCO Constants
@@ -1018,52 +1018,52 @@
 /* tBTM_ESCO_CBACK event types */
 #define BTM_ESCO_CHG_EVT        1
 #define BTM_ESCO_CONN_REQ_EVT   2
-typedef UINT8 tBTM_ESCO_EVT;
+typedef uint8_t tBTM_ESCO_EVT;
 
 /* Passed into BTM_SetEScoMode() */
 typedef struct
 {
-    UINT32 tx_bw;
-    UINT32 rx_bw;
-    UINT16 max_latency;
-    UINT16 voice_contfmt;  /* Voice Settings or Content Format */
-    UINT16 packet_types;
-    UINT8  retrans_effort;
+    uint32_t tx_bw;
+    uint32_t rx_bw;
+    uint16_t max_latency;
+    uint16_t voice_contfmt;  /* Voice Settings or Content Format */
+    uint16_t packet_types;
+    uint8_t  retrans_effort;
 } tBTM_ESCO_PARAMS;
 
 typedef struct
 {
-    UINT16 max_latency;
-    UINT16 packet_types;
-    UINT8  retrans_effort;
+    uint16_t max_latency;
+    uint16_t packet_types;
+    uint8_t  retrans_effort;
 } tBTM_CHG_ESCO_PARAMS;
 
 /* Returned by BTM_ReadEScoLinkParms() */
 typedef struct
 {
-    UINT16  rx_pkt_len;
-    UINT16  tx_pkt_len;
+    uint16_t rx_pkt_len;
+    uint16_t tx_pkt_len;
     BD_ADDR bd_addr;
-    UINT8   link_type;  /* BTM_LINK_TYPE_SCO or BTM_LINK_TYPE_ESCO */
-    UINT8   tx_interval;
-    UINT8   retrans_window;
-    UINT8   air_mode;
+    uint8_t link_type;  /* BTM_LINK_TYPE_SCO or BTM_LINK_TYPE_ESCO */
+    uint8_t tx_interval;
+    uint8_t retrans_window;
+    uint8_t air_mode;
 } tBTM_ESCO_DATA;
 
 typedef struct
 {
-    UINT16  sco_inx;
-    UINT16  rx_pkt_len;
-    UINT16  tx_pkt_len;
+    uint16_t sco_inx;
+    uint16_t rx_pkt_len;
+    uint16_t tx_pkt_len;
     BD_ADDR bd_addr;
-    UINT8   hci_status;
-    UINT8   tx_interval;
-    UINT8   retrans_window;
+    uint8_t hci_status;
+    uint8_t tx_interval;
+    uint8_t retrans_window;
 } tBTM_CHG_ESCO_EVT_DATA;
 
 typedef struct
 {
-    UINT16        sco_inx;
+    uint16_t      sco_inx;
     BD_ADDR       bd_addr;
     DEV_CLASS     dev_class;
     tBTM_SCO_TYPE link_type;
@@ -1149,7 +1149,7 @@
 #define BTM_LKEY_TYPE_IGNORE        0xff    /* used when event is response from
                                                hci return link keys request */
 
-typedef UINT8 tBTM_LINK_KEY_TYPE;
+typedef uint8_t tBTM_LINK_KEY_TYPE;
 
 /* Protocol level security (BTM_SetSecurityLevel) */
 #define BTM_SEC_PROTO_L2CAP         0
@@ -1162,10 +1162,10 @@
 #define BTM_SEC_PROTO_AVDT          7
 #define BTM_SEC_PROTO_MCA           8
 
-/* Determine the number of UINT32's necessary for security services */
+/* Determine the number of uint32_t's necessary for security services */
 #define BTM_SEC_ARRAY_BITS          32          /* Number of bits in each array element */
-#define BTM_SEC_SERVICE_ARRAY_SIZE  (((UINT32)BTM_SEC_MAX_SERVICES / BTM_SEC_ARRAY_BITS) + \
-                                    (((UINT32)BTM_SEC_MAX_SERVICES % BTM_SEC_ARRAY_BITS) ? 1 : 0))
+#define BTM_SEC_SERVICE_ARRAY_SIZE  (((uint32_t)BTM_SEC_MAX_SERVICES / BTM_SEC_ARRAY_BITS) + \
+                                    (((uint32_t)BTM_SEC_MAX_SERVICES % BTM_SEC_ARRAY_BITS) ? 1 : 0))
 
 /* Security service definitions (BTM_SetSecurityLevel)
 ** Used for Authorization APIs
@@ -1231,28 +1231,28 @@
 #endif
 
 /************************************************************************************************
-** Security Services MACROS handle array of UINT32 bits for more than 32 trusted services
+** Security Services MACROS handle array of uint32_t bits for more than 32 trusted services
 *************************************************************************************************/
 /* MACRO to set the security service bit mask in a bit stream */
-#define BTM_SEC_SET_SERVICE(p, service)  (((UINT32 *)(p))[(((UINT32)(service)) / BTM_SEC_ARRAY_BITS)] |=  \
-                                    ((UINT32)1 << (((UINT32)(service)) % BTM_SEC_ARRAY_BITS)))
+#define BTM_SEC_SET_SERVICE(p, service)  (((uint32_t *)(p))[(((uint32_t)(service)) / BTM_SEC_ARRAY_BITS)] |=  \
+                                    ((uint32_t)1 << (((uint32_t)(service)) % BTM_SEC_ARRAY_BITS)))
 
 
 /* MACRO to clear the security service bit mask in a bit stream */
-#define BTM_SEC_CLR_SERVICE(p, service)  (((UINT32 *)(p))[(((UINT32)(service)) / BTM_SEC_ARRAY_BITS)] &=  \
-                                    ~((UINT32)1 << (((UINT32)(service)) % BTM_SEC_ARRAY_BITS)))
+#define BTM_SEC_CLR_SERVICE(p, service)  (((uint32_t *)(p))[(((uint32_t)(service)) / BTM_SEC_ARRAY_BITS)] &=  \
+                                    ~((uint32_t)1 << (((uint32_t)(service)) % BTM_SEC_ARRAY_BITS)))
 
-/* MACRO to check the security service bit mask in a bit stream (Returns TRUE or FALSE) */
-#define BTM_SEC_IS_SERVICE_TRUSTED(p, service)    (((((UINT32 *)(p))[(((UINT32)(service)) / BTM_SEC_ARRAY_BITS)]) &   \
-                                        (UINT32)(((UINT32)1 << (((UINT32)(service)) % BTM_SEC_ARRAY_BITS)))) ? TRUE : FALSE)
+/* MACRO to check the security service bit mask in a bit stream (Returns true or false) */
+#define BTM_SEC_IS_SERVICE_TRUSTED(p, service)    (((((uint32_t *)(p))[(((uint32_t)(service)) / BTM_SEC_ARRAY_BITS)]) &   \
+                                        (uint32_t)(((uint32_t)1 << (((uint32_t)(service)) % BTM_SEC_ARRAY_BITS)))) ? true : false)
 
 /* MACRO to copy two trusted device bitmask */
-#define BTM_SEC_COPY_TRUSTED_DEVICE(p_src, p_dst)   {UINT32 trst; for (trst = 0; trst < BTM_SEC_SERVICE_ARRAY_SIZE; trst++) \
-                                                        ((UINT32 *)(p_dst))[trst] = ((UINT32 *)(p_src))[trst];}
+#define BTM_SEC_COPY_TRUSTED_DEVICE(p_src, p_dst)   {uint32_t trst; for (trst = 0; trst < BTM_SEC_SERVICE_ARRAY_SIZE; trst++) \
+                                                        ((uint32_t *)(p_dst))[trst] = ((uint32_t *)(p_src))[trst];}
 
 /* MACRO to clear two trusted device bitmask */
-#define BTM_SEC_CLR_TRUSTED_DEVICE(p_dst)   {UINT32 trst; for (trst = 0; trst < BTM_SEC_SERVICE_ARRAY_SIZE; trst++) \
-                                                        ((UINT32 *)(p_dst))[trst] = 0;}
+#define BTM_SEC_CLR_TRUSTED_DEVICE(p_dst)   {uint32_t trst; for (trst = 0; trst < BTM_SEC_SERVICE_ARRAY_SIZE; trst++) \
+                                                        ((uint32_t *)(p_dst))[trst] = 0;}
 
 /* Following bits can be provided by host in the trusted_mask array */
 /* 0..31 bits of mask[0] (Least Significant Word) */
@@ -1324,9 +1324,9 @@
 **              Is originator of the connection
 **              Result of the operation
 */
-typedef UINT8 (tBTM_AUTHORIZE_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
-                                         tBTM_BD_NAME bd_name, UINT8 *service_name,
-                                         UINT8 service_id, BOOLEAN is_originator);
+typedef uint8_t (tBTM_AUTHORIZE_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
+                                         tBTM_BD_NAME bd_name, uint8_t *service_name,
+                                         uint8_t service_id, bool    is_originator);
 
 /* Get PIN for the connection.  Parameters are
 **              BD Address of remote
@@ -1334,17 +1334,17 @@
 **              BD Name of remote
 **              Flag indicating the minimum pin code length to be 16 digits
 */
-typedef UINT8 (tBTM_PIN_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
-                                   tBTM_BD_NAME bd_name, BOOLEAN min_16_digit);
+typedef uint8_t (tBTM_PIN_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
+                                   tBTM_BD_NAME bd_name, bool    min_16_digit);
 
 /* New Link Key for the connection.  Parameters are
 **              BD Address of remote
 **              Link Key
 **              Key Type: Combination, Local Unit, or Remote Unit
 */
-typedef UINT8 (tBTM_LINK_KEY_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
-                                        tBTM_BD_NAME bd_name, UINT8 *key,
-                                        UINT8 key_type);
+typedef uint8_t (tBTM_LINK_KEY_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
+                                        tBTM_BD_NAME bd_name, uint8_t *key,
+                                        uint8_t key_type);
 
 
 /* Remote Name Resolved.  Parameters are
@@ -1361,7 +1361,7 @@
 **              BD Name of remote
 **
 */
-typedef UINT8 (tBTM_AUTH_COMPLETE_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
+typedef uint8_t (tBTM_AUTH_COMPLETE_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
                                              tBTM_BD_NAME bd_name, int result);
 
 enum
@@ -1377,20 +1377,20 @@
     BTM_SP_COMPLT_EVT,      /* received SIMPLE_PAIRING_COMPLETE event */
     BTM_SP_UPGRADE_EVT      /* check if the application wants to upgrade the link key */
 };
-typedef UINT8 tBTM_SP_EVT;
+typedef uint8_t tBTM_SP_EVT;
 
 #define BTM_IO_CAP_OUT      0   /* DisplayOnly */
 #define BTM_IO_CAP_IO       1   /* DisplayYesNo */
 #define BTM_IO_CAP_IN       2   /* KeyboardOnly */
 #define BTM_IO_CAP_NONE     3   /* NoInputNoOutput */
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
 #define BTM_IO_CAP_KBDISP   4   /* Keyboard display */
 #define BTM_IO_CAP_MAX      5
 #else
 #define BTM_IO_CAP_MAX      4
 #endif
 
-typedef UINT8 tBTM_IO_CAP;
+typedef uint8_t tBTM_IO_CAP;
 
 #define BTM_MAX_PASSKEY_VAL (999999)
 #define BTM_MIN_PASSKEY_VAL (0)
@@ -1416,7 +1416,7 @@
 #define BTM_BLE_RESPONDER_KEY_SIZE 15
 #define BTM_BLE_MAX_KEY_SIZE       16
 
-typedef UINT8 tBTM_AUTH_REQ;
+typedef uint8_t tBTM_AUTH_REQ;
 
 enum
 {
@@ -1424,7 +1424,7 @@
     BTM_OOB_PRESENT,
     BTM_OOB_UNKNOWN
 };
-typedef UINT8 tBTM_OOB_DATA;
+typedef uint8_t tBTM_OOB_DATA;
 
 /* data type for BTM_SP_IO_REQ_EVT */
 typedef struct
@@ -1433,7 +1433,7 @@
     tBTM_IO_CAP     io_cap;         /* local IO capabilities */
     tBTM_OOB_DATA   oob_data;       /* OOB data present (locally) for the peer device */
     tBTM_AUTH_REQ   auth_req;       /* Authentication required (for local device) */
-    BOOLEAN         is_orig;        /* TRUE, if local device initiated the SP process */
+    bool            is_orig;        /* true, if local device initiated the SP process */
 } tBTM_SP_IO_REQ;
 
 /* data type for BTM_SP_IO_RSP_EVT */
@@ -1451,8 +1451,8 @@
     BD_ADDR         bd_addr;        /* peer address */
     DEV_CLASS       dev_class;      /* peer CoD */
     tBTM_BD_NAME    bd_name;        /* peer device name */
-    UINT32          num_val;        /* the numeric value for comparison. If just_works, do not show this number to UI */
-    BOOLEAN         just_works;     /* TRUE, if "Just Works" association model */
+    uint32_t        num_val;        /* the numeric value for comparison. If just_works, do not show this number to UI */
+    bool            just_works;     /* true, if "Just Works" association model */
     tBTM_AUTH_REQ   loc_auth_req;   /* Authentication required for local device */
     tBTM_AUTH_REQ   rmt_auth_req;   /* Authentication required for peer device */
     tBTM_IO_CAP     loc_io_caps;    /* IO Capabilities of the local device */
@@ -1473,7 +1473,7 @@
     BD_ADDR         bd_addr;        /* peer address */
     DEV_CLASS       dev_class;      /* peer CoD */
     tBTM_BD_NAME    bd_name;        /* peer device name */
-    UINT32          passkey;        /* passkey */
+    uint32_t        passkey;        /* passkey */
 } tBTM_SP_KEY_NOTIF;
 
 enum
@@ -1485,7 +1485,7 @@
     BTM_SP_KEY_COMPLT,          /* 4 - passkey entry completed */
     BTM_SP_KEY_OUT_OF_RANGE     /* 5 - out of range */
 };
-typedef UINT8   tBTM_SP_KEY_TYPE;
+typedef uint8_t tBTM_SP_KEY_TYPE;
 
 /* data type for BTM_SP_KEYPRESS_EVT */
 typedef struct
@@ -1524,7 +1524,7 @@
 typedef struct
 {
     BD_ADDR         bd_addr;        /* peer address */
-    BOOLEAN         upgrade;        /* TRUE, to upgrade the link key */
+    bool            upgrade;        /* true, to upgrade the link key */
 } tBTM_SP_UPGRADE;
 
 typedef union
@@ -1544,10 +1544,10 @@
 /* Simple Pairing Events.  Called by the stack when Simple Pairing related
 ** events occur.
 */
-typedef UINT8 (tBTM_SP_CALLBACK) (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data);
+typedef uint8_t (tBTM_SP_CALLBACK) (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data);
 
 
-typedef void (tBTM_MKEY_CALLBACK) (BD_ADDR bd_addr, UINT8 status, UINT8 key_flag) ;
+typedef void (tBTM_MKEY_CALLBACK) (BD_ADDR bd_addr, uint8_t status, uint8_t key_flag) ;
 
 /* Encryption enabled/disabled complete: Optionally passed with BTM_SetEncryption.
 ** Parameters are
@@ -1581,7 +1581,7 @@
 #define BTM_LE_COMPLT_EVT       SMP_COMPLT_EVT         /* SMP complete event */
 #define BTM_LE_LAST_FROM_SMP    BTM_LE_BR_KEYS_REQ_EVT
 #define BTM_LE_KEY_EVT          (BTM_LE_LAST_FROM_SMP + 1) /* KEY update event */
-typedef UINT8 tBTM_LE_EVT;
+typedef uint8_t tBTM_LE_EVT;
 
 #define BTM_LE_KEY_NONE           0
 #define BTM_LE_KEY_PENC      SMP_SEC_KEY_TYPE_ENC        /* encryption information of peer device */
@@ -1592,12 +1592,12 @@
 #define BTM_LE_KEY_LENC      (SMP_SEC_KEY_TYPE_ENC << 4)  /* master role security information:div */
 #define BTM_LE_KEY_LID       (SMP_SEC_KEY_TYPE_ID << 4)   /* master device ID key */
 #define BTM_LE_KEY_LCSRK     (SMP_SEC_KEY_TYPE_CSRK << 4) /* local CSRK has been deliver to peer */
-typedef UINT8 tBTM_LE_KEY_TYPE;
+typedef uint8_t tBTM_LE_KEY_TYPE;
 
 #define BTM_LE_AUTH_REQ_NO_BOND SMP_AUTH_NO_BOND   /* 0 */
 #define BTM_LE_AUTH_REQ_BOND    SMP_AUTH_GEN_BOND  /* 1 << 0 */
 #define BTM_LE_AUTH_REQ_MITM    SMP_AUTH_YN_BIT    /* 1 << 2 */
-typedef UINT8 tBTM_LE_AUTH_REQ;
+typedef uint8_t tBTM_LE_AUTH_REQ;
 #define BTM_LE_SC_SUPPORT_BIT           SMP_SC_SUPPORT_BIT     /* (1 << 3) */
 #define BTM_LE_KP_SUPPORT_BIT           SMP_KP_SUPPORT_BIT     /* (1 << 4) */
 
@@ -1611,27 +1611,27 @@
 #define BTM_LE_SEC_NONE             SMP_SEC_NONE
 #define BTM_LE_SEC_UNAUTHENTICATE   SMP_SEC_UNAUTHENTICATE      /* 1 */
 #define BTM_LE_SEC_AUTHENTICATED    SMP_SEC_AUTHENTICATED       /* 4 */
-typedef UINT8 tBTM_LE_SEC;
+typedef uint8_t tBTM_LE_SEC;
 
 
 typedef struct
 {
     tBTM_IO_CAP         io_cap;         /* local IO capabilities */
-    UINT8               oob_data;       /* OOB data present (locally) for the peer device */
+    uint8_t             oob_data;       /* OOB data present (locally) for the peer device */
     tBTM_LE_AUTH_REQ    auth_req;       /* Authentication request (for local device) contain bonding and MITM info */
-    UINT8               max_key_size;   /* max encryption key size */
+    uint8_t             max_key_size;   /* max encryption key size */
     tBTM_LE_KEY_TYPE    init_keys;      /* keys to be distributed, bit mask */
     tBTM_LE_KEY_TYPE    resp_keys;      /* keys to be distributed, bit mask */
 } tBTM_LE_IO_REQ;
 
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
 /* data type for tBTM_LE_COMPLT */
 typedef struct
 {
-    UINT8 reason;
-    UINT8 sec_level;
-    BOOLEAN is_pair_cancel;
-    BOOLEAN smp_over_br;
+    uint8_t reason;
+    uint8_t sec_level;
+    bool    is_pair_cancel;
+    bool    smp_over_br;
 }tBTM_LE_COMPLT;
 #endif
 
@@ -1640,34 +1640,34 @@
 {
     BT_OCTET16  ltk;
     BT_OCTET8   rand;
-    UINT16      ediv;
-    UINT8       sec_level;
-    UINT8       key_size;
+    uint16_t    ediv;
+    uint8_t     sec_level;
+    uint8_t     key_size;
 }tBTM_LE_PENC_KEYS;
 
 /* BLE CSRK keys */
 typedef struct
 {
-    UINT32          counter;
+    uint32_t        counter;
     BT_OCTET16      csrk;
-    UINT8           sec_level;
+    uint8_t         sec_level;
 }tBTM_LE_PCSRK_KEYS;
 
 /* BLE Encryption reproduction keys */
 typedef struct
 {
     BT_OCTET16  ltk;
-    UINT16      div;
-    UINT8       key_size;
-    UINT8       sec_level;
+    uint16_t    div;
+    uint8_t     key_size;
+    uint8_t     sec_level;
 }tBTM_LE_LENC_KEYS;
 
 /* BLE SRK keys */
 typedef struct
 {
-    UINT32          counter;
-    UINT16          div;
-    UINT8           sec_level;
+    uint32_t        counter;
+    uint16_t        div;
+    uint8_t         sec_level;
     BT_OCTET16      csrk;
 }tBTM_LE_LCSRK_KEYS;
 
@@ -1696,11 +1696,11 @@
 typedef union
 {
     tBTM_LE_IO_REQ      io_req;     /* BTM_LE_IO_REQ_EVT      */
-    UINT32              key_notif;  /* BTM_LE_KEY_NOTIF_EVT   */
+    uint32_t            key_notif;  /* BTM_LE_KEY_NOTIF_EVT   */
                                     /* BTM_LE_NC_REQ_EVT */
                                     /* no callback data for BTM_LE_KEY_REQ_EVT */
                                     /* and BTM_LE_OOB_REQ_EVT  */
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
     tBTM_LE_COMPLT      complt;     /* BTM_LE_COMPLT_EVT      */
     tSMP_OOB_DATA_TYPE  req_oob_type;
 #endif
@@ -1710,7 +1710,7 @@
 /* Simple Pairing Events.  Called by the stack when Simple Pairing related
 ** events occur.
 */
-typedef UINT8 (tBTM_LE_CALLBACK) (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_DATA *p_data);
+typedef uint8_t (tBTM_LE_CALLBACK) (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_DATA *p_data);
 
 #define BTM_BLE_KEY_TYPE_ID         1
 #define BTM_BLE_KEY_TYPE_ER         2
@@ -1733,7 +1733,7 @@
 
 /* New LE identity key for local device.
 */
-typedef void (tBTM_LE_KEY_CALLBACK) (UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key);
+typedef void (tBTM_LE_KEY_CALLBACK) (uint8_t key_type, tBTM_BLE_LOCAL_KEYS *p_key);
 
 
 /***************************
@@ -1748,8 +1748,8 @@
     tBTM_AUTH_COMPLETE_CALLBACK *p_auth_complete_callback;
     tBTM_BOND_CANCEL_CMPL_CALLBACK *p_bond_cancel_cmpl_callback;
     tBTM_SP_CALLBACK            *p_sp_callback;
-#if BLE_INCLUDED == TRUE
-#if SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
+#if (SMP_INCLUDED == TRUE)
     tBTM_LE_CALLBACK            *p_le_callback;
 #endif
     tBTM_LE_KEY_CALLBACK        *p_le_key_callback;
@@ -1759,7 +1759,7 @@
 /* Callback function for when a link supervision timeout event occurs.
 ** This asynchronous event is enabled/disabled by calling BTM_RegForLstoEvt().
 */
-typedef void (tBTM_LSTO_CBACK) (BD_ADDR remote_bda, UINT16 timeout);
+typedef void (tBTM_LSTO_CBACK) (BD_ADDR remote_bda, uint16_t timeout);
 
 /*****************************************************************************
 **  POWER MANAGEMENT
@@ -1778,7 +1778,7 @@
     BTM_PM_STS_PENDING,   /* when waiting for status from controller */
     BTM_PM_STS_ERROR   /* when HCI command status returns error */
 };
-typedef UINT8 tBTM_PM_STATUS;
+typedef uint8_t tBTM_PM_STATUS;
 
 /* BTM Power manager modes */
 enum
@@ -1789,7 +1789,7 @@
     BTM_PM_MD_PARK   = BTM_PM_STS_PARK,
     BTM_PM_MD_FORCE  = 0x10 /* OR this to force ACL link to a certain mode */
 };
-typedef UINT8 tBTM_PM_MODE;
+typedef uint8_t tBTM_PM_MODE;
 
 #define BTM_PM_SET_ONLY_ID  0x80
 
@@ -1803,10 +1803,10 @@
 *************************/
 typedef struct
 {
-    UINT16          max;
-    UINT16          min;
-    UINT16          attempt;
-    UINT16          timeout;
+    uint16_t        max;
+    uint16_t        min;
+    uint16_t        attempt;
+    uint16_t        timeout;
     tBTM_PM_MODE    mode;
 } tBTM_PM_PWR_MD;
 
@@ -1814,7 +1814,7 @@
 **  Power Manager Callback Functions
 **************************************/
 typedef void (tBTM_PM_STATUS_CBACK) (BD_ADDR p_bda, tBTM_PM_STATUS status,
-                                     UINT16 value, UINT8 hci_status);
+                                     uint16_t value, uint8_t hci_status);
 
 
 /************************
@@ -1824,9 +1824,9 @@
 
 typedef struct
 {
-    UINT8          event;
-    UINT8          status;
-    UINT16         num_keys;
+    uint8_t        event;
+    uint8_t        status;
+    uint16_t       num_keys;
 
 } tBTM_DELETE_STORED_LINK_KEY_COMPLETE;
 
@@ -1838,20 +1838,20 @@
     BTM_MIP_PKTS_COMPL_EVT,
     BTM_MIP_RXDATA_EVT
 };
-typedef UINT8 tBTM_MIP_EVT;
+typedef uint8_t tBTM_MIP_EVT;
 
 typedef struct
 {
     tBTM_MIP_EVT    event;
     BD_ADDR         bd_addr;
-    UINT16          mip_id;
+    uint16_t        mip_id;
 } tBTM_MIP_MODE_CHANGE;
 
 typedef struct
 {
     tBTM_MIP_EVT    event;
-    UINT16          mip_id;
-    UINT8           disc_reason;
+    uint16_t        mip_id;
+    uint8_t         disc_reason;
 } tBTM_MIP_CONN_TIMEOUT;
 
 #define BTM_MIP_MAX_RX_LEN  17
@@ -1859,22 +1859,22 @@
 typedef struct
 {
     tBTM_MIP_EVT    event;
-    UINT16          mip_id;
-    UINT8           rx_len;
-    UINT8           rx_data[BTM_MIP_MAX_RX_LEN];
+    uint16_t        mip_id;
+    uint8_t         rx_len;
+    uint8_t         rx_data[BTM_MIP_MAX_RX_LEN];
 } tBTM_MIP_RXDATA;
 
 typedef struct
 {
     tBTM_MIP_EVT    event;
     BD_ADDR         bd_addr;
-    UINT8           data[11];       /* data[0] shows Vender-specific device type */
+    uint8_t         data[11];       /* data[0] shows Vender-specific device type */
 } tBTM_MIP_EIR_HANDSHAKE;
 
 typedef struct
 {
     tBTM_MIP_EVT    event;
-    UINT16          num_sent;       /* Number of packets completed at the controller */
+    uint16_t        num_sent;       /* Number of packets completed at the controller */
 } tBTM_MIP_PKTS_COMPL;
 
 typedef union
@@ -1891,13 +1891,13 @@
 typedef void (tBTM_MIP_EVENTS_CB) (tBTM_MIP_EVT event, tBTM_MIP_EVENT_DATA data);
 
 /* MIP Device query callback function  */
-typedef BOOLEAN (tBTM_MIP_QUERY_CB) (BD_ADDR dev_addr, UINT8 *p_mode, LINK_KEY link_key);
+typedef bool    (tBTM_MIP_QUERY_CB) (BD_ADDR dev_addr, uint8_t *p_mode, LINK_KEY link_key);
 
 #define BTM_CONTRL_ACTIVE  1       /* ACL link on, SCO link ongoing, sniff mode */
 #define BTM_CONTRL_SCAN    2       /* Scan state - paging/inquiry/trying to connect*/
 #define BTM_CONTRL_IDLE    3       /* Idle state - page scan, LE advt, inquiry scan */
 
-typedef UINT8 tBTM_CONTRL_STATE;
+typedef uint8_t tBTM_CONTRL_STATE;
 
 /*****************************************************************************
 **  EXTERNAL FUNCTION DECLARATIONS
@@ -1927,10 +1927,10 @@
 **
 ** Description      This function is called to check if the device is up.
 **
-** Returns          TRUE if device is up, else FALSE
+** Returns          true if device is up, else false
 **
 *******************************************************************************/
-extern BOOLEAN BTM_IsDeviceUp (void);
+extern bool    BTM_IsDeviceUp (void);
 
 
 /*******************************************************************************
@@ -1992,7 +1992,7 @@
 ** Returns          pointer to the device class
 **
 *******************************************************************************/
-extern UINT8 *BTM_ReadDeviceClass (void);
+extern uint8_t *BTM_ReadDeviceClass (void);
 
 
 /*******************************************************************************
@@ -2004,7 +2004,7 @@
 ** Returns          pointer to the local features string
 **
 *******************************************************************************/
-extern UINT8 *BTM_ReadLocalFeatures (void);
+extern uint8_t *BTM_ReadLocalFeatures (void);
 
 /*******************************************************************************
 **
@@ -2027,15 +2027,15 @@
 ** Description      This function is called to register/deregister for vendor
 **                  specific HCI events.
 **
-**                  If is_register=TRUE, then the function will be registered;
-**                  if is_register=FALSE, then the function will be deregistered.
+**                  If is_register=true, then the function will be registered;
+**                  if is_register=false, then the function will be deregistered.
 **
 ** Returns          BTM_SUCCESS if successful,
 **                  BTM_BUSY if maximum number of callbacks have already been
 **                           registered.
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_RegisterForVSEvents (tBTM_VS_EVT_CB *p_cb, BOOLEAN is_register);
+extern tBTM_STATUS BTM_RegisterForVSEvents (tBTM_VS_EVT_CB *p_cb, bool    is_register);
 
 
 /*******************************************************************************
@@ -2052,9 +2052,9 @@
 **                              prior command.
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_VendorSpecificCommand(UINT16 opcode,
-                                             UINT8 param_len,
-                                             UINT8 *p_param_buf,
+extern tBTM_STATUS BTM_VendorSpecificCommand(uint16_t opcode,
+                                             uint8_t param_len,
+                                             uint8_t *p_param_buf,
                                              tBTM_VSC_CMPL_CB *p_cb);
 
 
@@ -2068,7 +2068,7 @@
 ** Returns          Allocated SCN number or 0 if none.
 **
 *******************************************************************************/
-extern UINT8 BTM_AllocateSCN(void);
+extern uint8_t BTM_AllocateSCN(void);
 
 /*******************************************************************************
 **
@@ -2076,10 +2076,10 @@
 **
 ** Description      Try to allocate a fixed server channel
 **
-** Returns          Returns TRUE if server channel was available
+** Returns          Returns true if server channel was available
 **
 *******************************************************************************/
-extern BOOLEAN BTM_TryAllocateSCN(UINT8 scn);
+extern bool    BTM_TryAllocateSCN(uint8_t scn);
 
 
 /*******************************************************************************
@@ -2088,10 +2088,10 @@
 **
 ** Description      Free the specified SCN.
 **
-** Returns          TRUE if successful, FALSE if SCN is not in use or invalid
+** Returns          true if successful, false if SCN is not in use or invalid
 **
 *******************************************************************************/
-extern BOOLEAN BTM_FreeSCN(UINT8 scn);
+extern bool    BTM_FreeSCN(uint8_t scn);
 
 
 /*******************************************************************************
@@ -2104,7 +2104,7 @@
 ** Returns          The new or current trace level
 **
 *******************************************************************************/
-extern UINT8 BTM_SetTraceLevel (UINT8 new_level);
+extern uint8_t BTM_SetTraceLevel (uint8_t new_level);
 
 
 /*******************************************************************************
@@ -2118,7 +2118,7 @@
 **      BTM_NO_RESOURCES    If out of resources to send the command.
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_WritePageTimeout(UINT16 timeout);
+extern tBTM_STATUS BTM_WritePageTimeout(uint16_t timeout);
 
 /*******************************************************************************
 **
@@ -2133,7 +2133,7 @@
 **
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_WriteVoiceSettings(UINT16 settings);
+extern tBTM_STATUS BTM_WriteVoiceSettings(uint16_t settings);
 
 /*******************************************************************************
 **
@@ -2173,8 +2173,8 @@
 **                  BTM_WRONG_MODE if the device is not up.
 **
 *******************************************************************************/
-extern tBTM_STATUS  BTM_SetDiscoverability (UINT16 inq_mode, UINT16 window,
-                                            UINT16 interval);
+extern tBTM_STATUS  BTM_SetDiscoverability (uint16_t inq_mode, uint16_t window,
+                                            uint16_t interval);
 
 
 /*******************************************************************************
@@ -2191,8 +2191,8 @@
 **                  BTM_GENERAL_DISCOVERABLE
 **
 *******************************************************************************/
-extern UINT16       BTM_ReadDiscoverability (UINT16 *p_window,
-                                             UINT16 *p_interval);
+extern uint16_t     BTM_ReadDiscoverability (uint16_t *p_window,
+                                             uint16_t *p_interval);
 
 
 /*******************************************************************************
@@ -2223,7 +2223,7 @@
 **
 *******************************************************************************/
 extern tBTM_STATUS  BTM_SetPeriodicInquiryMode (tBTM_INQ_PARMS *p_inqparms,
-                                                UINT16 max_delay, UINT16 min_delay,
+                                                uint16_t max_delay, uint16_t min_delay,
                                                 tBTM_INQ_RESULTS_CB *p_results_cb);
 
 
@@ -2273,7 +2273,7 @@
 **                  BTM_PERIODIC_INQUIRY_ACTIVE if a periodic inquiry is active
 **
 *******************************************************************************/
-extern UINT16 BTM_IsInquiryActive (void);
+extern uint16_t BTM_IsInquiryActive (void);
 
 
 /*******************************************************************************
@@ -2318,8 +2318,8 @@
 **                  BTM_WRONG_MODE if the device is not up.
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_SetConnectability (UINT16 page_mode, UINT16 window,
-                                          UINT16 interval);
+extern tBTM_STATUS BTM_SetConnectability (uint16_t page_mode, uint16_t window,
+                                          uint16_t interval);
 
 
 /*******************************************************************************
@@ -2334,7 +2334,7 @@
 ** Returns          BTM_NON_CONNECTABLE or BTM_CONNECTABLE
 **
 *******************************************************************************/
-extern UINT16 BTM_ReadConnectability (UINT16 *p_window, UINT16 *p_interval);
+extern uint16_t BTM_ReadConnectability (uint16_t *p_window, uint16_t *p_interval);
 
 
 /*******************************************************************************
@@ -2353,7 +2353,7 @@
 **                  BTM_WRONG_MODE if the device is not up.
 **
 *******************************************************************************/
-extern tBTM_STATUS  BTM_SetInquiryMode (UINT8 mode);
+extern tBTM_STATUS  BTM_SetInquiryMode (uint8_t mode);
 
 /*******************************************************************************
 **
@@ -2369,7 +2369,7 @@
 **                  BTM_WRONG_MODE if the device is not up.
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_SetInquiryScanType (UINT16 scan_type);
+extern tBTM_STATUS BTM_SetInquiryScanType (uint16_t scan_type);
 
 /*******************************************************************************
 **
@@ -2386,7 +2386,7 @@
 **
 *******************************************************************************/
 
-extern tBTM_STATUS BTM_SetPageScanType (UINT16 scan_type);
+extern tBTM_STATUS BTM_SetPageScanType (uint16_t scan_type);
 
 /*******************************************************************************
 **
@@ -2443,9 +2443,9 @@
 **
 *******************************************************************************/
 extern tBTM_STATUS BTM_ReadRemoteVersion (BD_ADDR addr,
-                                          UINT8 *lmp_version,
-                                          UINT16 *manufacturer,
-                                          UINT16 *lmp_sub_version);
+                                          uint8_t *lmp_version,
+                                          uint16_t *manufacturer,
+                                          uint16_t *lmp_sub_version);
 
 /*******************************************************************************
 **
@@ -2460,7 +2460,7 @@
 ** Returns          pointer to the remote supported features mask
 **
 *******************************************************************************/
-extern UINT8 *BTM_ReadRemoteFeatures (BD_ADDR addr);
+extern uint8_t *BTM_ReadRemoteFeatures (BD_ADDR addr);
 
 /*******************************************************************************
 **
@@ -2479,7 +2479,7 @@
 **                  or NULL if page_number is not valid
 **
 *******************************************************************************/
-extern UINT8 *BTM_ReadRemoteExtendedFeatures (BD_ADDR addr, UINT8 page_number);
+extern uint8_t *BTM_ReadRemoteExtendedFeatures (BD_ADDR addr, uint8_t page_number);
 
 /*******************************************************************************
 **
@@ -2491,7 +2491,7 @@
 ** Returns          number of features pages read from the remote device
 **
 *******************************************************************************/
-extern UINT8 BTM_ReadNumberRemoteFeaturesPages (BD_ADDR addr);
+extern uint8_t BTM_ReadNumberRemoteFeaturesPages (BD_ADDR addr);
 
 /*******************************************************************************
 **
@@ -2506,7 +2506,7 @@
 **                  BTM_FEATURE_BYTES_PER_PAGE * (BTM_EXT_FEATURES_PAGE_MAX + 1).
 **
 *******************************************************************************/
-extern UINT8 *BTM_ReadAllRemoteFeatures (BD_ADDR addr);
+extern uint8_t *BTM_ReadAllRemoteFeatures (BD_ADDR addr);
 
 /*******************************************************************************
 **
@@ -2610,7 +2610,7 @@
 ** Returns          Pointer to matching record, or NULL
 **
 *******************************************************************************/
-extern tSDP_DISC_REC *BTM_FindAttribute (UINT16 attr_id,
+extern tSDP_DISC_REC *BTM_FindAttribute (uint16_t attr_id,
                                          tSDP_DISC_REC *p_start_rec);
 
 
@@ -2625,7 +2625,7 @@
 ** Returns          Pointer to matching record, or NULL
 **
 *******************************************************************************/
-extern tSDP_DISC_REC *BTM_FindService (UINT16 service_uuid,
+extern tSDP_DISC_REC *BTM_FindService (uint16_t service_uuid,
                                        tSDP_DISC_REC *p_start_rec);
 
 
@@ -2640,8 +2640,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_SetDiscoveryParams (UINT16 num_uuid, tSDP_UUID *p_uuid_list,
-                                    UINT16 num_attr, UINT16 *p_attr_list);
+extern void BTM_SetDiscoveryParams (uint16_t num_uuid, tSDP_UUID *p_uuid_list,
+                                    uint16_t num_attr, uint16_t *p_attr_list);
 
 
 /*****************************************************************************
@@ -2657,7 +2657,7 @@
 **
 *******************************************************************************/
 extern tBTM_STATUS BTM_SetLinkPolicy (BD_ADDR remote_bda,
-                                      UINT16 *settings);
+                                      uint16_t *settings);
 
 /*******************************************************************************
 **
@@ -2669,7 +2669,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_SetDefaultLinkPolicy (UINT16 settings);
+extern void BTM_SetDefaultLinkPolicy (uint16_t settings);
 
 
 /*******************************************************************************
@@ -2682,7 +2682,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_SetDefaultLinkSuperTout (UINT16 timeout);
+extern void BTM_SetDefaultLinkSuperTout (uint16_t timeout);
 
 
 /*******************************************************************************
@@ -2695,7 +2695,7 @@
 **
 *******************************************************************************/
 extern tBTM_STATUS BTM_SetLinkSuperTout (BD_ADDR remote_bda,
-                                         UINT16 timeout);
+                                         uint16_t timeout);
 /*******************************************************************************
 **
 ** Function         BTM_GetLinkSuperTout
@@ -2706,7 +2706,7 @@
 **
 *******************************************************************************/
 extern tBTM_STATUS BTM_GetLinkSuperTout (BD_ADDR remote_bda,
-                                         UINT16 *p_timeout);
+                                         uint16_t *p_timeout);
 
 /*******************************************************************************
 **
@@ -2715,10 +2715,10 @@
 ** Description      This function is called to check if an ACL connection exists
 **                  to a specific remote BD Address.
 **
-** Returns          TRUE if connection is up, else FALSE.
+** Returns          true if connection is up, else false.
 **
 *******************************************************************************/
-extern BOOLEAN BTM_IsAclConnectionUp (BD_ADDR remote_bda, tBT_TRANSPORT transport);
+extern bool    BTM_IsAclConnectionUp (BD_ADDR remote_bda, tBT_TRANSPORT transport);
 
 
 /*******************************************************************************
@@ -2732,7 +2732,7 @@
 **                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_GetRole (BD_ADDR remote_bd_addr, UINT8 *p_role);
+extern tBTM_STATUS BTM_GetRole (BD_ADDR remote_bd_addr, uint8_t *p_role);
 
 
 
@@ -2753,7 +2753,7 @@
 **
 *******************************************************************************/
 extern tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr,
-                                   UINT8 new_role,
+                                   uint8_t new_role,
                                    tBTM_CMPL_CB *p_cb);
 
 /*******************************************************************************
@@ -2817,7 +2817,7 @@
 ** Returns          BTM_SUCCESS if successfully registered, otherwise error
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_RegBusyLevelNotif (tBTM_BL_CHANGE_CB *p_cb, UINT8 *p_level,
+extern tBTM_STATUS BTM_RegBusyLevelNotif (tBTM_BL_CHANGE_CB *p_cb, uint8_t *p_level,
                                           tBTM_BL_EVENT_MASK evt_mask);
 
 /*******************************************************************************
@@ -2839,10 +2839,10 @@
 ** Description      This function is called to count the number of
 **                  ACL links that are active.
 **
-** Returns          UINT16  Number of active ACL links
+** Returns          uint16_t Number of active ACL links
 **
 *******************************************************************************/
-extern UINT16 BTM_GetNumAclLinks (void);
+extern uint16_t BTM_GetNumAclLinks (void);
 
 /*******************************************************************************
 **
@@ -2865,7 +2865,7 @@
 ** Function         BTM_CreateSco
 **
 ** Description      This function is called to create an SCO connection. If the
-**                  "is_orig" flag is TRUE, the connection will be originated,
+**                  "is_orig" flag is true, the connection will be originated,
 **                  otherwise BTM will wait for the other side to connect.
 **
 ** Returns          BTM_UNKNOWN_ADDR if the ACL connection is not up
@@ -2877,8 +2877,8 @@
 **                                   with the sco index used for the connection.
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, BOOLEAN is_orig,
-                                  UINT16 pkt_types, UINT16 *p_sco_inx,
+extern tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, bool    is_orig,
+                                  uint16_t pkt_types, uint16_t *p_sco_inx,
                                   tBTM_SCO_CB *p_conn_cb,
                                   tBTM_SCO_CB *p_disc_cb);
 
@@ -2892,7 +2892,7 @@
 ** Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_RemoveSco (UINT16 sco_inx);
+extern tBTM_STATUS BTM_RemoveSco (uint16_t sco_inx);
 
 
 /*******************************************************************************
@@ -2915,7 +2915,7 @@
 ** Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_SetScoPacketTypes (UINT16 sco_inx, UINT16 pkt_types);
+extern tBTM_STATUS BTM_SetScoPacketTypes (uint16_t sco_inx, uint16_t pkt_types);
 
 
 /*******************************************************************************
@@ -2936,7 +2936,7 @@
 ** Returns          packet types supported for the connection
 **
 *******************************************************************************/
-extern UINT16 BTM_ReadScoPacketTypes (UINT16 sco_inx);
+extern uint16_t BTM_ReadScoPacketTypes (uint16_t sco_inx);
 
 
 /*******************************************************************************
@@ -2949,7 +2949,7 @@
 ** Returns          packet types supported by the device.
 **
 *******************************************************************************/
-extern UINT16 BTM_ReadDeviceScoPacketTypes (void);
+extern uint16_t BTM_ReadDeviceScoPacketTypes (void);
 
 
 /*******************************************************************************
@@ -2962,7 +2962,7 @@
 ** Returns          handle for the connection, or 0xFFFF if invalid SCO index.
 **
 *******************************************************************************/
-extern UINT16 BTM_ReadScoHandle (UINT16 sco_inx);
+extern uint16_t BTM_ReadScoHandle (uint16_t sco_inx);
 
 
 /*******************************************************************************
@@ -2975,7 +2975,7 @@
 ** Returns          pointer to BD address or NULL if not known
 **
 *******************************************************************************/
-extern UINT8 *BTM_ReadScoBdAddr (UINT16 sco_inx);
+extern uint8_t *BTM_ReadScoBdAddr (uint16_t sco_inx);
 
 
 /*******************************************************************************
@@ -2989,7 +2989,7 @@
 ** Returns          HCI reason or BTM_INVALID_SCO_DISC_REASON if not set.
 **
 *******************************************************************************/
-extern UINT16 BTM_ReadScoDiscReason (void);
+extern uint16_t BTM_ReadScoDiscReason (void);
 
 
 /*******************************************************************************
@@ -3034,7 +3034,7 @@
 **                  BTM_ILLEGAL_VALUE if there is an illegal sco_inx
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_RegForEScoEvts (UINT16 sco_inx,
+extern tBTM_STATUS BTM_RegForEScoEvts (uint16_t sco_inx,
                                        tBTM_ESCO_CBACK *p_esco_cback);
 
 /*******************************************************************************
@@ -3058,7 +3058,7 @@
 **                      1.2 specification.
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_ReadEScoLinkParms (UINT16 sco_inx,
+extern tBTM_STATUS BTM_ReadEScoLinkParms (uint16_t sco_inx,
                                           tBTM_ESCO_DATA *p_parms);
 
 /*******************************************************************************
@@ -3080,7 +3080,7 @@
 **                      1.2 specification.
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_ChangeEScoLinkParms (UINT16 sco_inx,
+extern tBTM_STATUS BTM_ChangeEScoLinkParms (uint16_t sco_inx,
                                             tBTM_CHG_ESCO_PARAMS *p_parms);
 
 /*******************************************************************************
@@ -3101,7 +3101,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_EScoConnRsp (UINT16 sco_inx, UINT8 hci_status,
+extern void BTM_EScoConnRsp (uint16_t sco_inx, uint8_t hci_status,
                              tBTM_ESCO_PARAMS *p_parms);
 
 /*******************************************************************************
@@ -3110,10 +3110,10 @@
 **
 ** Description      This function returns the number of active SCO links.
 **
-** Returns          UINT8
+** Returns          uint8_t
 **
 *******************************************************************************/
-extern UINT8 BTM_GetNumScoLinks (void);
+extern uint8_t BTM_GetNumScoLinks (void);
 
 /*****************************************************************************
 **  SECURITY MANAGEMENT FUNCTIONS
@@ -3126,10 +3126,10 @@
 **                  security services.  There can be one and only one application
 **                  saving link keys.  BTM allows only first registration.
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-extern BOOLEAN BTM_SecRegister (tBTM_APPL_INFO *p_cb_info);
+extern bool    BTM_SecRegister (tBTM_APPL_INFO *p_cb_info);
 
 /*******************************************************************************
 **
@@ -3138,10 +3138,10 @@
 ** Description      Profiles can register to be notified when a new Link Key
 **                  is generated per connection.
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-extern BOOLEAN BTM_SecRegisterLinkKeyNotificationCallback(
+extern bool    BTM_SecRegisterLinkKeyNotificationCallback(
                                                         tBTM_LINK_KEY_CALLBACK *p_callback);
 
 /*******************************************************************************
@@ -3151,10 +3151,10 @@
 ** Description      Profiles can register to be notified when name of the
 **                  remote device is resolved (up to BTM_SEC_MAX_RMT_NAME_CALLBACKS).
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-extern BOOLEAN BTM_SecAddRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback);
+extern bool    BTM_SecAddRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback);
 
 
 /*******************************************************************************
@@ -3164,10 +3164,10 @@
 ** Description      A profile can deregister notification when a new Link Key
 **                  is generated per connection.
 **
-** Returns          TRUE if OK, else FALSE
+** Returns          true if OK, else false
 **
 *******************************************************************************/
-extern BOOLEAN BTM_SecDeleteRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback);
+extern bool    BTM_SecDeleteRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback);
 
 /*******************************************************************************
 **
@@ -3175,10 +3175,10 @@
 **
 ** Description      Get security flags for the device
 **
-** Returns          BOOLEAN TRUE or FALSE is device found
+** Returns          bool    true or false is device found
 **
 *******************************************************************************/
-extern BOOLEAN BTM_GetSecurityFlags (BD_ADDR bd_addr, UINT8 * p_sec_flags);
+extern bool    BTM_GetSecurityFlags (BD_ADDR bd_addr, uint8_t * p_sec_flags);
 
 /*******************************************************************************
 **
@@ -3190,11 +3190,11 @@
 **                  p_sec_flags : Out parameter to be filled with security flags for the connection
 **                  transport :  Physical transport of the connection (BR/EDR or LE)
 **
-** Returns          BOOLEAN TRUE or FALSE is device found
+** Returns          bool    true or false is device found
 **
 *******************************************************************************/
-extern BOOLEAN BTM_GetSecurityFlagsByTransport (BD_ADDR bd_addr,
-                                                UINT8 * p_sec_flags, tBT_TRANSPORT transport);
+extern bool    BTM_GetSecurityFlagsByTransport (BD_ADDR bd_addr,
+                                                uint8_t * p_sec_flags, tBT_TRANSPORT transport);
 
 /*******************************************************************************
 **
@@ -3206,7 +3206,7 @@
 **                  otherwise, the trusted mask
 **
 *******************************************************************************/
-extern UINT32 * BTM_ReadTrustedMask (BD_ADDR bd_addr);
+extern uint32_t * BTM_ReadTrustedMask (BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
@@ -3217,7 +3217,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_SetPinType (UINT8 pin_type, PIN_CODE pin_code, UINT8 pin_code_len);
+extern void BTM_SetPinType (uint8_t pin_type, PIN_CODE pin_code, uint8_t pin_code_len);
 
 
 /*******************************************************************************
@@ -3226,15 +3226,15 @@
 **
 ** Description      Enable or disable pairing
 **
-** Parameters       allow_pairing - (TRUE or FALSE) whether or not the device
+** Parameters       allow_pairing - (true or false) whether or not the device
 **                      allows pairing.
-**                  connect_only_paired - (TRUE or FALSE) whether or not to
+**                  connect_only_paired - (true or false) whether or not to
 **                      only allow paired devices to connect.
 **
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_SetPairableMode (BOOLEAN allow_pairing, BOOLEAN connect_only_paired);
+extern void BTM_SetPairableMode (bool    allow_pairing, bool    connect_only_paired);
 
 /*******************************************************************************
 **
@@ -3242,16 +3242,16 @@
 **
 ** Description      Enable or disable default treatment for Mode 4 Level 0 services
 **
-** Parameter        secure_connections_only_mode - (TRUE or FALSE)
-**                  TRUE means that the device should treat Mode 4 Level 0 services as
+** Parameter        secure_connections_only_mode - (true or false)
+**                  true means that the device should treat Mode 4 Level 0 services as
 **                  services of other levels.
-**                  FALSE means that the device should provide default treatment for
+**                  false means that the device should provide default treatment for
 **                  Mode 4 Level 0 services.
 **
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_SetSecureConnectionsOnly (BOOLEAN secure_connections_only_mode);
+extern void BTM_SetSecureConnectionsOnly (bool    secure_connections_only_mode);
 
 /*******************************************************************************
 **
@@ -3262,13 +3262,13 @@
 **                  security level that is used.  This API is called once for originators
 **                  nad again for acceptors of connections.
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-extern BOOLEAN BTM_SetSecurityLevel (BOOLEAN is_originator, const char *p_name,
-                                     UINT8 service_id, UINT16 sec_level,
-                                     UINT16 psm, UINT32 mx_proto_id,
-                                     UINT32 mx_chan_id);
+extern bool    BTM_SetSecurityLevel (bool    is_originator, const char *p_name,
+                                     uint8_t service_id, uint16_t sec_level,
+                                     uint16_t psm, uint32_t mx_proto_id,
+                                     uint32_t mx_chan_id);
 
 /*******************************************************************************
 **
@@ -3280,7 +3280,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_SetOutService(BD_ADDR bd_addr, UINT8 service_id, UINT32 mx_chan_id);
+extern void BTM_SetOutService(BD_ADDR bd_addr, uint8_t service_id, uint32_t mx_chan_id);
 
 /*******************************************************************************
 **
@@ -3295,7 +3295,7 @@
 ** Returns          Number of records that were freed.
 **
 *******************************************************************************/
-extern UINT8 BTM_SecClrService (UINT8 service_id);
+extern uint8_t BTM_SecClrService (uint8_t service_id);
 
 /*******************************************************************************
 **
@@ -3306,13 +3306,13 @@
 **                  stored in the NVRAM.
 **                  dev_class, bd_name, link_key, and features are NULL if unknown
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-extern BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class,
-                                 BD_NAME bd_name, UINT8 *features,
-                                 UINT32 trusted_mask[], LINK_KEY link_key,
-                                 UINT8 key_type, tBTM_IO_CAP io_cap, UINT8 pin_length);
+extern bool    BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class,
+                                 BD_NAME bd_name, uint8_t *features,
+                                 uint32_t trusted_mask[], LINK_KEY link_key,
+                                 uint8_t key_type, tBTM_IO_CAP io_cap, uint8_t pin_length);
 
 
 /*******************************************************************************
@@ -3321,10 +3321,10 @@
 **
 ** Description      Free resources associated with the device.
 **
-** Returns          TRUE if rmoved OK, FALSE if not found
+** Returns          true if rmoved OK, false if not found
 **
 *******************************************************************************/
-extern BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr);
+extern bool    BTM_SecDeleteDevice (BD_ADDR bd_addr);
 
 
 /*******************************************************************************
@@ -3371,13 +3371,13 @@
 **                  res          - result of the operation BTM_SUCCESS if success
 **                  pin_len      - length in bytes of the PIN Code
 **                  p_pin        - pointer to array with the PIN Code
-**                  trusted_mask - bitwise OR of trusted services (array of UINT32)
+**                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
 **
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len,
-                              UINT8 *p_pin, UINT32 trusted_mask[]);
+extern void BTM_PINCodeReply (BD_ADDR bd_addr, uint8_t res, uint8_t pin_len,
+                              uint8_t *p_pin, uint32_t trusted_mask[]);
 
 
 /*******************************************************************************
@@ -3389,14 +3389,14 @@
 ** Parameters:      bd_addr      - Address of the device to bond
 **                  pin_len      - length in bytes of the PIN Code
 **                  p_pin        - pointer to array with the PIN Code
-**                  trusted_mask - bitwise OR of trusted services (array of UINT32)
+**                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
 
 ** Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
 **
 *******************************************************************************/
 extern tBTM_STATUS BTM_SecBond (BD_ADDR bd_addr,
-                                UINT8 pin_len, UINT8 *p_pin,
-                                UINT32 trusted_mask[]);
+                                uint8_t pin_len, uint8_t *p_pin,
+                                uint32_t trusted_mask[]);
 
 /*******************************************************************************
 **
@@ -3407,7 +3407,7 @@
 ** Parameters:      bd_addr      - Address of the device to bond
 **                  pin_len      - length in bytes of the PIN Code
 **                  p_pin        - pointer to array with the PIN Code
-**                  trusted_mask - bitwise OR of trusted services (array of UINT32)
+**                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
 **                  transport :  Physical transport to use for bonding (BR/EDR or LE)
 **
 ** Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
@@ -3415,8 +3415,8 @@
 *******************************************************************************/
 extern tBTM_STATUS BTM_SecBondByTransport (BD_ADDR bd_addr,
                                            tBT_TRANSPORT transport,
-                                           UINT8 pin_len, UINT8 *p_pin,
-                                           UINT32 trusted_mask[]);
+                                           uint8_t pin_len, uint8_t *p_pin,
+                                           uint32_t trusted_mask[]);
 
 /*******************************************************************************
 **
@@ -3486,7 +3486,7 @@
 **                  passkey       - numeric value in the range of 0 - 999999(0xF423F).
 **
 *******************************************************************************/
-extern void BTM_PasskeyReqReply(tBTM_STATUS res, BD_ADDR bd_addr, UINT32 passkey);
+extern void BTM_PasskeyReqReply(tBTM_STATUS res, BD_ADDR bd_addr, uint32_t passkey);
 
 /*******************************************************************************
 **
@@ -3565,8 +3565,8 @@
 ** Returns          Number of bytes in p_data.
 **
 *******************************************************************************/
-extern UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
-                               BT_OCTET16 r, UINT8 name_len);
+extern uint16_t BTM_BuildOobData(uint8_t *p_data, uint16_t max_len, BT_OCTET16 c,
+                               BT_OCTET16 r, uint8_t name_len);
 
 /*******************************************************************************
 **
@@ -3577,12 +3577,12 @@
 **
 ** Parameters:      bd_addr - address of the peer
 **
-** Returns          TRUE if BR/EDR Secure Connections are supported by both local
+** Returns          true if BR/EDR Secure Connections are supported by both local
 **                  and the remote device.
-**                  else FALSE.
+**                  else false.
 **
 *******************************************************************************/
-extern BOOLEAN BTM_BothEndsSupportSecureConnections(BD_ADDR bd_addr);
+extern bool    BTM_BothEndsSupportSecureConnections(BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
@@ -3593,11 +3593,11 @@
 **
 ** Parameters:      bd_addr - address of the peer
 **
-** Returns          TRUE if BR/EDR Secure Connections are supported by the peer,
-**                  else FALSE.
+** Returns          true if BR/EDR Secure Connections are supported by the peer,
+**                  else false.
 **
 *******************************************************************************/
-extern BOOLEAN BTM_PeerSupportsSecureConnections(BD_ADDR bd_addr);
+extern bool    BTM_PeerSupportsSecureConnections(BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
@@ -3614,7 +3614,7 @@
 **                  NULL, if the tag is not found.
 **
 *******************************************************************************/
-extern UINT8 * BTM_ReadOobData(UINT8 *p_data, UINT8 eir_tag, UINT8 *p_len);
+extern uint8_t * BTM_ReadOobData(uint8_t *p_data, uint8_t eir_tag, uint8_t *p_len);
 
 /*******************************************************************************
 **
@@ -3643,7 +3643,7 @@
 **                  BTM_ILLEGAL_VALUE
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_PmRegister (UINT8 mask, UINT8 *p_pm_id,
+extern tBTM_STATUS BTM_PmRegister (uint8_t mask, uint8_t *p_pm_id,
                                    tBTM_PM_STATUS_CBACK *p_cb);
 
 
@@ -3658,7 +3658,7 @@
 **                  BTM_UNKNOWN_ADDR if bd addr is not active or bad
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_SetPowerMode (UINT8 pm_id, BD_ADDR remote_bda,
+extern tBTM_STATUS BTM_SetPowerMode (uint8_t pm_id, BD_ADDR remote_bda,
                                      tBTM_PM_PWR_MD *p_mode);
 
 
@@ -3703,8 +3703,8 @@
 **                  BTM_CMD_STORED if the command is stored
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_SetSsrParams (BD_ADDR remote_bda, UINT16 max_lat,
-                                     UINT16 min_rmt_to, UINT16 min_loc_to);
+extern tBTM_STATUS BTM_SetSsrParams (BD_ADDR remote_bda, uint16_t max_lat,
+                                     uint16_t min_rmt_to, uint16_t min_loc_to);
 
 /*******************************************************************************
 **
@@ -3716,7 +3716,7 @@
 ** Returns          the handle of the connection, or 0xFFFF if none.
 **
 *******************************************************************************/
-extern UINT16 BTM_GetHCIConnHandle (BD_ADDR remote_bda, tBT_TRANSPORT transport);
+extern uint16_t BTM_GetHCIConnHandle (BD_ADDR remote_bda, tBT_TRANSPORT transport);
 
 /*******************************************************************************
 **
@@ -3761,7 +3761,7 @@
 ** Returns          pointer of EIR data
 **
 *******************************************************************************/
-extern UINT8 *BTM_CheckEirData( UINT8 *p_eir, UINT8 type, UINT8 *p_length );
+extern uint8_t *BTM_CheckEirData( uint8_t *p_eir, uint8_t type, uint8_t *p_length );
 
 /*******************************************************************************
 **
@@ -3772,11 +3772,11 @@
 ** Parameters       p_eir_uuid - bit map of UUID list
 **                  uuid16 - UUID 16-bit
 **
-** Returns          TRUE - if found
-**                  FALSE - if not found
+** Returns          true - if found
+**                  false - if not found
 **
 *******************************************************************************/
-extern BOOLEAN BTM_HasEirService( UINT32 *p_eir_uuid, UINT16 uuid16 );
+extern bool    BTM_HasEirService( uint32_t *p_eir_uuid, uint16_t uuid16 );
 
 /*******************************************************************************
 **
@@ -3793,7 +3793,7 @@
 **
 *******************************************************************************/
 extern tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService( tBTM_INQ_RESULTS *p_results,
-                                                        UINT16 uuid16 );
+                                                        uint16_t uuid16 );
 
 /*******************************************************************************
 **
@@ -3807,7 +3807,7 @@
 ** Returns          None
 **
 *******************************************************************************/
-extern void BTM_AddEirService( UINT32 *p_eir_uuid, UINT16 uuid16 );
+extern void BTM_AddEirService( uint32_t *p_eir_uuid, uint16_t uuid16 );
 
 /*******************************************************************************
 **
@@ -3821,7 +3821,7 @@
 ** Returns          None
 **
 *******************************************************************************/
-extern void BTM_RemoveEirService( UINT32 *p_eir_uuid, UINT16 uuid16 );
+extern void BTM_RemoveEirService( uint32_t *p_eir_uuid, uint16_t uuid16 );
 
 /*******************************************************************************
 **
@@ -3838,8 +3838,8 @@
 **                  BTM_EIR_COMPLETE_16BITS_UUID_TYPE, otherwise
 **
 *******************************************************************************/
-extern UINT8 BTM_GetEirSupportedServices( UINT32 *p_eir_uuid,    UINT8 **p,
-                                          UINT8  max_num_uuid16, UINT8 *p_num_uuid16);
+extern uint8_t BTM_GetEirSupportedServices( uint32_t *p_eir_uuid,    uint8_t **p,
+                                          uint8_t max_num_uuid16, uint8_t *p_num_uuid16);
 
 /*******************************************************************************
 **
@@ -3862,8 +3862,8 @@
 **                  BTM_EIR_MORE_128BITS_UUID_TYPE
 **
 *******************************************************************************/
-extern UINT8 BTM_GetEirUuidList( UINT8 *p_eir, UINT8 uuid_size, UINT8 *p_num_uuid,
-                                 UINT8 *p_uuid_list, UINT8 max_num_uuid);
+extern uint8_t BTM_GetEirUuidList( uint8_t *p_eir, uint8_t uuid_size, uint8_t *p_num_uuid,
+                                 uint8_t *p_uuid_list, uint8_t max_num_uuid);
 
 /*****************************************************************************
 **  SCO OVER HCI
@@ -3895,7 +3895,7 @@
 extern tBTM_STATUS BTM_ConfigScoPath (tBTM_SCO_ROUTE_TYPE path,
                                       tBTM_SCO_DATA_CB *p_sco_data_cb,
                                       tBTM_SCO_PCM_PARAM *p_pcm_param,
-                                      BOOLEAN err_data_rpt);
+                                      bool    err_data_rpt);
 
 /*******************************************************************************
 **
@@ -3918,7 +3918,7 @@
 **
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_WriteScoData (UINT16 sco_inx, BT_HDR *p_buf);
+extern tBTM_STATUS BTM_WriteScoData (uint16_t sco_inx, BT_HDR *p_buf);
 
 /*******************************************************************************
 **
@@ -3929,7 +3929,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_SetARCMode (UINT8 iface, UINT8 arc_mode, tBTM_VSC_CMPL_CB *p_arc_cb);
+extern void BTM_SetARCMode (uint8_t iface, uint8_t arc_mode, tBTM_VSC_CMPL_CB *p_arc_cb);
 
 
 /*******************************************************************************
@@ -3941,7 +3941,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_PCM2Setup_Write (BOOLEAN clk_master, tBTM_VSC_CMPL_CB *p_arc_cb);
+extern void BTM_PCM2Setup_Write (bool    clk_master, tBTM_VSC_CMPL_CB *p_arc_cb);
 
 
 /*******************************************************************************
diff --git a/stack/include/btm_ble_api.h b/stack/include/btm_ble_api.h
index bc66425..a5e4627 100644
--- a/stack/include/btm_ble_api.h
+++ b/stack/include/btm_ble_api.h
@@ -35,7 +35,7 @@
 #endif
 
 #define CHNL_MAP_LEN    5
-typedef UINT8 tBTM_BLE_CHNL_MAP[CHNL_MAP_LEN];
+typedef uint8_t tBTM_BLE_CHNL_MAP[CHNL_MAP_LEN];
 
 /* 0x00-0x04 only used for set advertising parameter command */
 #define BTM_BLE_CONNECT_EVT     0x00   /* 0x00-0x04 only used for set advertising
@@ -52,28 +52,28 @@
 
 #define BTM_BLE_UNKNOWN_EVT     0xff
 
-typedef UINT8 tBTM_BLE_EVT;
-typedef UINT8 tBTM_BLE_CONN_MODE;
+typedef uint8_t tBTM_BLE_EVT;
+typedef uint8_t tBTM_BLE_CONN_MODE;
 
-typedef UINT32 tBTM_BLE_REF_VALUE;
+typedef uint32_t tBTM_BLE_REF_VALUE;
 
 #define BTM_BLE_SCAN_MODE_PASS      0
 #define BTM_BLE_SCAN_MODE_ACTI      1
 #define BTM_BLE_SCAN_MODE_NONE      0xff
-typedef UINT8 tBLE_SCAN_MODE;
+typedef uint8_t tBLE_SCAN_MODE;
 
 #define BTM_BLE_BATCH_SCAN_MODE_DISABLE 0
 #define BTM_BLE_BATCH_SCAN_MODE_PASS  1
 #define BTM_BLE_BATCH_SCAN_MODE_ACTI  2
 #define BTM_BLE_BATCH_SCAN_MODE_PASS_ACTI 3
 
-typedef UINT8 tBTM_BLE_BATCH_SCAN_MODE;
+typedef uint8_t tBTM_BLE_BATCH_SCAN_MODE;
 
 /* advertising channel map */
 #define BTM_BLE_ADV_CHNL_37    (0x01 << 0)
 #define BTM_BLE_ADV_CHNL_38    (0x01 << 1)
 #define BTM_BLE_ADV_CHNL_39    (0x01 << 2)
-typedef UINT8 tBTM_BLE_ADV_CHNL_MAP;
+typedef uint8_t tBTM_BLE_ADV_CHNL_MAP;
 
 /*d efault advertising channel map */
 #ifndef BTM_BLE_DEFAULT_ADV_CHNL_MAP
@@ -86,7 +86,7 @@
 #define AP_SCAN_ALL_CONN_WL        0x02
 #define AP_SCAN_CONN_WL            0x03
 #define AP_SCAN_CONN_POLICY_MAX    0x04
-typedef UINT8   tBTM_BLE_AFP;
+typedef uint8_t tBTM_BLE_AFP;
 
 /* default advertising filter policy */
 #ifndef BTM_BLE_DEFAULT_AFP
@@ -103,7 +103,7 @@
 #define SP_ADV_WL_RPA_DIR_ADV  0x03  /* 3: accept adv packet from device in white list, directed */
                                      /* adv pkt not directed to me is ignored except direct adv */
                                      /* with RPA */
-typedef UINT8   tBTM_BLE_SFP;
+typedef uint8_t tBTM_BLE_SFP;
 
 #ifndef BTM_BLE_DEFAULT_SFP
 #define BTM_BLE_DEFAULT_SFP   SP_ADV_ALL
@@ -205,7 +205,7 @@
 
 #define BTM_CMAC_TLEN_SIZE          8                   /* 64 bits */
 #define BTM_BLE_AUTH_SIGN_LEN       12                   /* BLE data signature length 8 Bytes + 4 bytes counter*/
-typedef UINT8 BLE_SIGNATURE[BTM_BLE_AUTH_SIGN_LEN];         /* Device address */
+typedef uint8_t BLE_SIGNATURE[BTM_BLE_AUTH_SIGN_LEN];         /* Device address */
 
 #ifndef BTM_BLE_HOST_SUPPORT
 #define BTM_BLE_HOST_SUPPORT        0x01
@@ -270,10 +270,10 @@
 /* Structure returned with Rand/Encrypt complete callback */
 typedef struct
 {
-    UINT8   status;
-    UINT8   param_len;
-    UINT16  opcode;
-    UINT8   param_buf[BT_OCTET16_LEN];
+    uint8_t status;
+    uint8_t param_len;
+    uint16_t opcode;
+    uint8_t param_buf[BT_OCTET16_LEN];
 } tBTM_RAND_ENC;
 
 /* General callback function for notifying an application that a synchronous
@@ -318,7 +318,7 @@
 #define BTM_BLE_AD_BIT_PROPRIETARY     (0x00000001 << 15)
 #define BTM_BLE_AD_BIT_SERVICE_128      (0x00000001 << 16)      /*128-bit Service UUIDs*/
 
-typedef  UINT32  tBTM_BLE_AD_MASK;
+typedef  uint32_t tBTM_BLE_AD_MASK;
 
 #define BTM_BLE_AD_TYPE_FLAG            HCI_EIR_FLAGS_TYPE                  /* 0x01 */
 #define BTM_BLE_AD_TYPE_16SRV_PART      HCI_EIR_MORE_16BITS_UUID_TYPE       /* 0x02 */
@@ -346,7 +346,7 @@
 #define BTM_BLE_AD_TYPE_128SERVICE_DATA 0x1d
 
 #define BTM_BLE_AD_TYPE_MANU            HCI_EIR_MANUFACTURER_SPECIFIC_TYPE      /* 0xff */
-typedef UINT8   tBTM_BLE_AD_TYPE;
+typedef uint8_t tBTM_BLE_AD_TYPE;
 
 /*  Security settings used with L2CAP LE COC */
 #define BTM_SEC_LE_LINK_ENCRYPTED           0x01
@@ -369,30 +369,30 @@
 #define BTM_BLE_ADV_TX_POWER_MID        2           /* middle tx power  */
 #define BTM_BLE_ADV_TX_POWER_UPPER      3           /* upper tx power   */
 #define BTM_BLE_ADV_TX_POWER_MAX        4           /* maximum tx power */
-typedef UINT8 tBTM_BLE_ADV_TX_POWER;
+typedef uint8_t tBTM_BLE_ADV_TX_POWER;
 
 /* adv tx power in dBm */
 typedef struct
 {
-    UINT8 adv_inst_max;         /* max adv instance supported in controller */
-    UINT8 rpa_offloading;
-    UINT16 tot_scan_results_strg;
-    UINT8 max_irk_list_sz;
-    UINT8 filter_support;
-    UINT8 max_filter;
-    UINT8 energy_support;
-    BOOLEAN values_read;
-    UINT16 version_supported;
-    UINT16 total_trackable_advertisers;
-    UINT8 extended_scan_support;
-    UINT8 debug_logging_supported;
+    uint8_t adv_inst_max;         /* max adv instance supported in controller */
+    uint8_t rpa_offloading;
+    uint16_t tot_scan_results_strg;
+    uint8_t max_irk_list_sz;
+    uint8_t filter_support;
+    uint8_t max_filter;
+    uint8_t energy_support;
+    bool    values_read;
+    uint16_t version_supported;
+    uint16_t total_trackable_advertisers;
+    uint8_t extended_scan_support;
+    uint8_t debug_logging_supported;
 }tBTM_BLE_VSC_CB;
 
 /* slave preferred connection interval range */
 typedef struct
 {
-    UINT16  low;
-    UINT16  hi;
+    uint16_t low;
+    uint16_t hi;
 
 }tBTM_BLE_INT_RANGE;
 
@@ -400,55 +400,55 @@
 #define MAX_16BIT_SERVICES 16
 typedef struct
 {
-    UINT8       num_service;
-    BOOLEAN     list_cmpl;
-    UINT16      uuid[MAX_16BIT_SERVICES];
+    uint8_t     num_service;
+    bool        list_cmpl;
+    uint16_t    uuid[MAX_16BIT_SERVICES];
 }tBTM_BLE_SERVICE;
 
 /* 32 bits Service supported in the device */
 #define MAX_32BIT_SERVICES 4
 typedef struct
 {
-    UINT8       num_service;
-    BOOLEAN     list_cmpl;
-    UINT32      uuid[MAX_32BIT_SERVICES];
+    uint8_t     num_service;
+    bool        list_cmpl;
+    uint32_t    uuid[MAX_32BIT_SERVICES];
 }tBTM_BLE_32SERVICE;
 
 /* 128 bits Service supported in the device */
 typedef struct
 {
-    UINT8       num_service;
-    BOOLEAN     list_cmpl;
-    UINT8       uuid128[MAX_UUID_SIZE];
+    uint8_t     num_service;
+    bool        list_cmpl;
+    uint8_t     uuid128[MAX_UUID_SIZE];
 }tBTM_BLE_128SERVICE;
 
 #define MAX_SIZE_MANUFACTURER_DATA 32
 typedef struct
 {
-    UINT8 len;
-    UINT8 val[MAX_SIZE_MANUFACTURER_DATA];
+    uint8_t len;
+    uint8_t val[MAX_SIZE_MANUFACTURER_DATA];
 }tBTM_BLE_MANU;
 
 #define MAX_SIZE_SERVICE_DATA 32
 typedef struct
 {
     tBT_UUID    service_uuid;
-    UINT8       len;
-    UINT8       val[MAX_SIZE_SERVICE_DATA];
+    uint8_t     len;
+    uint8_t     val[MAX_SIZE_SERVICE_DATA];
 }tBTM_BLE_SERVICE_DATA;
 
 #define MAX_SIZE_PROPRIETARY_ELEMENT 32
 typedef struct
 {
-    UINT8       adv_type;
-    UINT8       len;
-    UINT8       val[MAX_SIZE_PROPRIETARY_ELEMENT];     /* number of len byte */
+    uint8_t     adv_type;
+    uint8_t     len;
+    uint8_t     val[MAX_SIZE_PROPRIETARY_ELEMENT];     /* number of len byte */
 }tBTM_BLE_PROP_ELEM;
 
 #define MAX_PROPRIETARY_ELEMENTS 4
 typedef struct
 {
-    UINT8                   num_elem;
+    uint8_t                 num_elem;
     tBTM_BLE_PROP_ELEM      elem[MAX_PROPRIETARY_ELEMENTS];
 }tBTM_BLE_PROPRIETARY;
 
@@ -464,9 +464,9 @@
     tBTM_BLE_128SERVICE     sol_service_128b;    /* List of 128 bit Service Solicitation UUIDs */
     tBTM_BLE_PROPRIETARY    proprietary;
     tBTM_BLE_SERVICE_DATA   service_data;    /* service data */
-    UINT16                  appearance;
-    UINT8                   flag;
-    UINT8                   tx_power;
+    uint16_t                appearance;
+    uint8_t                 flag;
+    uint8_t                 tx_power;
 }tBTM_BLE_ADV_DATA;
 
 #ifndef BTM_BLE_MULTI_ADV_MAX
@@ -480,15 +480,15 @@
 #define BTM_BLE_MULTI_ADV_DISABLE_EVT       2
 #define BTM_BLE_MULTI_ADV_PARAM_EVT         3
 #define BTM_BLE_MULTI_ADV_DATA_EVT          4
-typedef UINT8 tBTM_BLE_MULTI_ADV_EVT;
+typedef uint8_t tBTM_BLE_MULTI_ADV_EVT;
 
 #define BTM_BLE_MULTI_ADV_DEFAULT_STD 0
 
 typedef struct
 {
-    UINT16          adv_int_min;
-    UINT16          adv_int_max;
-    UINT8           adv_type;
+    uint16_t        adv_int_min;
+    uint16_t        adv_int_max;
+    uint8_t         adv_type;
     tBTM_BLE_ADV_CHNL_MAP channel_map;
     tBTM_BLE_AFP    adv_filter_policy;
     tBTM_BLE_ADV_TX_POWER tx_power;
@@ -496,30 +496,30 @@
 
 typedef struct
 {
-    UINT8   *p_sub_code; /* dynamic array to store sub code */
-    UINT8   *p_inst_id;  /* dynamic array to store instance id */
-    UINT8   pending_idx;
-    UINT8   next_idx;
+    uint8_t *p_sub_code; /* dynamic array to store sub code */
+    uint8_t *p_inst_id;  /* dynamic array to store instance id */
+    uint8_t pending_idx;
+    uint8_t next_idx;
 }tBTM_BLE_MULTI_ADV_OPQ;
 
-typedef void (tBTM_BLE_MULTI_ADV_CBACK)(tBTM_BLE_MULTI_ADV_EVT evt, UINT8 inst_id,
+typedef void (tBTM_BLE_MULTI_ADV_CBACK)(tBTM_BLE_MULTI_ADV_EVT evt, uint8_t inst_id,
                 void *p_ref, tBTM_STATUS status);
 
 typedef struct
 {
-    UINT8                       inst_id;
-    BOOLEAN                     in_use;
-    UINT8                       adv_evt;
+    uint8_t                     inst_id;
+    bool                        in_use;
+    uint8_t                     adv_evt;
     BD_ADDR                     rpa;
     alarm_t                     *adv_raddr_timer;
     tBTM_BLE_MULTI_ADV_CBACK    *p_cback;
     void                        *p_ref;
-    UINT8                       index;
+    uint8_t                     index;
 }tBTM_BLE_MULTI_ADV_INST;
 
 typedef struct
 {
-    UINT8 inst_index_queue[BTM_BLE_MULTI_ADV_MAX];
+    uint8_t inst_index_queue[BTM_BLE_MULTI_ADV_MAX];
     int front;
     int rear;
 }tBTM_BLE_MULTI_ADV_INST_IDX_Q;
@@ -530,13 +530,13 @@
     tBTM_BLE_MULTI_ADV_OPQ  op_q;
 }tBTM_BLE_MULTI_ADV_CB;
 
-typedef UINT8 tGATT_IF;
+typedef uint8_t tGATT_IF;
 
 typedef void (tBTM_BLE_SCAN_THRESHOLD_CBACK)(tBTM_BLE_REF_VALUE ref_value);
-typedef void (tBTM_BLE_SCAN_REP_CBACK)(tBTM_BLE_REF_VALUE ref_value, UINT8 report_format,
-                                       UINT8 num_records, UINT16 total_len,
-                                       UINT8* p_rep_data, UINT8 status);
-typedef void (tBTM_BLE_SCAN_SETUP_CBACK)(UINT8 evt, tBTM_BLE_REF_VALUE ref_value, UINT8 status);
+typedef void (tBTM_BLE_SCAN_REP_CBACK)(tBTM_BLE_REF_VALUE ref_value, uint8_t report_format,
+                                       uint8_t num_records, uint16_t total_len,
+                                       uint8_t* p_rep_data, uint8_t status);
+typedef void (tBTM_BLE_SCAN_SETUP_CBACK)(uint8_t evt, tBTM_BLE_REF_VALUE ref_value, uint8_t status);
 
 #ifndef BTM_BLE_BATCH_SCAN_MAX
 #define BTM_BLE_BATCH_SCAN_MAX   5
@@ -560,34 +560,34 @@
     BTM_BLE_DISCARD_OLD_ITEMS,
     BTM_BLE_DISCARD_LOWER_RSSI_ITEMS
 };
-typedef UINT8 tBTM_BLE_DISCARD_RULE;
+typedef uint8_t tBTM_BLE_DISCARD_RULE;
 
 typedef struct
 {
-    UINT8   sub_code[BTM_BLE_BATCH_SCAN_MAX];
+    uint8_t sub_code[BTM_BLE_BATCH_SCAN_MAX];
     tBTM_BLE_BATCH_SCAN_STATE cur_state[BTM_BLE_BATCH_SCAN_MAX];
     tBTM_BLE_REF_VALUE        ref_value[BTM_BLE_BATCH_SCAN_MAX];
-    UINT8   pending_idx;
-    UINT8   next_idx;
+    uint8_t pending_idx;
+    uint8_t next_idx;
 }tBTM_BLE_BATCH_SCAN_OPQ;
 
 typedef struct
 {
-    UINT8   rep_mode[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
+    uint8_t rep_mode[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
     tBTM_BLE_REF_VALUE  ref_value[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
-    UINT8   num_records[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
-    UINT16  data_len[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
-    UINT8   *p_data[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
-    UINT8   pending_idx;
-    UINT8   next_idx;
+    uint8_t num_records[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
+    uint16_t data_len[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
+    uint8_t *p_data[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
+    uint8_t pending_idx;
+    uint8_t next_idx;
 }tBTM_BLE_BATCH_SCAN_REP_Q;
 
 typedef struct
 {
     tBTM_BLE_BATCH_SCAN_STATE      cur_state;
     tBTM_BLE_BATCH_SCAN_MODE scan_mode;
-    UINT32                  scan_interval;
-    UINT32                  scan_window;
+    uint32_t                scan_interval;
+    uint32_t                scan_window;
     tBLE_ADDR_TYPE          addr_type;
     tBTM_BLE_DISCARD_RULE   discard_rule;
     tBTM_BLE_BATCH_SCAN_OPQ  op_q;
@@ -623,19 +623,19 @@
 #define BTM_BLE_PF_STR_LEN_MAX      29  /* match for first 29 bytes */
 #endif
 
-typedef UINT8   tBTM_BLE_PF_COND_TYPE;
+typedef uint8_t tBTM_BLE_PF_COND_TYPE;
 
 #define BTM_BLE_PF_LOGIC_OR              0
 #define BTM_BLE_PF_LOGIC_AND             1
-typedef UINT8 tBTM_BLE_PF_LOGIC_TYPE;
+typedef uint8_t tBTM_BLE_PF_LOGIC_TYPE;
 
 #define BTM_BLE_PF_ENABLE       1
 #define BTM_BLE_PF_CONFIG       2
-typedef UINT8 tBTM_BLE_PF_ACTION;
+typedef uint8_t tBTM_BLE_PF_ACTION;
 
-typedef UINT8 tBTM_BLE_PF_FILT_INDEX;
+typedef uint8_t tBTM_BLE_PF_FILT_INDEX;
 
-typedef UINT8 tBTM_BLE_PF_AVBL_SPACE;
+typedef uint8_t tBTM_BLE_PF_AVBL_SPACE;
 
 #define BTM_BLE_PF_BRDCAST_ADDR_FILT  1
 #define BTM_BLE_PF_SERV_DATA_CHG_FILT 2
@@ -644,21 +644,21 @@
 #define BTM_BLE_PF_LOC_NAME_CHECK    16
 #define BTM_BLE_PF_MANUF_NAME_CHECK  32
 #define BTM_BLE_PF_SERV_DATA_CHECK   64
-typedef UINT16 tBTM_BLE_PF_FEAT_SEL;
+typedef uint16_t tBTM_BLE_PF_FEAT_SEL;
 
 #define BTM_BLE_PF_LIST_LOGIC_OR   1
 #define BTM_BLE_PF_LIST_LOGIC_AND  2
-typedef UINT16 tBTM_BLE_PF_LIST_LOGIC_TYPE;
+typedef uint16_t tBTM_BLE_PF_LIST_LOGIC_TYPE;
 
 #define BTM_BLE_PF_FILT_LOGIC_OR   0
 #define BTM_BLE_PF_FILT_LOGIC_AND  1
-typedef UINT16 tBTM_BLE_PF_FILT_LOGIC_TYPE;
+typedef uint16_t tBTM_BLE_PF_FILT_LOGIC_TYPE;
 
-typedef UINT8  tBTM_BLE_PF_RSSI_THRESHOLD;
-typedef UINT8  tBTM_BLE_PF_DELIVERY_MODE;
-typedef UINT16 tBTM_BLE_PF_TIMEOUT;
-typedef UINT8  tBTM_BLE_PF_TIMEOUT_CNT;
-typedef UINT16 tBTM_BLE_PF_ADV_TRACK_ENTRIES;
+typedef uint8_t tBTM_BLE_PF_RSSI_THRESHOLD;
+typedef uint8_t tBTM_BLE_PF_DELIVERY_MODE;
+typedef uint16_t tBTM_BLE_PF_TIMEOUT;
+typedef uint8_t tBTM_BLE_PF_TIMEOUT_CNT;
+typedef uint16_t tBTM_BLE_PF_ADV_TRACK_ENTRIES;
 
 typedef struct
 {
@@ -680,7 +680,7 @@
     BTM_BLE_SCAN_COND_DELETE,
     BTM_BLE_SCAN_COND_CLEAR = 2
 };
-typedef UINT8 tBTM_BLE_SCAN_COND_OP;
+typedef uint8_t tBTM_BLE_SCAN_COND_OP;
 
 enum
 {
@@ -689,7 +689,7 @@
     BTM_BLE_FILT_ADV_PARAM      = 3
 };
 
-typedef UINT8 tBTM_BLE_FILT_CB_EVT;
+typedef uint8_t tBTM_BLE_FILT_CB_EVT;
 
 /* BLE adv payload filtering config complete callback */
 typedef void (tBTM_BLE_PF_CFG_CBACK)(tBTM_BLE_PF_ACTION action, tBTM_BLE_SCAN_COND_OP cfg_op,
@@ -699,7 +699,7 @@
 typedef void (tBTM_BLE_PF_CMPL_CBACK) (tBTM_BLE_PF_CFG_CBACK);
 
 /* BLE adv payload filtering status setup complete callback */
-typedef void (tBTM_BLE_PF_STATUS_CBACK) (UINT8 action, tBTM_STATUS status,
+typedef void (tBTM_BLE_PF_STATUS_CBACK) (uint8_t action, tBTM_STATUS status,
                                         tBTM_BLE_REF_VALUE ref_value);
 
 /* BLE adv payload filtering param setup complete callback */
@@ -709,9 +709,9 @@
 
 typedef union
 {
-      UINT16              uuid16_mask;
-      UINT32              uuid32_mask;
-      UINT8               uuid128_mask[LEN_UUID_128];
+      uint16_t            uuid16_mask;
+      uint32_t            uuid32_mask;
+      uint8_t             uuid128_mask[LEN_UUID_128];
 }tBTM_BLE_PF_COND_MASK;
 
 typedef struct
@@ -724,27 +724,27 @@
 
 typedef struct
 {
-    UINT8                   data_len;       /* <= 20 bytes */
-    UINT8                   *p_data;
+    uint8_t                 data_len;       /* <= 20 bytes */
+    uint8_t                 *p_data;
 }tBTM_BLE_PF_LOCAL_NAME_COND;
 
 typedef struct
 {
-    UINT16                  company_id;     /* company ID */
-    UINT8                   data_len;       /* <= 20 bytes */
-    UINT8                   *p_pattern;
-    UINT16                  company_id_mask; /* UUID value mask */
-    UINT8                   *p_pattern_mask; /* Manufacturer data matching mask,
+    uint16_t                company_id;     /* company ID */
+    uint8_t                 data_len;       /* <= 20 bytes */
+    uint8_t                 *p_pattern;
+    uint16_t                company_id_mask; /* UUID value mask */
+    uint8_t                 *p_pattern_mask; /* Manufacturer data matching mask,
                                                 same length as data pattern,
                                                 set to all 0xff, match exact data */
 }tBTM_BLE_PF_MANU_COND;
 
 typedef struct
 {
-    UINT16                  uuid;     /* service ID */
-    UINT8                   data_len;       /* <= 20 bytes */
-    UINT8                   *p_pattern;
-    UINT8                   *p_pattern_mask; /* Service data matching mask, same length as data pattern,
+    uint16_t                uuid;     /* service ID */
+    uint8_t                 data_len;       /* <= 20 bytes */
+    uint8_t                 *p_pattern;
+    uint8_t                 *p_pattern_mask; /* Service data matching mask, same length as data pattern,
                                                 set to all 0xff, match exact data */
 }tBTM_BLE_PF_SRVC_PATTERN_COND;
 
@@ -761,13 +761,13 @@
 
 typedef struct
 {
-    UINT8   action_ocf[BTM_BLE_PF_TYPE_MAX];
+    uint8_t action_ocf[BTM_BLE_PF_TYPE_MAX];
     tBTM_BLE_REF_VALUE  ref_value[BTM_BLE_PF_TYPE_MAX];
     tBTM_BLE_PF_PARAM_CBACK  *p_filt_param_cback[BTM_BLE_PF_TYPE_MAX];
     tBTM_BLE_PF_CFG_CBACK *p_scan_cfg_cback[BTM_BLE_PF_TYPE_MAX];
-    UINT8   cb_evt[BTM_BLE_PF_TYPE_MAX];
-    UINT8   pending_idx;
-    UINT8   next_idx;
+    uint8_t cb_evt[BTM_BLE_PF_TYPE_MAX];
+    uint8_t pending_idx;
+    uint8_t next_idx;
 }tBTM_BLE_ADV_FILTER_ADV_OPQ;
 
 #define BTM_BLE_MAX_FILTER_COUNTER  (BTM_BLE_MAX_ADDR_FILTER + 1) /* per device filter + one generic filter indexed by 0 */
@@ -778,15 +778,15 @@
 
 typedef struct
 {
-    BOOLEAN    in_use;
+    bool       in_use;
     BD_ADDR    bd_addr;
-    UINT8      pf_counter[BTM_BLE_PF_TYPE_MAX]; /* number of filter indexed by tBTM_BLE_PF_COND_TYPE */
+    uint8_t    pf_counter[BTM_BLE_PF_TYPE_MAX]; /* number of filter indexed by tBTM_BLE_PF_COND_TYPE */
 }tBTM_BLE_PF_COUNT;
 
 typedef struct
 {
-    BOOLEAN             enable;
-    UINT8               op_type;
+    bool                enable;
+    uint8_t             op_type;
     tBTM_BLE_PF_COUNT   *p_addr_filter_count; /* per BDA filter array */
     tBLE_BD_ADDR        cur_filter_target;
     tBTM_BLE_PF_STATUS_CBACK *p_filt_stat_cback;
@@ -804,22 +804,22 @@
 #define BTM_BLE_META_PF_SRVC_DATA       0x07
 #define BTM_BLE_META_PF_ALL             0x08
 
-typedef UINT8 BTM_BLE_ADV_STATE;
-typedef UINT8 BTM_BLE_ADV_INFO_PRESENT;
-typedef UINT8 BTM_BLE_RSSI_VALUE;
-typedef UINT16 BTM_BLE_ADV_INFO_TIMESTAMP;
+typedef uint8_t BTM_BLE_ADV_STATE;
+typedef uint8_t BTM_BLE_ADV_INFO_PRESENT;
+typedef uint8_t BTM_BLE_RSSI_VALUE;
+typedef uint16_t BTM_BLE_ADV_INFO_TIMESTAMP;
 
 /* These are the fields returned in each device adv packet.  It
 ** is returned in the results callback if registered.
 */
 typedef struct
 {
-    UINT8               conn_mode;
+    uint8_t             conn_mode;
     tBTM_BLE_AD_MASK    ad_mask;        /* mask of the valid adv data field */
-    UINT8               flag;
-    UINT8               tx_power_level;
-    UINT8               remote_name_len;
-    UINT8               *p_remote_name;
+    uint8_t             flag;
+    uint8_t             tx_power_level;
+    uint8_t             remote_name_len;
+    uint8_t             *p_remote_name;
     tBTM_BLE_SERVICE    service;
 } tBTM_BLE_INQ_DATA;
 
@@ -829,7 +829,7 @@
     BTM_BLE_CONN_AUTO,
     BTM_BLE_CONN_SELECTIVE
 };
-typedef UINT8   tBTM_BLE_CONN_TYPE;
+typedef uint8_t tBTM_BLE_CONN_TYPE;
 
 #define ADV_INFO_PRESENT        0x00
 #define NO_ADV_INFO_PRESENT     0x01
@@ -838,7 +838,7 @@
 
 typedef void (tBTM_BLE_TRACK_ADV_CBACK)(tBTM_BLE_TRACK_ADV_DATA *p_track_adv_data);
 
-typedef UINT8 tBTM_BLE_TRACK_ADV_EVT;
+typedef uint8_t tBTM_BLE_TRACK_ADV_EVT;
 
 typedef struct
 {
@@ -852,7 +852,7 @@
     BTM_BLE_TRACK_ADV_REMOVE
 };
 
-typedef UINT8 tBTM_BLE_TRACK_ADV_ACTION;
+typedef uint8_t tBTM_BLE_TRACK_ADV_ACTION;
 
 #define BTM_BLE_MULTI_ADV_INVALID   0
 
@@ -863,12 +863,12 @@
 #define BTM_BLE_BATCH_SCAN_PARAM_EVT      5
 #define BTM_BLE_BATCH_SCAN_DISABLE_EVT    6
 
-typedef UINT8 tBTM_BLE_BATCH_SCAN_EVT;
+typedef uint8_t tBTM_BLE_BATCH_SCAN_EVT;
 
-typedef UINT32 tBTM_BLE_TX_TIME_MS;
-typedef UINT32 tBTM_BLE_RX_TIME_MS;
-typedef UINT32 tBTM_BLE_IDLE_TIME_MS;
-typedef UINT32 tBTM_BLE_ENERGY_USED;
+typedef uint32_t tBTM_BLE_TX_TIME_MS;
+typedef uint32_t tBTM_BLE_RX_TIME_MS;
+typedef uint32_t tBTM_BLE_IDLE_TIME_MS;
+typedef uint32_t tBTM_BLE_ENERGY_USED;
 
 typedef void (tBTM_BLE_ENERGY_INFO_CBACK)(tBTM_BLE_TX_TIME_MS tx_time, tBTM_BLE_RX_TIME_MS rx_time,
                                           tBTM_BLE_IDLE_TIME_MS idle_time,
@@ -880,16 +880,16 @@
     tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback;
 }tBTM_BLE_ENERGY_INFO_CB;
 
-typedef BOOLEAN (tBTM_BLE_SEL_CBACK)(BD_ADDR random_bda,     UINT8 *p_remote_name);
+typedef bool    (tBTM_BLE_SEL_CBACK)(BD_ADDR random_bda,     uint8_t *p_remote_name);
 typedef void (tBTM_BLE_CTRL_FEATURES_CBACK)(tBTM_STATUS status);
 
 /* callback function for SMP signing algorithm, signed data in little endian order with tlen bits long */
-typedef void (tBTM_BLE_SIGN_CBACK)(void *p_ref_data, UINT8 *p_signing_data);
-typedef void (tBTM_BLE_VERIFY_CBACK)(void *p_ref_data, BOOLEAN match);
+typedef void (tBTM_BLE_SIGN_CBACK)(void *p_ref_data, uint8_t *p_signing_data);
+typedef void (tBTM_BLE_VERIFY_CBACK)(void *p_ref_data, bool    match);
 /* random address set complete callback */
 typedef void (tBTM_BLE_RANDOM_SET_CBACK) (BD_ADDR random_bda);
 
-typedef void (tBTM_BLE_SCAN_REQ_CBACK)(BD_ADDR remote_bda, tBLE_ADDR_TYPE addr_type, UINT8 adv_evt);
+typedef void (tBTM_BLE_SCAN_REQ_CBACK)(BD_ADDR remote_bda, tBLE_ADDR_TYPE addr_type, uint8_t adv_evt);
 typedef void (*tBLE_SCAN_PARAM_SETUP_CBACK)(tGATT_IF client_if, tBTM_STATUS status);
 
 tBTM_BLE_SCAN_SETUP_CBACK bta_ble_scan_setup_cb;
@@ -910,10 +910,10 @@
 **                  dev_type         - Remote device's device type.
 **                  addr_type        - LE device address type.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-extern BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name,
+extern bool    BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name,
                                            tBT_DEVICE_TYPE dev_type, tBLE_ADDR_TYPE addr_type);
 
 /*******************************************************************************
@@ -928,10 +928,10 @@
 **                  p_le_key         - LE key values.
 **                  key_type         - LE SMP key type.
 *
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-extern BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key,
+extern bool    BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key,
                                  tBTM_LE_KEY_TYPE key_type);
 
 /*******************************************************************************
@@ -945,7 +945,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max,
+extern tBTM_STATUS BTM_BleSetAdvParams(uint16_t adv_int_min, uint16_t adv_int_max,
                                        tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP chnl_map);
 
 /*******************************************************************************
@@ -976,7 +976,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max,
+extern void BTM_BleReadAdvParams (uint16_t *adv_int_min, uint16_t *adv_int_max,
                                   tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP *p_chnl_map);
 
 /*******************************************************************************
@@ -1007,8 +1007,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_BleSetScanParams(tGATT_IF client_if, UINT32 scan_interval,
-                                 UINT32 scan_window, tBLE_SCAN_MODE scan_type,
+extern void BTM_BleSetScanParams(tGATT_IF client_if, uint32_t scan_interval,
+                                 uint32_t scan_window, tBLE_SCAN_MODE scan_type,
                                  tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback);
 
 /*******************************************************************************
@@ -1029,9 +1029,9 @@
 **
 ** Description      This function is called to setup storage configuration and setup callbacks.
 **
-** Parameters       UINT8 batch_scan_full_max -Batch scan full maximum
-                    UINT8 batch_scan_trunc_max - Batch scan truncated value maximum
-                    UINT8 batch_scan_notify_threshold - Threshold value
+** Parameters       uint8_t batch_scan_full_max -Batch scan full maximum
+                    uint8_t batch_scan_trunc_max - Batch scan truncated value maximum
+                    uint8_t batch_scan_notify_threshold - Threshold value
                     tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback - Setup callback
                     tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback -Threshold callback
                     void *p_ref - Reference value
@@ -1039,9 +1039,9 @@
 ** Returns          tBTM_STATUS
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_BleSetStorageConfig(UINT8 batch_scan_full_max,
-                                        UINT8 batch_scan_trunc_max,
-                                        UINT8 batch_scan_notify_threshold,
+extern tBTM_STATUS BTM_BleSetStorageConfig(uint8_t batch_scan_full_max,
+                                        uint8_t batch_scan_trunc_max,
+                                        uint8_t batch_scan_notify_threshold,
                                         tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback,
                                         tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback,
                                         tBTM_BLE_SCAN_REP_CBACK* p_cback,
@@ -1054,8 +1054,8 @@
 ** Description      This function is called to enable batch scan
 **
 ** Parameters       tBTM_BLE_BATCH_SCAN_MODE scan_mode - Batch scan mode
-                    UINT32 scan_interval -Scan interval
-                    UINT32 scan_window - Scan window value
+                    uint32_t scan_interval -Scan interval
+                    uint32_t scan_window - Scan window value
                     tBLE_ADDR_TYPE addr_type - Address type
                     tBTM_BLE_DISCARD_RULE discard_rule - Data discard rules
 **
@@ -1063,7 +1063,7 @@
 **
 *******************************************************************************/
 extern tBTM_STATUS BTM_BleEnableBatchScan(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
-                                        UINT32 scan_interval, UINT32 scan_window,
+                                        uint32_t scan_interval, uint32_t scan_window,
                                         tBTM_BLE_DISCARD_RULE discard_rule,
                                         tBLE_ADDR_TYPE addr_type,
                                         tBTM_BLE_REF_VALUE ref_value);
@@ -1137,7 +1137,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT8 duration,
+extern tBTM_STATUS BTM_BleObserve(bool    start, uint8_t duration,
                                   tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb);
 
 
@@ -1192,7 +1192,7 @@
 ** Returns          None
 **
 *******************************************************************************/
-extern void BTM_SecurityGrant(BD_ADDR bd_addr, UINT8 res);
+extern void BTM_SecurityGrant(BD_ADDR bd_addr, uint8_t res);
 
 /*******************************************************************************
 **
@@ -1207,7 +1207,7 @@
 **                  BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
 **
 *******************************************************************************/
-extern void BTM_BlePasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey);
+extern void BTM_BlePasskeyReply (BD_ADDR bd_addr, uint8_t res, uint32_t passkey);
 
 /*******************************************************************************
 **
@@ -1221,7 +1221,7 @@
 **                  res          - comparison result BTM_SUCCESS if success
 **
 *******************************************************************************/
-extern void BTM_BleConfirmReply (BD_ADDR bd_addr, UINT8 res);
+extern void BTM_BleConfirmReply (BD_ADDR bd_addr, uint8_t res);
 
 /*******************************************************************************
 **
@@ -1235,7 +1235,7 @@
 **                  p_data      - simple pairing Randomizer  C.
 **
 *******************************************************************************/
-extern void BTM_BleOobDataReply(BD_ADDR bd_addr, UINT8 res, UINT8 len, UINT8 *p_data);
+extern void BTM_BleOobDataReply(BD_ADDR bd_addr, uint8_t res, uint8_t len, uint8_t *p_data);
 
 
 /*******************************************************************************
@@ -1251,10 +1251,10 @@
 **                  signature: output parameter where data signature is going to
 **                             be stored.
 **
-** Returns          TRUE if signing sucessul, otherwise FALSE.
+** Returns          true if signing sucessul, otherwise false.
 **
 *******************************************************************************/
-extern BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
+extern bool    BTM_BleDataSignature (BD_ADDR bd_addr, uint8_t *p_text, uint16_t len,
                                      BLE_SIGNATURE signature);
 
 /*******************************************************************************
@@ -1269,12 +1269,12 @@
 **                  counter: counter used when doing data signing
 **                  p_comp: signature to be compared against.
 
-** Returns          TRUE if signature verified correctly; otherwise FALSE.
+** Returns          true if signature verified correctly; otherwise false.
 **
 *******************************************************************************/
-extern BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig,
-                                       UINT16 len, UINT32 counter,
-                                       UINT8 *p_comp);
+extern bool    BTM_BleVerifySignature (BD_ADDR bd_addr, uint8_t *p_orig,
+                                       uint16_t len, uint32_t counter,
+                                       uint8_t *p_comp);
 
 /*******************************************************************************
 **
@@ -1301,7 +1301,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern BOOLEAN BTM_ReadRemoteConnectionAddr(BD_ADDR pseudo_addr,
+extern bool    BTM_ReadRemoteConnectionAddr(BD_ADDR pseudo_addr,
                                                     BD_ADDR conn_addr,
                                                     tBLE_ADDR_TYPE *p_addr_type);
 
@@ -1318,7 +1318,7 @@
 ** Returns          non2.
 **
 *******************************************************************************/
-extern void BTM_BleLoadLocalKeys(UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key);
+extern void BTM_BleLoadLocalKeys(uint8_t key_type, tBTM_BLE_LOCAL_KEYS *p_key);
 
 
 /*******************************************************************************
@@ -1335,7 +1335,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE   conn_type,
+extern bool    BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE   conn_type,
                                     tBTM_BLE_SEL_CBACK   *p_select_cback);
 
 /*******************************************************************************
@@ -1347,13 +1347,13 @@
 *                   procedure is decided by the background connection type, it can be
 *                   auto connection, or selective connection.
 **
-** Parameters       add_remove: TRUE to add; FALSE to remove.
+** Parameters       add_remove: true to add; false to remove.
 **                  remote_bda: device address to add/remove.
 **
 ** Returns          void
 **
 *******************************************************************************/
-extern BOOLEAN BTM_BleUpdateBgConnDev(BOOLEAN add_remove, BD_ADDR   remote_bda);
+extern bool    BTM_BleUpdateBgConnDev(bool    add_remove, BD_ADDR   remote_bda);
 
 /*******************************************************************************
 **
@@ -1389,8 +1389,8 @@
 **
 *******************************************************************************/
 extern  void BTM_BleSetPrefConnParams (BD_ADDR bd_addr,
-                                               UINT16 min_conn_int,  UINT16 max_conn_int,
-                                               UINT16 slave_latency, UINT16 supervision_tout);
+                                               uint16_t min_conn_int,  uint16_t max_conn_int,
+                                               uint16_t slave_latency, uint16_t supervision_tout);
 
 /******************************************************************************
 **
@@ -1404,7 +1404,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern  void BTM_BleSetConnScanParams (UINT32 scan_interval, UINT32 scan_window);
+extern  void BTM_BleSetConnScanParams (uint32_t scan_interval, uint32_t scan_window);
 
 /******************************************************************************
 **
@@ -1432,7 +1432,7 @@
 ** Returns          pointer of ADV data
 **
 *******************************************************************************/
-extern  UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length);
+extern  uint8_t *BTM_CheckAdvData( uint8_t *p_adv, uint8_t type, uint8_t *p_length);
 
 /*******************************************************************************
 **
@@ -1445,7 +1445,7 @@
 **                     BTM_BLE_GENRAL_DISCOVERABLE
 **
 *******************************************************************************/
-UINT16 BTM_BleReadDiscoverability();
+uint16_t BTM_BleReadDiscoverability();
 
 /*******************************************************************************
 **
@@ -1457,7 +1457,7 @@
 ** Returns          BTM_BLE_NON_CONNECTABLE or BTM_BLE_CONNECTABLE
 **
 *******************************************************************************/
-extern UINT16 BTM_BleReadConnectability ();
+extern uint16_t BTM_BleReadConnectability ();
 
 /*******************************************************************************
 **
@@ -1485,10 +1485,10 @@
 ** Parameter        remote_bda: remote device address, carry out the transport address
 **                  transport: active transport
 **
-** Return           TRUE if an active link is identified; FALSE otherwise
+** Return           true if an active link is identified; false otherwise
 **
 *******************************************************************************/
-extern BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda,
+extern bool    BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda,
                                                  tBT_TRANSPORT transport);
 
 /*******************************************************************************
@@ -1502,7 +1502,7 @@
 ** Returns          status.
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_BleBroadcast(BOOLEAN start);
+extern tBTM_STATUS BTM_BleBroadcast(bool    start);
 
 /*******************************************************************************
 **
@@ -1511,12 +1511,12 @@
 ** Description      This function is called to enable or disable the privacy in
 **                  the local device.
 **
-** Parameters       enable: TRUE to enable it; FALSE to disable it.
+** Parameters       enable: true to enable it; false to disable it.
 **
-** Returns          BOOLEAN privacy mode set success; otherwise failed.
+** Returns          bool    privacy mode set success; otherwise failed.
 **
 *******************************************************************************/
-extern BOOLEAN BTM_BleConfigPrivacy(BOOLEAN enable);
+extern bool    BTM_BleConfigPrivacy(bool    enable);
 
 /*******************************************************************************
 **
@@ -1524,10 +1524,10 @@
 **
 ** Description        Checks if local device supports private address
 **
-** Returns          Return TRUE if local privacy is enabled else FALSE
+** Returns          Return true if local privacy is enabled else false
 **
 *******************************************************************************/
-extern BOOLEAN BTM_BleLocalPrivacyEnabled(void);
+extern bool    BTM_BleLocalPrivacyEnabled(void);
 
 /*******************************************************************************
 **
@@ -1541,7 +1541,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTM_BleEnableMixedPrivacyMode(BOOLEAN mixed_on);
+extern void BTM_BleEnableMixedPrivacyMode(bool    mixed_on);
 
 /*******************************************************************************
 **
@@ -1552,7 +1552,7 @@
 ** Returns          Max multi adv instance count
 **
 *******************************************************************************/
-extern UINT8  BTM_BleMaxMultiAdvInstanceCount();
+extern uint8_t BTM_BleMaxMultiAdvInstanceCount();
 
 /*******************************************************************************
 **
@@ -1579,13 +1579,13 @@
 **                  remote device.
 **
 ** Parameters       bd_addr: remote device address.
-**                  privacy_on: TRUE to enable it; FALSE to disable it.
+**                  privacy_on: true to enable it; false to disable it.
 **
 ** Returns          void
 **
 *******************************************************************************/
 extern void BTM_BleTurnOnPrivacyOnRemote(BD_ADDR bd_addr,
-                                                 BOOLEAN privacy_on);
+                                                 bool    privacy_on);
 
 /*******************************************************************************
 **
@@ -1596,7 +1596,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern BOOLEAN BTM_BleUpdateAdvWhitelist(BOOLEAN add_remove, BD_ADDR emote_bda);
+extern bool    BTM_BleUpdateAdvWhitelist(bool    add_remove, BD_ADDR emote_bda);
 
 /*******************************************************************************
 **
@@ -1620,7 +1620,7 @@
 **               p_cmd_cmpl_cback - Command Complete callback
 **
 *******************************************************************************/
-void BTM_BleReceiverTest(UINT8 rx_freq, tBTM_CMPL_CB *p_cmd_cmpl_cback);
+void BTM_BleReceiverTest(uint8_t rx_freq, tBTM_CMPL_CB *p_cmd_cmpl_cback);
 
 
 /*******************************************************************************
@@ -1635,8 +1635,8 @@
 **                       p_cmd_cmpl_cback - Command Complete callback
 **
 *******************************************************************************/
-void BTM_BleTransmitterTest(UINT8 tx_freq, UINT8 test_data_len,
-                                 UINT8 packet_payload, tBTM_CMPL_CB *p_cmd_cmpl_cback);
+void BTM_BleTransmitterTest(uint8_t tx_freq, uint8_t test_data_len,
+                                 uint8_t packet_payload, tBTM_CMPL_CB *p_cmd_cmpl_cback);
 
 /*******************************************************************************
 **
@@ -1655,10 +1655,10 @@
 **
 ** Description      This function is to select the underneath physical link to use.
 **
-** Returns          TRUE to use LE, FALSE use BR/EDR.
+** Returns          true to use LE, false use BR/EDR.
 **
 *******************************************************************************/
-extern BOOLEAN BTM_UseLeLink (BD_ADDR bd_addr);
+extern bool    BTM_UseLeLink (BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
@@ -1667,12 +1667,12 @@
 ** Description      Enable/Disable BLE functionality on stack regarless controller
 **                  capability.
 **
-** Parameters:      enable: TRUE to enable, FALSE to disable.
+** Parameters:      enable: true to enable, false to disable.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_BleStackEnable (BOOLEAN enable);
+extern tBTM_STATUS BTM_BleStackEnable (bool    enable);
 
 /*******************************************************************************
 **
@@ -1681,12 +1681,12 @@
 ** Description      This function is called to get security mode 1 flags and
 **                  encryption key size for LE peer.
 **
-** Returns          BOOLEAN TRUE if LE device is found, FALSE otherwise.
+** Returns          bool    true if LE device is found, false otherwise.
 **
 *******************************************************************************/
-extern BOOLEAN BTM_GetLeSecurityState (BD_ADDR bd_addr,
-                                               UINT8 *p_le_dev_sec_flags,
-                                               UINT8 *p_le_key_size);
+extern bool    BTM_GetLeSecurityState (BD_ADDR bd_addr,
+                                               uint8_t *p_le_dev_sec_flags,
+                                               uint8_t *p_le_key_size);
 
 /*******************************************************************************
 **
@@ -1695,10 +1695,10 @@
 ** Description      This function indicates if LE security procedure is
 **                  currently running with the peer.
 **
-** Returns          BOOLEAN TRUE if security procedure is running, FALSE otherwise.
+** Returns          bool    true if security procedure is running, false otherwise.
 **
 *******************************************************************************/
-extern BOOLEAN BTM_BleSecurityProcedureIsRunning (BD_ADDR bd_addr);
+extern bool    BTM_BleSecurityProcedureIsRunning (BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
@@ -1711,7 +1711,7 @@
 ** Returns          the key size or 0 if the size can't be retrieved.
 **
 *******************************************************************************/
-extern UINT8 BTM_BleGetSupportedKeySize (BD_ADDR bd_addr);
+extern uint8_t BTM_BleGetSupportedKeySize (BD_ADDR bd_addr);
 
 /*******************************************************************************/
 /*                          Multi ADV API                                      */
@@ -1747,7 +1747,7 @@
 ** Returns          status
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_BleUpdateAdvInstParam (UINT8 inst_id, tBTM_BLE_ADV_PARAMS *p_params);
+extern tBTM_STATUS BTM_BleUpdateAdvInstParam (uint8_t inst_id, tBTM_BLE_ADV_PARAMS *p_params);
 
 /*******************************************************************************
 **
@@ -1764,7 +1764,7 @@
 ** Returns          status
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
+extern tBTM_STATUS BTM_BleCfgAdvInstData (uint8_t inst_id, bool    is_scan_rsp,
                                     tBTM_BLE_AD_MASK data_mask,
                                     tBTM_BLE_ADV_DATA *p_data);
 
@@ -1779,7 +1779,7 @@
 ** Returns          status
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_BleDisableAdvInstance (UINT8 inst_id);
+extern tBTM_STATUS BTM_BleDisableAdvInstance (uint8_t inst_id);
 
 /*******************************************************************************
 **
@@ -1828,13 +1828,13 @@
 **
 ** Description      This function is called to enable or disable the APCF feature
 **
-** Parameters       enable - TRUE - enables the APCF, FALSE - disables the APCF
+** Parameters       enable - true - enables the APCF, false - disables the APCF
 **                       ref_value - Ref value
 **
 ** Returns          tBTM_STATUS
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_BleEnableDisableFilterFeature(UINT8 enable,
+extern tBTM_STATUS BTM_BleEnableDisableFilterFeature(uint8_t enable,
                                                tBTM_BLE_PF_STATUS_CBACK *p_stat_cback,
                                                tBTM_BLE_REF_VALUE ref_value);
 
@@ -1860,7 +1860,7 @@
 ** Returns          BTM_SUCCESS if success; otherwise failed.
 **
 *******************************************************************************/
-extern tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length);
+extern tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, uint16_t tx_pdu_length);
 
 #ifdef __cplusplus
 }
diff --git a/stack/include/btu.h b/stack/include/btu.h
index 51457e7..66fef48 100644
--- a/stack/include/btu.h
+++ b/stack/include/btu.h
@@ -63,15 +63,15 @@
 ************************************
 */
 
-#if (defined(HCILP_INCLUDED) && HCILP_INCLUDED == TRUE)
+#if (HCILP_INCLUDED == TRUE)
 extern void btu_check_bt_sleep (void);
 #endif
 
 /* Functions provided by btu_hcif.c
 ************************************
 */
-extern void  btu_hcif_process_event (UINT8 controller_id, BT_HDR *p_buf);
-extern void  btu_hcif_send_cmd (UINT8 controller_id, BT_HDR *p_msg);
+extern void  btu_hcif_process_event (uint8_t controller_id, BT_HDR *p_buf);
+extern void  btu_hcif_send_cmd (uint8_t controller_id, BT_HDR *p_msg);
 
 /* Functions provided by btu_core.c
 ************************************
diff --git a/stack/include/dyn_mem.h b/stack/include/dyn_mem.h
index 2f1119b..eee8278 100644
--- a/stack/include/dyn_mem.h
+++ b/stack/include/dyn_mem.h
@@ -23,47 +23,47 @@
 **  The default for each component is to use static memory allocations.
 */
 #ifndef BTM_DYNAMIC_MEMORY
-#define BTM_DYNAMIC_MEMORY  FALSE
+#define BTM_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef SDP_DYNAMIC_MEMORY
-#define SDP_DYNAMIC_MEMORY  FALSE
+#define SDP_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef L2C_DYNAMIC_MEMORY
-#define L2C_DYNAMIC_MEMORY  FALSE
+#define L2C_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef RFC_DYNAMIC_MEMORY
-#define RFC_DYNAMIC_MEMORY  FALSE
+#define RFC_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef TCS_DYNAMIC_MEMORY
-#define TCS_DYNAMIC_MEMORY  FALSE
+#define TCS_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef BNEP_DYNAMIC_MEMORY
-#define BNEP_DYNAMIC_MEMORY FALSE
+#define BNEP_DYNAMIC_MEMORY false
 #endif
 
 #ifndef AVDT_DYNAMIC_MEMORY
-#define AVDT_DYNAMIC_MEMORY FALSE
+#define AVDT_DYNAMIC_MEMORY false
 #endif
 
 #ifndef AVCT_DYNAMIC_MEMORY
-#define AVCT_DYNAMIC_MEMORY FALSE
+#define AVCT_DYNAMIC_MEMORY false
 #endif
 
 #ifndef MCA_DYNAMIC_MEMORY
-#define MCA_DYNAMIC_MEMORY FALSE
+#define MCA_DYNAMIC_MEMORY false
 #endif
 
 #ifndef GATT_DYNAMIC_MEMORY
-#define GATT_DYNAMIC_MEMORY  FALSE
+#define GATT_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef SMP_DYNAMIC_MEMORY
-#define SMP_DYNAMIC_MEMORY  FALSE
+#define SMP_DYNAMIC_MEMORY  false
 #endif
 
 /****************************************************************************
@@ -71,71 +71,71 @@
 **  The default for each component is to use static memory allocations.
 */
 #ifndef A2D_DYNAMIC_MEMORY
-#define A2D_DYNAMIC_MEMORY  FALSE
+#define A2D_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef VDP_DYNAMIC_MEMORY
-#define VDP_DYNAMIC_MEMORY  FALSE
+#define VDP_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef AVRC_DYNAMIC_MEMORY
-#define AVRC_DYNAMIC_MEMORY FALSE
+#define AVRC_DYNAMIC_MEMORY false
 #endif
 
 #ifndef BIP_DYNAMIC_MEMORY
-#define BIP_DYNAMIC_MEMORY  FALSE
+#define BIP_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef BPP_DYNAMIC_MEMORY
-#define BPP_DYNAMIC_MEMORY  FALSE
+#define BPP_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef CTP_DYNAMIC_MEMORY
-#define CTP_DYNAMIC_MEMORY  FALSE
+#define CTP_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef FTP_DYNAMIC_MEMORY
-#define FTP_DYNAMIC_MEMORY  FALSE
+#define FTP_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef HCRP_DYNAMIC_MEMORY
-#define HCRP_DYNAMIC_MEMORY FALSE
+#define HCRP_DYNAMIC_MEMORY false
 #endif
 
 #ifndef HFP_DYNAMIC_MEMORY
-#define HFP_DYNAMIC_MEMORY  FALSE
+#define HFP_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef HID_DYNAMIC_MEMORY
-#define HID_DYNAMIC_MEMORY  FALSE
+#define HID_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef HSP2_DYNAMIC_MEMORY
-#define HSP2_DYNAMIC_MEMORY FALSE
+#define HSP2_DYNAMIC_MEMORY false
 #endif
 
 #ifndef ICP_DYNAMIC_MEMORY
-#define ICP_DYNAMIC_MEMORY  FALSE
+#define ICP_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef OPP_DYNAMIC_MEMORY
-#define OPP_DYNAMIC_MEMORY  FALSE
+#define OPP_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef PAN_DYNAMIC_MEMORY
-#define PAN_DYNAMIC_MEMORY  FALSE
+#define PAN_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef SPP_DYNAMIC_MEMORY
-#define SPP_DYNAMIC_MEMORY  FALSE
+#define SPP_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef SLIP_DYNAMIC_MEMORY
-#define SLIP_DYNAMIC_MEMORY  FALSE
+#define SLIP_DYNAMIC_MEMORY  false
 #endif
 
 #ifndef LLCP_DYNAMIC_MEMORY
-#define LLCP_DYNAMIC_MEMORY  FALSE
+#define LLCP_DYNAMIC_MEMORY  false
 #endif
 
 #endif  /* #ifdef DYN_MEM_H */
diff --git a/stack/include/gap_api.h b/stack/include/gap_api.h
index 372a165..0cd23df 100644
--- a/stack/include/gap_api.h
+++ b/stack/include/gap_api.h
@@ -95,42 +95,42 @@
 /*
 ** Callback function for connection services
 */
-typedef void (tGAP_CONN_CALLBACK) (UINT16 gap_handle, UINT16 event);
+typedef void (tGAP_CONN_CALLBACK) (uint16_t gap_handle, uint16_t event);
 
 /*
 ** Define the callback function prototypes.  Parameters are specific
 ** to each event and are described below
 */
-typedef void (tGAP_CALLBACK) (UINT16 event, void *p_data);
+typedef void (tGAP_CALLBACK) (uint16_t event, void *p_data);
 
 
 /* Definition of the GAP_FindAddrByName results structure */
 typedef struct
 {
-    UINT16       status;
+    uint16_t     status;
     BD_ADDR      bd_addr;
     tBTM_BD_NAME devname;
 } tGAP_FINDADDR_RESULTS;
 
 typedef struct
 {
-    UINT16      int_min;
-    UINT16      int_max;
-    UINT16      latency;
-    UINT16      sp_tout;
+    uint16_t    int_min;
+    uint16_t    int_max;
+    uint16_t    latency;
+    uint16_t    sp_tout;
 }tGAP_BLE_PREF_PARAM;
 
 typedef union
 {
     tGAP_BLE_PREF_PARAM     conn_param;
     BD_ADDR                 reconn_bda;
-    UINT16                  icon;
-    UINT8                   *p_dev_name;
-    UINT8                   addr_resolution;
+    uint16_t                icon;
+    uint8_t                 *p_dev_name;
+    uint8_t                 addr_resolution;
 
 }tGAP_BLE_ATTR_VALUE;
 
-typedef void (tGAP_BLE_CMPL_CBACK)(BOOLEAN status, BD_ADDR addr, UINT16 length, char *p_name);
+typedef void (tGAP_BLE_CMPL_CBACK)(bool    status, BD_ADDR addr, uint16_t length, char *p_name);
 
 
 /*****************************************************************************
@@ -148,10 +148,10 @@
 ** Returns          handle of the connection if successful, else GAP_INVALID_HANDLE
 **
 *******************************************************************************/
-extern UINT16 GAP_ConnOpen (char *p_serv_name, UINT8 service_id, BOOLEAN is_server,
-                                    BD_ADDR p_rem_bda, UINT16 psm, tL2CAP_CFG_INFO *p_cfg,
+extern uint16_t GAP_ConnOpen (char *p_serv_name, uint8_t service_id, bool    is_server,
+                                    BD_ADDR p_rem_bda, uint16_t psm, tL2CAP_CFG_INFO *p_cfg,
                                     tL2CAP_ERTM_INFO *ertm_info,
-                                    UINT16 security, UINT8 chan_mode_mask,
+                                    uint16_t security, uint8_t chan_mode_mask,
                                     tGAP_CONN_CALLBACK *p_cb, tBT_TRANSPORT transport);
 
 /*******************************************************************************
@@ -164,7 +164,7 @@
 **                  GAP_ERR_BAD_HANDLE  - invalid handle
 **
 *******************************************************************************/
-extern UINT16 GAP_ConnClose (UINT16 gap_handle);
+extern uint16_t GAP_ConnClose (uint16_t gap_handle);
 
 /*******************************************************************************
 **
@@ -179,8 +179,8 @@
 **                  GAP_NO_DATA_AVAIL   - no data available
 **
 *******************************************************************************/
-extern UINT16 GAP_ConnReadData (UINT16 gap_handle, UINT8 *p_data,
-                                        UINT16 max_len, UINT16 *p_len);
+extern uint16_t GAP_ConnReadData (uint16_t gap_handle, uint8_t *p_data,
+                                        uint16_t max_len, uint16_t *p_len);
 
 /*******************************************************************************
 **
@@ -193,7 +193,7 @@
 **
 **
 *******************************************************************************/
-extern int GAP_GetRxQueueCnt (UINT16 handle, UINT32 *p_rx_queue_count);
+extern int GAP_GetRxQueueCnt (uint16_t handle, uint32_t *p_rx_queue_count);
 
 /*******************************************************************************
 **
@@ -208,7 +208,7 @@
 **                  GAP_NO_DATA_AVAIL   - no data available
 **
 *******************************************************************************/
-extern UINT16 GAP_ConnBTRead (UINT16 gap_handle, BT_HDR **pp_buf);
+extern uint16_t GAP_ConnBTRead (uint16_t gap_handle, BT_HDR **pp_buf);
 
 /*******************************************************************************
 **
@@ -224,8 +224,8 @@
 **                  GAP_CONGESTION          - system is congested
 **
 *******************************************************************************/
-extern UINT16 GAP_ConnWriteData (UINT16 gap_handle, UINT8 *p_data,
-                                         UINT16 max_len, UINT16 *p_len);
+extern uint16_t GAP_ConnWriteData (uint16_t gap_handle, uint8_t *p_data,
+                                         uint16_t max_len, uint16_t *p_len);
 
 /*******************************************************************************
 **
@@ -237,7 +237,7 @@
 **                  GAP_ERR_BAD_HANDLE      - invalid handle
 **
 *******************************************************************************/
-extern UINT16 GAP_ConnReconfig (UINT16 gap_handle, tL2CAP_CFG_INFO *p_cfg);
+extern uint16_t GAP_ConnReconfig (uint16_t gap_handle, tL2CAP_CFG_INFO *p_cfg);
 
 /*******************************************************************************
 **
@@ -255,7 +255,7 @@
 **                  GAP_ERR_BAD_HANDLE      - invalid handle
 **
 *******************************************************************************/
-extern UINT16 GAP_ConnSetIdleTimeout (UINT16 gap_handle, UINT16 timeout);
+extern uint16_t GAP_ConnSetIdleTimeout (uint16_t gap_handle, uint16_t timeout);
 
 /*******************************************************************************
 **
@@ -268,7 +268,7 @@
 **                  GAP_ERR_BAD_HANDLE  - invalid handle
 **
 *******************************************************************************/
-extern UINT8 *GAP_ConnGetRemoteAddr (UINT16 gap_handle);
+extern uint8_t *GAP_ConnGetRemoteAddr (uint16_t gap_handle);
 
 /*******************************************************************************
 **
@@ -276,10 +276,10 @@
 **
 ** Description      Returns the remote device's MTU size.
 **
-** Returns          UINT16 - maximum size buffer that can be transmitted to the peer
+** Returns          uint16_t - maximum size buffer that can be transmitted to the peer
 **
 *******************************************************************************/
-extern UINT16 GAP_ConnGetRemMtuSize (UINT16 gap_handle);
+extern uint16_t GAP_ConnGetRemMtuSize (uint16_t gap_handle);
 
 /*******************************************************************************
 **
@@ -289,11 +289,11 @@
 **
 ** Parameters:      handle      - Handle of the connection
 **
-** Returns          UINT16      - The L2CAP channel id
+** Returns          uint16_t    - The L2CAP channel id
 **                  0, if error
 **
 *******************************************************************************/
-extern UINT16 GAP_ConnGetL2CAPCid (UINT16 gap_handle);
+extern uint16_t GAP_ConnGetL2CAPCid (uint16_t gap_handle);
 
 /*******************************************************************************
 **
@@ -305,7 +305,7 @@
 ** Returns          The new or current trace level
 **
 *******************************************************************************/
-extern UINT8 GAP_SetTraceLevel (UINT8 new_level);
+extern uint8_t GAP_SetTraceLevel (uint8_t new_level);
 
 /*******************************************************************************
 **
@@ -330,7 +330,7 @@
 ** Returns          Nothing
 **
 *******************************************************************************/
-extern void GAP_BleAttrDBUpdate(UINT16 attr_uuid, tGAP_BLE_ATTR_VALUE *p_value);
+extern void GAP_BleAttrDBUpdate(uint16_t attr_uuid, tGAP_BLE_ATTR_VALUE *p_value);
 
 
 /*******************************************************************************
@@ -340,10 +340,10 @@
 ** Description      Start a process to read a connected peripheral's preferred
 **                  connection parameters
 **
-** Returns          TRUE if read started, else FALSE if GAP is busy
+** Returns          true if read started, else false if GAP is busy
 **
 *******************************************************************************/
-extern BOOLEAN GAP_BleReadPeerPrefConnParams (BD_ADDR peer_bda);
+extern bool    GAP_BleReadPeerPrefConnParams (BD_ADDR peer_bda);
 
 /*******************************************************************************
 **
@@ -351,10 +351,10 @@
 **
 ** Description      Start a process to read a connected peripheral's device name.
 **
-** Returns          TRUE if request accepted
+** Returns          true if request accepted
 **
 *******************************************************************************/
-extern BOOLEAN GAP_BleReadPeerDevName (BD_ADDR peer_bda, tGAP_BLE_CMPL_CBACK *p_cback);
+extern bool    GAP_BleReadPeerDevName (BD_ADDR peer_bda, tGAP_BLE_CMPL_CBACK *p_cback);
 
 
 /*******************************************************************************
@@ -363,10 +363,10 @@
 **
 ** Description      Start a process to read peer address resolution capability
 **
-** Returns          TRUE if request accepted
+** Returns          true if request accepted
 **
 *******************************************************************************/
-extern BOOLEAN GAP_BleReadPeerAddressResolutionCap (BD_ADDR peer_bda,
+extern bool    GAP_BleReadPeerAddressResolutionCap (BD_ADDR peer_bda,
                                                     tGAP_BLE_CMPL_CBACK *p_cback);
 
 /*******************************************************************************
@@ -375,10 +375,10 @@
 **
 ** Description      Cancel reading a peripheral's device name.
 **
-** Returns          TRUE if request accepted
+** Returns          true if request accepted
 **
 *******************************************************************************/
-extern BOOLEAN GAP_BleCancelReadPeerDevName (BD_ADDR peer_bda);
+extern bool    GAP_BleCancelReadPeerDevName (BD_ADDR peer_bda);
 
 #endif
 
diff --git a/stack/include/gatt_api.h b/stack/include/gatt_api.h
index b2bf9d3..40302a7 100644
--- a/stack/include/gatt_api.h
+++ b/stack/include/gatt_api.h
@@ -72,7 +72,7 @@
 #define  GATT_CCC_CFG_ERR                    0xFD /* Client Characteristic Configuration Descriptor Improperly Configured */
 #define  GATT_PRC_IN_PROGRESS                0xFE /* Procedure Already in progress */
 #define  GATT_OUT_OF_RANGE                   0xFF /* Attribute value out of range */
-typedef UINT8 tGATT_STATUS;
+typedef uint8_t tGATT_STATUS;
 
 
 #define  GATT_RSP_ERROR                      0x01
@@ -116,7 +116,7 @@
 #define GATT_CONN_FAIL_ESTABLISH            HCI_ERR_CONN_FAILED_ESTABLISHMENT/* 0x03E connection fail to establish  */
 #define GATT_CONN_LMP_TIMEOUT               HCI_ERR_LMP_RESPONSE_TIMEOUT     /* 0x22 connection fail for LMP response tout */
 #define GATT_CONN_CANCEL                    L2CAP_CONN_CANCEL                /* 0x0100 L2CAP connection cancelled  */
-typedef UINT16 tGATT_DISCONN_REASON;
+typedef uint16_t tGATT_DISCONN_REASON;
 
 /* MAX GATT MTU size
 */
@@ -167,7 +167,7 @@
 #define GATT_PERM_WRITE_ENC_MITM    (1 << 6) /* bit 6 */
 #define GATT_PERM_WRITE_SIGNED      (1 << 7) /* bit 7 */
 #define GATT_PERM_WRITE_SIGNED_MITM (1 << 8) /* bit 8 */
-typedef UINT16 tGATT_PERM;
+typedef uint16_t tGATT_PERM;
 
 #define GATT_ENCRYPT_KEY_SIZE_MASK  (0xF000) /* the MS nibble of tGATT_PERM; key size 7=0; size 16=9 */
 
@@ -199,7 +199,7 @@
 #define GATT_CHAR_PROP_BIT_INDICATE     (1 << 5)
 #define GATT_CHAR_PROP_BIT_AUTH         (1 << 6)
 #define GATT_CHAR_PROP_BIT_EXT_PROP     (1 << 7)
-typedef UINT8 tGATT_CHAR_PROP;
+typedef uint8_t tGATT_CHAR_PROP;
 
 
 /* Format of the value of a characteristic. enumeration type
@@ -236,35 +236,35 @@
     GATT_FORMAT_STRUCT,         /* 0x1b Opaque structure*/
     GATT_FORMAT_MAX             /* 0x1c or above reserved */
 };
-typedef UINT8 tGATT_FORMAT;
+typedef uint8_t tGATT_FORMAT;
 
 /* Characteristic Presentation Format Descriptor value
 */
 typedef struct
 {
-    UINT16              unit;       /* as UUIUD defined by SIG */
-    UINT16              descr;       /* as UUID as defined by SIG */
+    uint16_t            unit;       /* as UUIUD defined by SIG */
+    uint16_t            descr;       /* as UUID as defined by SIG */
     tGATT_FORMAT        format;
-    INT8                exp;
-    UINT8               name_spc;   /* The name space of the description */
+    int8_t              exp;
+    uint8_t             name_spc;   /* The name space of the description */
 } tGATT_CHAR_PRES;
 
 /* Characteristic Report reference Descriptor format
 */
 typedef struct
 {
-    UINT8              rpt_id;       /* report ID */
-    UINT8              rpt_type;       /* report type */
+    uint8_t            rpt_id;       /* report ID */
+    uint8_t            rpt_type;       /* report type */
 } tGATT_CHAR_RPT_REF;
 
 
 #define GATT_VALID_RANGE_MAX_SIZE       16
 typedef struct
 {
-    UINT8                   format;
-    UINT16                  len;
-    UINT8                   lower_range[GATT_VALID_RANGE_MAX_SIZE]; /* in little endian format */
-    UINT8                   upper_range[GATT_VALID_RANGE_MAX_SIZE];
+    uint8_t                 format;
+    uint16_t                len;
+    uint8_t                 lower_range[GATT_VALID_RANGE_MAX_SIZE]; /* in little endian format */
+    uint8_t                 upper_range[GATT_VALID_RANGE_MAX_SIZE];
 } tGATT_VALID_RANGE;
 
 /* Characteristic Aggregate Format attribute value
@@ -272,8 +272,8 @@
 #define GATT_AGGR_HANDLE_NUM_MAX        10
 typedef struct
 {
-    UINT8                   num_handle;
-    UINT16                  handle_list[GATT_AGGR_HANDLE_NUM_MAX];
+    uint8_t                 num_handle;
+    uint16_t                handle_list[GATT_AGGR_HANDLE_NUM_MAX];
 } tGATT_CHAR_AGGRE;
 
 /* Characteristic descriptor: Extended Properties value
@@ -287,14 +287,14 @@
 #define GATT_CLT_CONFIG_NONE               0x0000
 #define GATT_CLT_CONFIG_NOTIFICATION       0x0001
 #define GATT_CLT_CONFIG_INDICATION         0x0002
-typedef UINT16 tGATT_CLT_CHAR_CONFIG;
+typedef uint16_t tGATT_CLT_CHAR_CONFIG;
 
 
 /* characteristic descriptor: server configuration value
 */
 #define GATT_SVR_CONFIG_NONE                     0x0000
 #define GATT_SVR_CONFIG_BROADCAST                0x0001
-typedef UINT16 tGATT_SVR_CHAR_CONFIG;
+typedef uint16_t tGATT_SVR_CHAR_CONFIG;
 
 /* Characteristic descriptor: Extended Properties value
 */
@@ -308,18 +308,18 @@
 #define GATT_AUTH_REQ_MITM              2   /* authenticated encryption */
 #define GATT_AUTH_REQ_SIGNED_NO_MITM    3
 #define GATT_AUTH_REQ_SIGNED_MITM       4
-typedef UINT8 tGATT_AUTH_REQ;
+typedef uint8_t tGATT_AUTH_REQ;
 
 /* Attribute Value structure
 */
 typedef struct
 {
-    UINT16          conn_id;
-    UINT16          handle;     /* attribute handle */
-    UINT16          offset;     /* attribute value offset, if no offfset is needed for the command, ignore it */
-    UINT16          len;        /* length of attribute value */
+    uint16_t        conn_id;
+    uint16_t        handle;     /* attribute handle */
+    uint16_t        offset;     /* attribute value offset, if no offfset is needed for the command, ignore it */
+    uint16_t        len;        /* length of attribute value */
     tGATT_AUTH_REQ  auth_req;   /*  authentication request */
-    UINT8           value[GATT_MAX_ATTR_LEN];  /* the actual attribute value */
+    uint8_t         value[GATT_MAX_ATTR_LEN];  /* the actual attribute value */
 } tGATT_VALUE;
 
 /* Union of the event data which is used in the server respond API to carry the server response information
@@ -329,7 +329,7 @@
     /* data type            member          event   */
     tGATT_VALUE             attr_value;     /* READ, HANDLE_VALUE_IND, PREPARE_WRITE */
                                             /* READ_BLOB, READ_BY_TYPE */
-    UINT16                  handle;         /* WRITE, WRITE_BLOB */
+    uint16_t                handle;         /* WRITE, WRITE_BLOB */
 
 } tGATTS_RSP;
 
@@ -337,30 +337,30 @@
 #define GATT_TRANSPORT_LE           BT_TRANSPORT_LE
 #define GATT_TRANSPORT_BR_EDR       BT_TRANSPORT_BR_EDR
 #define GATT_TRANSPORT_LE_BR_EDR    (BT_TRANSPORT_LE|BT_TRANSPORT_BR_EDR)
-typedef UINT8 tGATT_TRANSPORT;
+typedef uint8_t tGATT_TRANSPORT;
 
 #define GATT_PREP_WRITE_CANCEL   0x00
 #define GATT_PREP_WRITE_EXEC     0x01
-typedef UINT8   tGATT_EXEC_FLAG;
+typedef uint8_t tGATT_EXEC_FLAG;
 
 /* read request always based on UUID */
 typedef struct
 {
-    UINT16        handle;
-    UINT16        offset;
-    BOOLEAN       is_long;
+    uint16_t      handle;
+    uint16_t      offset;
+    bool          is_long;
     bt_gatt_db_attribute_type_t gatt_type; /* are we writing characteristic or descriptor */
 } tGATT_READ_REQ;
 
 /* write request data */
 typedef struct
 {
-    UINT16          handle;     /* attribute handle */
-    UINT16          offset;     /* attribute value offset, if no offfset is needed for the command, ignore it */
-    UINT16          len;        /* length of attribute value */
-    UINT8           value[GATT_MAX_ATTR_LEN];  /* the actual attribute value */
-    BOOLEAN         need_rsp;   /* need write response */
-    BOOLEAN         is_prep;    /* is prepare write */
+    uint16_t        handle;     /* attribute handle */
+    uint16_t        offset;     /* attribute value offset, if no offfset is needed for the command, ignore it */
+    uint16_t        len;        /* length of attribute value */
+    uint8_t         value[GATT_MAX_ATTR_LEN];  /* the actual attribute value */
+    bool            need_rsp;   /* need write response */
+    bool            is_prep;    /* is prepare write */
     bt_gatt_db_attribute_type_t gatt_type; /* are we writing characteristic or descriptor */
 } tGATT_WRITE_REQ;
 
@@ -372,12 +372,12 @@
     tGATT_WRITE_REQ        write_req;    /* write */
                                          /* prepare write */
                                          /* write blob */
-    UINT16                 handle;       /* handle value confirmation */
-    UINT16                 mtu;          /* MTU exchange request */
+    uint16_t               handle;       /* handle value confirmation */
+    uint16_t               mtu;          /* MTU exchange request */
     tGATT_EXEC_FLAG        exec_write;    /* execute write */
 } tGATTS_DATA;
 
-typedef UINT8 tGATT_SERV_IF;               /* GATT Service Interface */
+typedef uint8_t tGATT_SERV_IF;               /* GATT Service Interface */
 
 enum
 {
@@ -389,7 +389,7 @@
     GATTS_REQ_TYPE_MTU,             /* MTU exchange information */
     GATTS_REQ_TYPE_CONF             /* handle value confirmation */
 };
-typedef UINT8   tGATTS_REQ_TYPE;
+typedef uint8_t tGATTS_REQ_TYPE;
 
 
 
@@ -405,15 +405,15 @@
     GATT_DISC_CHAR_DSCPT,       /* discover characteristic descriptors of a character */
     GATT_DISC_MAX               /* maximnun discover type */
 };
-typedef UINT8   tGATT_DISC_TYPE;
+typedef uint8_t tGATT_DISC_TYPE;
 
 /* Discover parameters of different discovery types
 */
 typedef struct
 {
     tBT_UUID    service;
-    UINT16      s_handle;
-    UINT16      e_handle;
+    uint16_t    s_handle;
+    uint16_t    e_handle;
 }tGATT_DISC_PARAM;
 
 /* GATT read type enumeration
@@ -427,15 +427,15 @@
     GATT_READ_PARTIAL,
     GATT_READ_MAX
 };
-typedef UINT8 tGATT_READ_TYPE;
+typedef uint8_t tGATT_READ_TYPE;
 
 /* Read By Type Request (GATT_READ_BY_TYPE) Data
 */
 typedef struct
 {
     tGATT_AUTH_REQ      auth_req;
-    UINT16              s_handle;
-    UINT16              e_handle;
+    uint16_t            s_handle;
+    uint16_t            e_handle;
     tBT_UUID            uuid;
 } tGATT_READ_BY_TYPE;
 
@@ -445,23 +445,23 @@
 typedef struct
 {
     tGATT_AUTH_REQ          auth_req;
-    UINT16                  num_handles;                            /* number of handles to read */
-    UINT16                  handles[GATT_MAX_READ_MULTI_HANDLES];   /* handles list to be read */
+    uint16_t                num_handles;                            /* number of handles to read */
+    uint16_t                handles[GATT_MAX_READ_MULTI_HANDLES];   /* handles list to be read */
 } tGATT_READ_MULTI;
 
 /*   Read By Handle Request (GATT_READ_BY_HANDLE) data */
 typedef struct
 {
     tGATT_AUTH_REQ         auth_req;
-    UINT16                 handle;
+    uint16_t               handle;
 } tGATT_READ_BY_HANDLE;
 
 /*   READ_BT_HANDLE_Request data */
 typedef struct
 {
     tGATT_AUTH_REQ         auth_req;
-    UINT16                 handle;
-    UINT16                 offset;
+    uint16_t               handle;
+    uint16_t               offset;
 } tGATT_READ_PARTIAL;
 
 /* Read Request Data
@@ -482,15 +482,15 @@
     GATT_WRITE ,
     GATT_WRITE_PREPARE
 };
-typedef UINT8 tGATT_WRITE_TYPE;
+typedef uint8_t tGATT_WRITE_TYPE;
 
 /* Client Operation Complete Callback Data
 */
 typedef union
 {
     tGATT_VALUE          att_value;
-    UINT16               mtu;
-    UINT16               handle;
+    uint16_t             mtu;
+    uint16_t             handle;
 } tGATT_CL_COMPLETE;
 
 /* GATT client operation type, used in client callback function
@@ -503,14 +503,14 @@
 #define GATTC_OPTYPE_CONFIG               5
 #define GATTC_OPTYPE_NOTIFICATION         6
 #define GATTC_OPTYPE_INDICATION           7
-typedef UINT8 tGATTC_OPTYPE;
+typedef uint8_t tGATTC_OPTYPE;
 
 /* characteristic declaration
 */
 typedef struct
 {
     tGATT_CHAR_PROP       char_prop;   /* characterisitc properties */
-    UINT16                val_handle;  /* characteristic value attribute handle */
+    uint16_t              val_handle;  /* characteristic value attribute handle */
     tBT_UUID              char_uuid;   /* characteristic UUID type */
 } tGATT_CHAR_DCLR_VAL;
 
@@ -518,7 +518,7 @@
 */
 typedef struct
 {
-    UINT16          e_handle;       /* ending handle of the group */
+    uint16_t        e_handle;       /* ending handle of the group */
     tBT_UUID        service_type;   /* group type */
 } tGATT_GROUP_VALUE;
 
@@ -528,8 +528,8 @@
 typedef struct
 {
     tBT_UUID    service_type;       /* included service UUID */
-    UINT16      s_handle;           /* starting handle */
-    UINT16      e_handle;           /* ending handle */
+    uint16_t    s_handle;           /* starting handle */
+    uint16_t    e_handle;           /* ending handle */
 } tGATT_INCL_SRVC;
 
 typedef union
@@ -540,7 +540,7 @@
                                           or GATT_DISC_SRVC_BY_UUID
                                           type of discovery result callback. */
 
-    UINT16              handle;        /* When used with GATT_DISC_INC_SRVC type discovery result,
+    uint16_t            handle;        /* When used with GATT_DISC_INC_SRVC type discovery result,
                                           it is the included service starting handle.*/
 
     tGATT_CHAR_DCLR_VAL dclr_value;    /* Characteristic declaration value.
@@ -552,7 +552,7 @@
 typedef struct
 {
     tBT_UUID            type;
-    UINT16              handle;
+    uint16_t            handle;
     tGATT_DISC_VALUE    value;
 } tGATT_DISC_RES;
 
@@ -564,26 +564,26 @@
 
 #define GATT_INVALID_ACL_HANDLE              0xFFFF
 /* discover result callback function */
-typedef void (tGATT_DISC_RES_CB) (UINT16 conn_id, tGATT_DISC_TYPE disc_type,
+typedef void (tGATT_DISC_RES_CB) (uint16_t conn_id, tGATT_DISC_TYPE disc_type,
                                     tGATT_DISC_RES *p_data);
 
 /* discover complete callback function */
-typedef void (tGATT_DISC_CMPL_CB) (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_STATUS status);
+typedef void (tGATT_DISC_CMPL_CB) (uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_STATUS status);
 
 /* Define a callback function for when read/write/disc/config operation is completed. */
-typedef void (tGATT_CMPL_CBACK) (UINT16 conn_id, tGATTC_OPTYPE op, tGATT_STATUS status,
+typedef void (tGATT_CMPL_CBACK) (uint16_t conn_id, tGATTC_OPTYPE op, tGATT_STATUS status,
                 tGATT_CL_COMPLETE *p_data);
 
 /* Define a callback function when an initialized connection is established. */
-typedef void (tGATT_CONN_CBACK) (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id, BOOLEAN connected,
+typedef void (tGATT_CONN_CBACK) (tGATT_IF gatt_if, BD_ADDR bda, uint16_t conn_id, bool    connected,
                                     tGATT_DISCONN_REASON reason, tBT_TRANSPORT transport);
 
 /* attribute request callback for ATT server */
-typedef void  (tGATT_REQ_CBACK )(UINT16 conn_id, UINT32 trans_id, tGATTS_REQ_TYPE type,
+typedef void  (tGATT_REQ_CBACK )(uint16_t conn_id, uint32_t trans_id, tGATTS_REQ_TYPE type,
                                 tGATTS_DATA *p_data);
 
 /* channel congestion/uncongestion callback */
-typedef void (tGATT_CONGESTION_CBACK )(UINT16 conn_id, BOOLEAN congested);
+typedef void (tGATT_CONGESTION_CBACK )(uint16_t conn_id, bool    congested);
 
 /* Define a callback function when encryption is established. */
 typedef void (tGATT_ENC_CMPL_CB)(tGATT_IF gatt_if, BD_ADDR bda);
@@ -612,9 +612,9 @@
 {
     tBT_UUID app_uuid128;
     tBT_UUID svc_uuid;
-    UINT16   s_handle;
-    UINT16   e_handle;
-    BOOLEAN  is_primary;      /* primary service or secondary */
+    uint16_t s_handle;
+    uint16_t e_handle;
+    bool     is_primary;      /* primary service or secondary */
 } tGATTS_HNDL_RANGE;
 
 
@@ -624,31 +624,31 @@
 #define GATTS_SRV_CHG_CMD_REMOVE_CLIENT    3
 #define GATTS_SRV_CHG_CMD_READ_NUM_CLENTS  4
 #define GATTS_SRV_CHG_CMD_READ_CLENT       5
-typedef UINT8 tGATTS_SRV_CHG_CMD;
+typedef uint8_t tGATTS_SRV_CHG_CMD;
 
 typedef struct
 {
     BD_ADDR         bda;
-    BOOLEAN         srv_changed;
+    bool            srv_changed;
 } tGATTS_SRV_CHG;
 
 
 typedef union
 {
     tGATTS_SRV_CHG  srv_chg;
-    UINT8           client_read_index; /* only used for sequential reading client srv chg info */
+    uint8_t         client_read_index; /* only used for sequential reading client srv chg info */
 } tGATTS_SRV_CHG_REQ;
 
 typedef union
 {
     tGATTS_SRV_CHG srv_chg;
-    UINT8 num_clients;
+    uint8_t num_clients;
 } tGATTS_SRV_CHG_RSP;
 
 /* Attibute server handle ranges NV storage callback functions
 */
-typedef void  (tGATTS_NV_SAVE_CBACK)(BOOLEAN is_saved, tGATTS_HNDL_RANGE *p_hndl_range);
-typedef BOOLEAN  (tGATTS_NV_SRV_CHG_CBACK)(tGATTS_SRV_CHG_CMD cmd, tGATTS_SRV_CHG_REQ *p_req,
+typedef void  (tGATTS_NV_SAVE_CBACK)(bool    is_saved, tGATTS_HNDL_RANGE *p_hndl_range);
+typedef bool     (tGATTS_NV_SRV_CHG_CBACK)(tGATTS_SRV_CHG_CMD cmd, tGATTS_SRV_CHG_REQ *p_req,
                                             tGATTS_SRV_CHG_RSP *p_rsp);
 
 typedef struct
@@ -674,7 +674,7 @@
 ** Returns          The new or current trace level
 **
 *******************************************************************************/
-extern UINT8 GATT_SetTraceLevel (UINT8 new_level);
+extern uint8_t GATT_SetTraceLevel (uint8_t new_level);
 
 
 /*******************************************************************************/
@@ -691,11 +691,11 @@
 **
 ** Parameter        p_hndl_range:   pointer to allocated handles information
 **
-** Returns          TRUE if handle range is added sucessfully; otherwise FALSE.
+** Returns          true if handle range is added sucessfully; otherwise false.
 **
 *******************************************************************************/
 
-extern BOOLEAN GATTS_AddHandleRange(tGATTS_HNDL_RANGE *p_hndl_range);
+extern bool    GATTS_AddHandleRange(tGATTS_HNDL_RANGE *p_hndl_range);
 
 /*******************************************************************************
 **
@@ -707,10 +707,10 @@
 **
 ** Parameter        p_cb_info : callback informaiton
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-extern BOOLEAN  GATTS_NVRegister (tGATT_APPL_INFO *p_cb_info);
+extern bool     GATTS_NVRegister (tGATT_APPL_INFO *p_cb_info);
 
 
 /*******************************************************************************
@@ -730,7 +730,7 @@
 **                  on error error status is returned.
 **
 *******************************************************************************/
-extern UINT16 GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t *service, int count);
+extern uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t *service, int count);
 
 /*******************************************************************************
 **
@@ -742,11 +742,10 @@
 **                  p_svc_uuid    : service UUID
 **                  svc_inst      : instance of the service inside the application
 **
-** Returns          TRUE if operation succeed, FALSE if handle block was not found.
+** Returns          true if operation succeed, false if handle block was not found.
 **
 *******************************************************************************/
-extern BOOLEAN GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid,
-                                    UINT16 svc_inst);
+extern bool GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, uint16_t svc_inst);
 
 
 /*******************************************************************************
@@ -760,7 +759,7 @@
 ** Returns          None.
 **
 *******************************************************************************/
-extern void GATTS_StopService (UINT16 service_handle);
+extern void GATTS_StopService (uint16_t service_handle);
 
 
 /*******************************************************************************
@@ -777,9 +776,9 @@
 ** Returns          GATT_SUCCESS if sucessfully sent or queued; otherwise error code.
 **
 *******************************************************************************/
-extern  tGATT_STATUS GATTS_HandleValueIndication (UINT16 conn_id,
-                                                  UINT16 attr_handle,
-                                                  UINT16 val_len, UINT8 *p_val);
+extern  tGATT_STATUS GATTS_HandleValueIndication (uint16_t conn_id,
+                                                  uint16_t attr_handle,
+                                                  uint16_t val_len, uint8_t *p_val);
 
 /*******************************************************************************
 **
@@ -795,8 +794,8 @@
 ** Returns          GATT_SUCCESS if sucessfully sent; otherwise error code.
 **
 *******************************************************************************/
-extern  tGATT_STATUS GATTS_HandleValueNotification (UINT16 conn_id, UINT16 attr_handle,
-                                                    UINT16 val_len, UINT8 *p_val);
+extern  tGATT_STATUS GATTS_HandleValueNotification (uint16_t conn_id, uint16_t attr_handle,
+                                                    uint16_t val_len, uint8_t *p_val);
 
 
 /*******************************************************************************
@@ -813,7 +812,7 @@
 ** Returns          GATT_SUCCESS if sucessfully sent; otherwise error code.
 **
 *******************************************************************************/
-extern  tGATT_STATUS GATTS_SendRsp (UINT16 conn_id,  UINT32 trans_id,
+extern  tGATT_STATUS GATTS_SendRsp (uint16_t conn_id,  uint32_t trans_id,
                                     tGATT_STATUS status, tGATTS_RSP *p_msg);
 
 
@@ -834,7 +833,7 @@
 ** Returns          GATT_SUCCESS if command started successfully.
 **
 *******************************************************************************/
-extern tGATT_STATUS GATTC_ConfigureMTU (UINT16 conn_id, UINT16  mtu);
+extern tGATT_STATUS GATTC_ConfigureMTU (uint16_t conn_id, uint16_t mtu);
 
 /*******************************************************************************
 **
@@ -849,7 +848,7 @@
 ** Returns          GATT_SUCCESS if command received/sent successfully.
 **
 *******************************************************************************/
-extern tGATT_STATUS GATTC_Discover (UINT16 conn_id,
+extern tGATT_STATUS GATTC_Discover (uint16_t conn_id,
                                     tGATT_DISC_TYPE disc_type,
                                     tGATT_DISC_PARAM *p_param );
 /*******************************************************************************
@@ -866,7 +865,7 @@
 ** Returns          GATT_SUCCESS if command started successfully.
 **
 *******************************************************************************/
-extern tGATT_STATUS GATTC_Read (UINT16 conn_id, tGATT_READ_TYPE type,
+extern tGATT_STATUS GATTC_Read (uint16_t conn_id, tGATT_READ_TYPE type,
                                 tGATT_READ_PARAM *p_read);
 
 /*******************************************************************************
@@ -883,7 +882,7 @@
 ** Returns          GATT_SUCCESS if command started successfully.
 **
 *******************************************************************************/
-extern tGATT_STATUS GATTC_Write (UINT16 conn_id, tGATT_WRITE_TYPE type,
+extern tGATT_STATUS GATTC_Write (uint16_t conn_id, tGATT_WRITE_TYPE type,
                                  tGATT_VALUE *p_write);
 
 
@@ -900,7 +899,7 @@
 ** Returns          GATT_SUCCESS if command started successfully.
 **
 *******************************************************************************/
-extern tGATT_STATUS GATTC_ExecuteWrite (UINT16 conn_id, BOOLEAN is_execute);
+extern tGATT_STATUS GATTC_ExecuteWrite (uint16_t conn_id, bool    is_execute);
 
 /*******************************************************************************
 **
@@ -915,7 +914,7 @@
 ** Returns          GATT_SUCCESS if command started successfully.
 **
 *******************************************************************************/
-extern tGATT_STATUS GATTC_SendHandleValueConfirm (UINT16 conn_id, UINT16 handle);
+extern tGATT_STATUS GATTC_SendHandleValueConfirm (uint16_t conn_id, uint16_t handle);
 
 
 /*******************************************************************************
@@ -932,7 +931,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void GATT_SetIdleTimeout (BD_ADDR bd_addr, UINT16 idle_tout,
+extern void GATT_SetIdleTimeout (BD_ADDR bd_addr, uint16_t idle_tout,
                                  tGATT_TRANSPORT transport);
 
 
@@ -991,11 +990,11 @@
 **                  is_direct: is a direct conenection or a background auto connection
 **                  transport : Physical transport for GATT connection (BR/EDR or LE)
 **
-** Returns          TRUE if connection started; FALSE if connection start failure.
+** Returns          true if connection started; false if connection start failure.
 **
 *******************************************************************************/
-extern BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr,
-                             BOOLEAN is_direct, tBT_TRANSPORT transport);
+extern bool    GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr,
+                             bool    is_direct, tBT_TRANSPORT transport);
 
 
 /*******************************************************************************
@@ -1010,11 +1009,11 @@
 **                  bd_addr: peer device address.
 **                  is_direct: is a direct conenection or a background auto connection
 **
-** Returns          TRUE if connection started; FALSE if connection start failure.
+** Returns          true if connection started; false if connection start failure.
 **
 *******************************************************************************/
-extern BOOLEAN GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr,
-                                   BOOLEAN is_direct);
+extern bool    GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr,
+                                   bool    is_direct);
 
 /*******************************************************************************
 **
@@ -1028,7 +1027,7 @@
 ** Returns          GATT_SUCCESS if disconnected.
 **
 *******************************************************************************/
-extern tGATT_STATUS GATT_Disconnect (UINT16 conn_id);
+extern tGATT_STATUS GATT_Disconnect (uint16_t conn_id);
 
 
 
@@ -1044,10 +1043,10 @@
 **                   bd_addr: peer device address. (output)
 **                   transport :  physical transport of the GATT connection (BR/EDR or LE)
 **
-** Returns          TRUE the ligical link information is found for conn_id
+** Returns          true the ligical link information is found for conn_id
 **
 *******************************************************************************/
-extern BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if,
+extern bool    GATT_GetConnectionInfor(uint16_t conn_id, tGATT_IF *p_gatt_if,
                                        BD_ADDR bd_addr, tBT_TRANSPORT *p_transport);
 
 
@@ -1063,11 +1062,11 @@
 **                   p_conn_id: connection id  (output)
 **                   transport :  physical transport of the GATT connection (BR/EDR or LE)
 **
-** Returns          TRUE the ligical link is connected
+** Returns          true the ligical link is connected
 **
 *******************************************************************************/
-extern BOOLEAN GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr,
-                                         UINT16 *p_conn_id, tBT_TRANSPORT transport);
+extern bool    GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr,
+                                         uint16_t *p_conn_id, tBT_TRANSPORT transport);
 
 
 /*******************************************************************************
@@ -1082,10 +1081,10 @@
 **                             listen to all device connection.
 **                  start: is a direct conenection or a background auto connection
 **
-** Returns          TRUE if advertisement is started; FALSE if adv start failure.
+** Returns          true if advertisement is started; false if adv start failure.
 **
 *******************************************************************************/
-extern BOOLEAN GATT_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr);
+extern bool    GATT_Listen (tGATT_IF gatt_if, bool    start, BD_ADDR_PTR bd_addr);
 
 /*******************************************************************************
 **
@@ -1096,7 +1095,7 @@
 ** Returns          None.
 **
 *******************************************************************************/
-extern void GATT_ConfigServiceChangeCCC (BD_ADDR remote_bda, BOOLEAN enable,
+extern void GATT_ConfigServiceChangeCCC (BD_ADDR remote_bda, bool    enable,
                                                     tBT_TRANSPORT transport);
  
 #ifdef __cplusplus
diff --git a/stack/include/hcidefs.h b/stack/include/hcidefs.h
index ebd3be6..e8f012b 100644
--- a/stack/include/hcidefs.h
+++ b/stack/include/hcidefs.h
@@ -41,7 +41,7 @@
 #define HCI_GRP_VENDOR_SPECIFIC         (0x3F << 10)            /* 0xFC00 */
 
 /* Group occupies high 6 bits of the HCI command rest is opcode itself */
-#define HCI_OGF(p)  (UINT8)((0xFC00 & (p)) >> 10)
+#define HCI_OGF(p)  (uint8_t)((0xFC00 & (p)) >> 10)
 #define HCI_OCF(p)  ( 0x3FF & (p))
 
 /*
@@ -796,38 +796,38 @@
 /*
 ** Definitions for HCI enable event
 */
-#define HCI_INQUIRY_COMPLETE_EV(p)          (*((UINT32 *)(p)) & 0x00000001)
-#define HCI_INQUIRY_RESULT_EV(p)            (*((UINT32 *)(p)) & 0x00000002)
-#define HCI_CONNECTION_COMPLETE_EV(p)       (*((UINT32 *)(p)) & 0x00000004)
-#define HCI_CONNECTION_REQUEST_EV(p)        (*((UINT32 *)(p)) & 0x00000008)
-#define HCI_DISCONNECTION_COMPLETE_EV(p)    (*((UINT32 *)(p)) & 0x00000010)
-#define HCI_AUTHENTICATION_COMPLETE_EV(p)   (*((UINT32 *)(p)) & 0x00000020)
-#define HCI_RMT_NAME_REQUEST_COMPL_EV(p)    (*((UINT32 *)(p)) & 0x00000040)
-#define HCI_CHANGE_CONN_ENCRPT_ENABLE_EV(p) (*((UINT32 *)(p)) & 0x00000080)
-#define HCI_CHANGE_CONN_LINK_KEY_EV(p)      (*((UINT32 *)(p)) & 0x00000100)
-#define HCI_MASTER_LINK_KEY_COMPLETE_EV(p)  (*((UINT32 *)(p)) & 0x00000200)
-#define HCI_READ_RMT_FEATURES_COMPL_EV(p)   (*((UINT32 *)(p)) & 0x00000400)
-#define HCI_READ_RMT_VERSION_COMPL_EV(p)    (*((UINT32 *)(p)) & 0x00000800)
-#define HCI_QOS_SETUP_COMPLETE_EV(p)        (*((UINT32 *)(p)) & 0x00001000)
-#define HCI_COMMAND_COMPLETE_EV(p)          (*((UINT32 *)(p)) & 0x00002000)
-#define HCI_COMMAND_STATUS_EV(p)            (*((UINT32 *)(p)) & 0x00004000)
-#define HCI_HARDWARE_ERROR_EV(p)            (*((UINT32 *)(p)) & 0x00008000)
-#define HCI_FLASH_OCCURED_EV(p)             (*((UINT32 *)(p)) & 0x00010000)
-#define HCI_ROLE_CHANGE_EV(p)               (*((UINT32 *)(p)) & 0x00020000)
-#define HCI_NUM_COMPLETED_PKTS_EV(p)        (*((UINT32 *)(p)) & 0x00040000)
-#define HCI_MODE_CHANGE_EV(p)               (*((UINT32 *)(p)) & 0x00080000)
-#define HCI_RETURN_LINK_KEYS_EV(p)          (*((UINT32 *)(p)) & 0x00100000)
-#define HCI_PIN_CODE_REQUEST_EV(p)          (*((UINT32 *)(p)) & 0x00200000)
-#define HCI_LINK_KEY_REQUEST_EV(p)          (*((UINT32 *)(p)) & 0x00400000)
-#define HCI_LINK_KEY_NOTIFICATION_EV(p)     (*((UINT32 *)(p)) & 0x00800000)
-#define HCI_LOOPBACK_COMMAND_EV(p)          (*((UINT32 *)(p)) & 0x01000000)
-#define HCI_DATA_BUF_OVERFLOW_EV(p)         (*((UINT32 *)(p)) & 0x02000000)
-#define HCI_MAX_SLOTS_CHANGE_EV(p)          (*((UINT32 *)(p)) & 0x04000000)
-#define HCI_READ_CLOCK_OFFSET_COMP_EV(p)    (*((UINT32 *)(p)) & 0x08000000)
-#define HCI_CONN_PKT_TYPE_CHANGED_EV(p)     (*((UINT32 *)(p)) & 0x10000000)
-#define HCI_QOS_VIOLATION_EV(p)             (*((UINT32 *)(p)) & 0x20000000)
-#define HCI_PAGE_SCAN_MODE_CHANGED_EV(p)    (*((UINT32 *)(p)) & 0x40000000)
-#define HCI_PAGE_SCAN_REP_MODE_CHNG_EV(p)   (*((UINT32 *)(p)) & 0x80000000)
+#define HCI_INQUIRY_COMPLETE_EV(p)          (*((uint32_t *)(p)) & 0x00000001)
+#define HCI_INQUIRY_RESULT_EV(p)            (*((uint32_t *)(p)) & 0x00000002)
+#define HCI_CONNECTION_COMPLETE_EV(p)       (*((uint32_t *)(p)) & 0x00000004)
+#define HCI_CONNECTION_REQUEST_EV(p)        (*((uint32_t *)(p)) & 0x00000008)
+#define HCI_DISCONNECTION_COMPLETE_EV(p)    (*((uint32_t *)(p)) & 0x00000010)
+#define HCI_AUTHENTICATION_COMPLETE_EV(p)   (*((uint32_t *)(p)) & 0x00000020)
+#define HCI_RMT_NAME_REQUEST_COMPL_EV(p)    (*((uint32_t *)(p)) & 0x00000040)
+#define HCI_CHANGE_CONN_ENCRPT_ENABLE_EV(p) (*((uint32_t *)(p)) & 0x00000080)
+#define HCI_CHANGE_CONN_LINK_KEY_EV(p)      (*((uint32_t *)(p)) & 0x00000100)
+#define HCI_MASTER_LINK_KEY_COMPLETE_EV(p)  (*((uint32_t *)(p)) & 0x00000200)
+#define HCI_READ_RMT_FEATURES_COMPL_EV(p)   (*((uint32_t *)(p)) & 0x00000400)
+#define HCI_READ_RMT_VERSION_COMPL_EV(p)    (*((uint32_t *)(p)) & 0x00000800)
+#define HCI_QOS_SETUP_COMPLETE_EV(p)        (*((uint32_t *)(p)) & 0x00001000)
+#define HCI_COMMAND_COMPLETE_EV(p)          (*((uint32_t *)(p)) & 0x00002000)
+#define HCI_COMMAND_STATUS_EV(p)            (*((uint32_t *)(p)) & 0x00004000)
+#define HCI_HARDWARE_ERROR_EV(p)            (*((uint32_t *)(p)) & 0x00008000)
+#define HCI_FLASH_OCCURED_EV(p)             (*((uint32_t *)(p)) & 0x00010000)
+#define HCI_ROLE_CHANGE_EV(p)               (*((uint32_t *)(p)) & 0x00020000)
+#define HCI_NUM_COMPLETED_PKTS_EV(p)        (*((uint32_t *)(p)) & 0x00040000)
+#define HCI_MODE_CHANGE_EV(p)               (*((uint32_t *)(p)) & 0x00080000)
+#define HCI_RETURN_LINK_KEYS_EV(p)          (*((uint32_t *)(p)) & 0x00100000)
+#define HCI_PIN_CODE_REQUEST_EV(p)          (*((uint32_t *)(p)) & 0x00200000)
+#define HCI_LINK_KEY_REQUEST_EV(p)          (*((uint32_t *)(p)) & 0x00400000)
+#define HCI_LINK_KEY_NOTIFICATION_EV(p)     (*((uint32_t *)(p)) & 0x00800000)
+#define HCI_LOOPBACK_COMMAND_EV(p)          (*((uint32_t *)(p)) & 0x01000000)
+#define HCI_DATA_BUF_OVERFLOW_EV(p)         (*((uint32_t *)(p)) & 0x02000000)
+#define HCI_MAX_SLOTS_CHANGE_EV(p)          (*((uint32_t *)(p)) & 0x04000000)
+#define HCI_READ_CLOCK_OFFSET_COMP_EV(p)    (*((uint32_t *)(p)) & 0x08000000)
+#define HCI_CONN_PKT_TYPE_CHANGED_EV(p)     (*((uint32_t *)(p)) & 0x10000000)
+#define HCI_QOS_VIOLATION_EV(p)             (*((uint32_t *)(p)) & 0x20000000)
+#define HCI_PAGE_SCAN_MODE_CHANGED_EV(p)    (*((uint32_t *)(p)) & 0x40000000)
+#define HCI_PAGE_SCAN_REP_MODE_CHNG_EV(p)   (*((uint32_t *)(p)) & 0x80000000)
 
 /* the default event mask for 2.1+EDR (Lisbon) does not include Lisbon events */
 #define HCI_DEFAULT_EVENT_MASK_0            0xFFFFFFFF
@@ -893,7 +893,7 @@
     0x0000000000200000 Connectionless Broadcast Channel Map Change Event
     0x0000000000400000 Inquiry Response Notification Event
 */
-#if BLE_PRIVACY_SPT == TRUE
+#if (BLE_PRIVACY_SPT == TRUE)
 /* BLE event mask */
 #define HCI_BLE_EVENT_MASK_DEF               "\x00\x00\x00\x00\x00\x00\x07\xff"
 #else
@@ -1338,12 +1338,12 @@
 /* Define the extended flow specification fields used by AMP */
 typedef struct
 {
-    UINT8       id;
-    UINT8       stype;
-    UINT16      max_sdu_size;
-    UINT32      sdu_inter_time;
-    UINT32      access_latency;
-    UINT32      flush_timeout;
+    uint8_t     id;
+    uint8_t     stype;
+    uint16_t    max_sdu_size;
+    uint32_t    sdu_inter_time;
+    uint32_t    access_latency;
+    uint32_t    flush_timeout;
 } tHCI_EXT_FLOW_SPEC;
 
 
diff --git a/stack/include/hcimsgs.h b/stack/include/hcimsgs.h
index c8df4ac..8adbe89 100644
--- a/stack/include/hcimsgs.h
+++ b/stack/include/hcimsgs.h
@@ -27,13 +27,13 @@
 extern "C" {
 #endif
 
-void bte_main_hci_send(BT_HDR *p_msg, UINT16 event);
+void bte_main_hci_send(BT_HDR *p_msg, uint16_t event);
 void bte_main_lpm_allow_bt_device_sleep(void);
 
 /* Message by message.... */
 
-extern BOOLEAN btsnd_hcic_inquiry(const LAP inq_lap, UINT8 duration,
-                                  UINT8 response_cnt);
+extern bool    btsnd_hcic_inquiry(const LAP inq_lap, uint8_t duration,
+                                  uint8_t response_cnt);
 
 #define HCIC_PARAM_SIZE_INQUIRY 5
 
@@ -44,14 +44,14 @@
                                                                     /* Inquiry */
 
                                                                     /* Inquiry Cancel */
-extern BOOLEAN btsnd_hcic_inq_cancel(void);
+extern bool    btsnd_hcic_inq_cancel(void);
 
 #define HCIC_PARAM_SIZE_INQ_CANCEL   0
 
                                                                     /* Periodic Inquiry Mode */
-extern BOOLEAN btsnd_hcic_per_inq_mode(UINT16 max_period, UINT16 min_period,
-                                       const LAP inq_lap, UINT8 duration,
-                                       UINT8 response_cnt);
+extern bool    btsnd_hcic_per_inq_mode(uint16_t max_period, uint16_t min_period,
+                                       const LAP inq_lap, uint8_t duration,
+                                       uint8_t response_cnt);
 
 #define HCIC_PARAM_SIZE_PER_INQ_MODE    9
 
@@ -63,15 +63,15 @@
                                                                     /* Periodic Inquiry Mode */
 
                                                                     /* Exit Periodic Inquiry Mode */
-extern BOOLEAN btsnd_hcic_exit_per_inq(void);
+extern bool    btsnd_hcic_exit_per_inq(void);
 
 #define HCIC_PARAM_SIZE_EXIT_PER_INQ   0
                                                                     /* Create Connection */
-extern BOOLEAN btsnd_hcic_create_conn(BD_ADDR dest, UINT16 packet_types,
-                                      UINT8 page_scan_rep_mode,
-                                      UINT8 page_scan_mode,
-                                      UINT16 clock_offset,
-                                      UINT8 allow_switch);
+extern bool    btsnd_hcic_create_conn(BD_ADDR dest, uint16_t packet_types,
+                                      uint8_t page_scan_rep_mode,
+                                      uint8_t page_scan_mode,
+                                      uint16_t clock_offset,
+                                      uint8_t allow_switch);
 
 #define HCIC_PARAM_SIZE_CREATE_CONN  13
 
@@ -84,7 +84,7 @@
                                                                     /* Create Connection */
 
                                                                     /* Disconnect */
-extern BOOLEAN btsnd_hcic_disconnect(UINT16 handle, UINT8 reason);
+extern bool    btsnd_hcic_disconnect(uint16_t handle, uint8_t reason);
 
 #define HCIC_PARAM_SIZE_DISCONNECT 3
 
@@ -92,9 +92,9 @@
 #define HCI_DISC_REASON_OFF             2
                                                                     /* Disconnect */
 
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
                                                                     /* Add SCO Connection */
-extern BOOLEAN btsnd_hcic_add_SCO_conn (UINT16 handle, UINT16 packet_types);
+extern bool    btsnd_hcic_add_SCO_conn (uint16_t handle, uint16_t packet_types);
 #endif /* BTM_SCO_INCLUDED */
 
 #define HCIC_PARAM_SIZE_ADD_SCO_CONN    4
@@ -104,7 +104,7 @@
                                                                     /* Add SCO Connection */
 
                                                                     /* Create Connection Cancel */
-extern BOOLEAN btsnd_hcic_create_conn_cancel(BD_ADDR dest);
+extern bool    btsnd_hcic_create_conn_cancel(BD_ADDR dest);
 
 #define HCIC_PARAM_SIZE_CREATE_CONN_CANCEL  6
 
@@ -112,7 +112,7 @@
                                                                     /* Create Connection Cancel */
 
                                                                     /* Accept Connection Request */
-extern BOOLEAN btsnd_hcic_accept_conn (BD_ADDR bd_addr, UINT8 role);
+extern bool    btsnd_hcic_accept_conn (BD_ADDR bd_addr, uint8_t role);
 
 #define HCIC_PARAM_SIZE_ACCEPT_CONN     7
 
@@ -121,7 +121,7 @@
                                                                     /* Accept Connection Request */
 
                                                                     /* Reject Connection Request */
-extern BOOLEAN btsnd_hcic_reject_conn (BD_ADDR bd_addr, UINT8 reason);
+extern bool    btsnd_hcic_reject_conn (BD_ADDR bd_addr, uint8_t reason);
 
 #define HCIC_PARAM_SIZE_REJECT_CONN      7
 
@@ -130,7 +130,7 @@
                                                                     /* Reject Connection Request */
 
                                                                     /* Link Key Request Reply */
-extern BOOLEAN btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr,
+extern bool    btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr,
                                               LINK_KEY link_key);
 
 #define HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY   22
@@ -140,7 +140,7 @@
                                                                     /* Link Key Request Reply  */
 
                                                                     /* Link Key Request Neg Reply */
-extern BOOLEAN btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr);
+extern bool    btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr);
 
 #define HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY   6
 
@@ -148,8 +148,8 @@
                                                                     /* Link Key Request Neg Reply  */
 
                                                                     /* PIN Code Request Reply */
-extern BOOLEAN btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr,
-                                              UINT8 pin_code_len,
+extern bool    btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr,
+                                              uint8_t pin_code_len,
                                               PIN_CODE pin_code);
 
 #define HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY   23
@@ -160,7 +160,7 @@
                                                                     /* PIN Code Request Reply  */
 
                                                                     /* Link Key Request Neg Reply */
-extern BOOLEAN btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr);
+extern bool    btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr);
 
 #define HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY   6
 
@@ -168,7 +168,7 @@
                                                                     /* Link Key Request Neg Reply  */
 
                                                                     /* Change Connection Type */
-extern BOOLEAN btsnd_hcic_change_conn_type (UINT16 handle, UINT16 packet_types);
+extern bool    btsnd_hcic_change_conn_type (uint16_t handle, uint16_t packet_types);
 
 #define HCIC_PARAM_SIZE_CHANGE_CONN_TYPE     4
 
@@ -180,10 +180,10 @@
 
 #define HCI_CMD_HANDLE_HANDLE_OFF       0
 
-extern BOOLEAN btsnd_hcic_auth_request (UINT16 handle);     /* Authentication Request */
+extern bool    btsnd_hcic_auth_request (uint16_t handle);     /* Authentication Request */
 
                                                                     /* Set Connection Encryption */
-extern BOOLEAN btsnd_hcic_set_conn_encrypt (UINT16 handle, BOOLEAN enable);
+extern bool    btsnd_hcic_set_conn_encrypt (uint16_t handle, bool    enable);
 #define HCIC_PARAM_SIZE_SET_CONN_ENCRYPT     3
 
 
@@ -192,10 +192,10 @@
                                                                     /* Set Connection Encryption */
 
                                                                     /* Remote Name Request */
-extern BOOLEAN btsnd_hcic_rmt_name_req (BD_ADDR bd_addr,
-                                        UINT8 page_scan_rep_mode,
-                                        UINT8 page_scan_mode,
-                                        UINT16 clock_offset);
+extern bool    btsnd_hcic_rmt_name_req (BD_ADDR bd_addr,
+                                        uint8_t page_scan_rep_mode,
+                                        uint8_t page_scan_mode,
+                                        uint16_t clock_offset);
 
 #define HCIC_PARAM_SIZE_RMT_NAME_REQ   10
 
@@ -206,17 +206,17 @@
                                                                     /* Remote Name Request */
 
                                                                     /* Remote Name Request Cancel */
-extern BOOLEAN btsnd_hcic_rmt_name_req_cancel(BD_ADDR bd_addr);
+extern bool    btsnd_hcic_rmt_name_req_cancel(BD_ADDR bd_addr);
 
 #define HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL   6
 
 #define HCI_RMT_NAME_CANCEL_BD_ADDR_OFF       0
                                                                     /* Remote Name Request Cancel */
 
-extern BOOLEAN btsnd_hcic_rmt_features_req(UINT16 handle);      /* Remote Features Request */
+extern bool    btsnd_hcic_rmt_features_req(uint16_t handle);      /* Remote Features Request */
 
                                                                     /* Remote Extended Features */
-extern BOOLEAN btsnd_hcic_rmt_ext_features(UINT16 handle, UINT8 page_num);
+extern bool    btsnd_hcic_rmt_ext_features(uint16_t handle, uint8_t page_num);
 
 #define HCIC_PARAM_SIZE_RMT_EXT_FEATURES   3
 
@@ -225,15 +225,15 @@
                                                                     /* Remote Extended Features */
 
 
-extern BOOLEAN btsnd_hcic_rmt_ver_req(UINT16 handle);           /* Remote Version Info Request */
-extern BOOLEAN btsnd_hcic_read_rmt_clk_offset(UINT16 handle);   /* Remote Clock Offset */
-extern BOOLEAN btsnd_hcic_read_lmp_handle(UINT16 handle);       /* Remote LMP Handle */
+extern bool    btsnd_hcic_rmt_ver_req(uint16_t handle);           /* Remote Version Info Request */
+extern bool    btsnd_hcic_read_rmt_clk_offset(uint16_t handle);   /* Remote Clock Offset */
+extern bool    btsnd_hcic_read_lmp_handle(uint16_t handle);       /* Remote LMP Handle */
 
-extern BOOLEAN btsnd_hcic_setup_esco_conn (UINT16 handle,
-                                           UINT32 tx_bw, UINT32 rx_bw,
-                                           UINT16 max_latency, UINT16 voice,
-                                           UINT8 retrans_effort,
-                                           UINT16 packet_types);
+extern bool    btsnd_hcic_setup_esco_conn (uint16_t handle,
+                                           uint32_t tx_bw, uint32_t rx_bw,
+                                           uint16_t max_latency, uint16_t voice,
+                                           uint8_t retrans_effort,
+                                           uint16_t packet_types);
 #define HCIC_PARAM_SIZE_SETUP_ESCO      17
 
 #define HCI_SETUP_ESCO_HANDLE_OFF       0
@@ -245,12 +245,12 @@
 #define HCI_SETUP_ESCO_PKT_TYPES_OFF    15
 
 
-extern BOOLEAN btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr,
-                                            UINT32 tx_bw, UINT32 rx_bw,
-                                            UINT16 max_latency,
-                                            UINT16 content_fmt,
-                                            UINT8 retrans_effort,
-                                            UINT16 packet_types);
+extern bool    btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr,
+                                            uint32_t tx_bw, uint32_t rx_bw,
+                                            uint16_t max_latency,
+                                            uint16_t content_fmt,
+                                            uint8_t retrans_effort,
+                                            uint16_t packet_types);
 #define HCIC_PARAM_SIZE_ACCEPT_ESCO     21
 
 #define HCI_ACCEPT_ESCO_BDADDR_OFF      0
@@ -262,15 +262,15 @@
 #define HCI_ACCEPT_ESCO_PKT_TYPES_OFF   19
 
 
-extern BOOLEAN btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, UINT8 reason);
+extern bool    btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, uint8_t reason);
 #define HCIC_PARAM_SIZE_REJECT_ESCO     7
 
 #define HCI_REJECT_ESCO_BDADDR_OFF      0
 #define HCI_REJECT_ESCO_REASON_OFF      6
 
 /* Hold Mode */
-extern BOOLEAN btsnd_hcic_hold_mode(UINT16 handle, UINT16 max_hold_period,
-                                    UINT16 min_hold_period);
+extern bool    btsnd_hcic_hold_mode(uint16_t handle, uint16_t max_hold_period,
+                                    uint16_t min_hold_period);
 
 #define HCIC_PARAM_SIZE_HOLD_MODE       6
 
@@ -280,11 +280,11 @@
                                                                     /* Hold Mode */
 
                                                                     /* Sniff Mode */
-extern BOOLEAN btsnd_hcic_sniff_mode(UINT16 handle,
-                                     UINT16 max_sniff_period,
-                                     UINT16 min_sniff_period,
-                                     UINT16 sniff_attempt,
-                                     UINT16 sniff_timeout);
+extern bool    btsnd_hcic_sniff_mode(uint16_t handle,
+                                     uint16_t max_sniff_period,
+                                     uint16_t min_sniff_period,
+                                     uint16_t sniff_attempt,
+                                     uint16_t sniff_timeout);
 
 #define HCIC_PARAM_SIZE_SNIFF_MODE      10
 
@@ -296,12 +296,12 @@
 #define HCI_SNIFF_MODE_TIMEOUT_OFF      8
                                                                     /* Sniff Mode */
 
-extern BOOLEAN btsnd_hcic_exit_sniff_mode(UINT16 handle);       /* Exit Sniff Mode */
+extern bool    btsnd_hcic_exit_sniff_mode(uint16_t handle);       /* Exit Sniff Mode */
 
                                                                     /* Park Mode */
-extern BOOLEAN btsnd_hcic_park_mode (UINT16 handle,
-                                     UINT16 beacon_max_interval,
-                                     UINT16 beacon_min_interval);
+extern bool    btsnd_hcic_park_mode (uint16_t handle,
+                                     uint16_t beacon_max_interval,
+                                     uint16_t beacon_min_interval);
 
 #define HCIC_PARAM_SIZE_PARK_MODE       6
 
@@ -310,13 +310,13 @@
 #define HCI_PARK_MODE_MIN_PER_OFF       4
                                                                     /* Park Mode */
 
-extern BOOLEAN btsnd_hcic_exit_park_mode(UINT16 handle);  /* Exit Park Mode */
+extern bool    btsnd_hcic_exit_park_mode(uint16_t handle);  /* Exit Park Mode */
 
                                                                     /* QoS Setup */
-extern BOOLEAN btsnd_hcic_qos_setup (UINT16 handle, UINT8 flags,
-                                     UINT8 service_type,
-                                     UINT32 token_rate, UINT32 peak,
-                                     UINT32 latency, UINT32 delay_var);
+extern bool    btsnd_hcic_qos_setup (uint16_t handle, uint8_t flags,
+                                     uint8_t service_type,
+                                     uint32_t token_rate, uint32_t peak,
+                                     uint32_t latency, uint32_t delay_var);
 
 #define HCIC_PARAM_SIZE_QOS_SETUP       20
 
@@ -330,7 +330,7 @@
                                                                     /* QoS Setup */
 
                                                                     /* Switch Role Request */
-extern BOOLEAN btsnd_hcic_switch_role (BD_ADDR bd_addr, UINT8 role);
+extern bool    btsnd_hcic_switch_role (BD_ADDR bd_addr, uint8_t role);
 
 #define HCIC_PARAM_SIZE_SWITCH_ROLE  7
 
@@ -339,7 +339,7 @@
                                                                     /* Switch Role Request */
 
                                                                     /* Write Policy Settings */
-extern BOOLEAN btsnd_hcic_write_policy_set(UINT16 handle, UINT16 settings);
+extern bool    btsnd_hcic_write_policy_set(uint16_t handle, uint16_t settings);
 
 #define HCIC_PARAM_SIZE_WRITE_POLICY_SET     4
 
@@ -348,7 +348,7 @@
                                                                     /* Write Policy Settings */
 
                                                                     /* Write Default Policy Settings */
-extern BOOLEAN btsnd_hcic_write_def_policy_set(UINT16 settings);
+extern bool    btsnd_hcic_write_def_policy_set(uint16_t settings);
 
 #define HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET     2
 
@@ -358,11 +358,11 @@
 /******************************************
 **    Lisbon Features
 *******************************************/
-#if BTM_SSR_INCLUDED == TRUE
+#if (BTM_SSR_INCLUDED == TRUE)
                                                                     /* Sniff Subrating */
-extern BOOLEAN btsnd_hcic_sniff_sub_rate(UINT16 handle, UINT16 max_lat,
-                                         UINT16 min_remote_lat,
-                                         UINT16 min_local_lat);
+extern bool    btsnd_hcic_sniff_sub_rate(uint16_t handle, uint16_t max_lat,
+                                         uint16_t min_remote_lat,
+                                         uint16_t min_local_lat);
 
 #define HCIC_PARAM_SIZE_SNIFF_SUB_RATE             8
 
@@ -374,20 +374,20 @@
 
 #else   /* BTM_SSR_INCLUDED == FALSE */
 
-#define btsnd_hcic_sniff_sub_rate(handle, max_lat, min_remote_lat, min_local_lat) FALSE
+#define btsnd_hcic_sniff_sub_rate(handle, max_lat, min_remote_lat, min_local_lat) false
 
 #endif  /* BTM_SSR_INCLUDED */
 
                                                                     /* Extended Inquiry Response */
-extern void btsnd_hcic_write_ext_inquiry_response(void *buffer, UINT8 fec_req);
+extern void btsnd_hcic_write_ext_inquiry_response(void *buffer, uint8_t fec_req);
 
 #define HCIC_PARAM_SIZE_EXT_INQ_RESP        241
 
 #define HCIC_EXT_INQ_RESP_FEC_OFF     0
 #define HCIC_EXT_INQ_RESP_RESPONSE    1
                                                                    /* IO Capabilities Response */
-extern BOOLEAN btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, UINT8 capability,
-                                            UINT8 oob_present, UINT8 auth_req);
+extern bool    btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, uint8_t capability,
+                                            uint8_t oob_present, uint8_t auth_req);
 
 #define HCIC_PARAM_SIZE_IO_CAP_RESP     9
 
@@ -397,7 +397,7 @@
 #define HCI_IO_CAP_AUTH_REQ_OFF         8
 
                                                                     /* IO Capabilities Req Neg Reply */
-extern BOOLEAN btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, UINT8 err_code);
+extern bool    btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, uint8_t err_code);
 
 #define HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY 7
 
@@ -405,19 +405,19 @@
 #define HCI_IO_CAP_NR_ERR_CODE           6
 
                                                          /* Read Local OOB Data */
-extern BOOLEAN btsnd_hcic_read_local_oob_data (void);
+extern bool    btsnd_hcic_read_local_oob_data (void);
 
 #define HCIC_PARAM_SIZE_R_LOCAL_OOB     0
 
 
-extern BOOLEAN btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, BOOLEAN is_yes);
+extern bool    btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, bool    is_yes);
 
 #define HCIC_PARAM_SIZE_UCONF_REPLY     6
 
 #define HCI_USER_CONF_BD_ADDR_OFF       0
 
 
-extern BOOLEAN btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, UINT32 value);
+extern bool    btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, uint32_t value);
 
 #define HCIC_PARAM_SIZE_U_PKEY_REPLY    10
 
@@ -425,15 +425,15 @@
 #define HCI_USER_PASSKEY_VALUE_OFF      6
 
 
-extern BOOLEAN btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr);
+extern bool    btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr);
 
 #define HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY 6
 
 #define HCI_USER_PASSKEY_NEG_BD_ADDR_OFF 0
 
                                                             /* Remote OOB Data Request Reply */
-extern BOOLEAN btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, UINT8 *p_c,
-                                         UINT8 *p_r);
+extern bool    btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, uint8_t *p_c,
+                                         uint8_t *p_r);
 
 #define HCIC_PARAM_SIZE_REM_OOB_REPLY   38
 
@@ -442,30 +442,30 @@
 #define HCI_REM_OOB_DATA_R_OFF          22
 
                                                             /* Remote OOB Data Request Negative Reply */
-extern BOOLEAN btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr);
+extern bool    btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr);
 
 #define HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY   6
 
 #define HCI_REM_OOB_DATA_NEG_BD_ADDR_OFF    0
 
                                                             /* Read Tx Power Level */
-extern BOOLEAN btsnd_hcic_read_inq_tx_power (void);
+extern bool    btsnd_hcic_read_inq_tx_power (void);
 
 #define HCIC_PARAM_SIZE_R_TX_POWER      0
 
                                                             /* Read Default Erroneous Data Reporting */
-extern BOOLEAN btsnd_hcic_read_default_erroneous_data_rpt (void);
+extern bool    btsnd_hcic_read_default_erroneous_data_rpt (void);
 
 #define HCIC_PARAM_SIZE_R_ERR_DATA_RPT      0
 
-#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
-extern BOOLEAN btsnd_hcic_enhanced_flush (UINT16 handle, UINT8 packet_type);
+#if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
+extern bool    btsnd_hcic_enhanced_flush (uint16_t handle, uint8_t packet_type);
 
 #define HCIC_PARAM_SIZE_ENHANCED_FLUSH  3
 #endif
 
 
-extern BOOLEAN btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, UINT8 notif);
+extern bool    btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, uint8_t notif);
 
 #define HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF    7
 
@@ -477,10 +477,10 @@
                                                                     /* Store Current Settings */
 #define MAX_FILT_COND   (sizeof (BD_ADDR) + 1)
 
-extern BOOLEAN btsnd_hcic_set_event_filter(UINT8 filt_type,
-                                           UINT8 filt_cond_type,
-                                           UINT8 *filt_cond,
-                                           UINT8 filt_cond_len);
+extern bool    btsnd_hcic_set_event_filter(uint8_t filt_type,
+                                           uint8_t filt_cond_type,
+                                           uint8_t *filt_cond,
+                                           uint8_t filt_cond_len);
 
 #define HCIC_PARAM_SIZE_SET_EVT_FILTER  9
 
@@ -490,7 +490,7 @@
                                                                     /* Set Event Filter */
 
                                                                 /* Delete Stored Key */
-extern BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag);
+extern bool    btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, bool    delete_all_flag);
 
 #define HCIC_PARAM_SIZE_DELETE_STORED_KEY        7
 
@@ -499,7 +499,7 @@
                                                                 /* Delete Stored Key */
 
                                                                 /* Change Local Name */
-extern BOOLEAN btsnd_hcic_change_name(BD_NAME name);
+extern bool    btsnd_hcic_change_name(BD_NAME name);
 
 #define HCIC_PARAM_SIZE_CHANGE_NAME     BD_NAME_LEN
 
@@ -523,13 +523,13 @@
 
 #define HCIC_PARAM_SIZE_SET_AFH_CHANNELS    10
 
-extern BOOLEAN btsnd_hcic_write_pin_type(UINT8 type);                   /* Write PIN Type */
-extern BOOLEAN btsnd_hcic_write_auto_accept(UINT8 flag);                /* Write Auto Accept */
-extern BOOLEAN btsnd_hcic_read_name (void);                             /* Read Local Name */
-extern BOOLEAN btsnd_hcic_write_page_tout(UINT16 timeout);              /* Write Page Timout */
-extern BOOLEAN btsnd_hcic_write_scan_enable(UINT8 flag);                /* Write Scan Enable */
-extern BOOLEAN btsnd_hcic_write_pagescan_cfg(UINT16 interval,
-                                             UINT16 window);            /* Write Page Scan Activity */
+extern bool    btsnd_hcic_write_pin_type(uint8_t type);                   /* Write PIN Type */
+extern bool    btsnd_hcic_write_auto_accept(uint8_t flag);                /* Write Auto Accept */
+extern bool    btsnd_hcic_read_name (void);                             /* Read Local Name */
+extern bool    btsnd_hcic_write_page_tout(uint16_t timeout);              /* Write Page Timout */
+extern bool    btsnd_hcic_write_scan_enable(uint8_t flag);                /* Write Scan Enable */
+extern bool    btsnd_hcic_write_pagescan_cfg(uint16_t interval,
+                                             uint16_t window);            /* Write Page Scan Activity */
 
 #define HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG  4
 
@@ -538,7 +538,7 @@
                                                                 /* Write Page Scan Activity */
 
                                                                 /* Write Inquiry Scan Activity */
-extern BOOLEAN btsnd_hcic_write_inqscan_cfg(UINT16 interval, UINT16 window);
+extern bool    btsnd_hcic_write_inqscan_cfg(uint16_t interval, uint16_t window);
 
 #define HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG    4
 
@@ -546,9 +546,9 @@
 #define HCI_SCAN_CFG_WINDOW_OFF         2
                                                                 /* Write Inquiry Scan Activity */
 
-extern BOOLEAN btsnd_hcic_write_auth_enable(UINT8 flag);                 /* Write Authentication Enable */
-extern BOOLEAN btsnd_hcic_write_dev_class(DEV_CLASS dev);                /* Write Class of Device */
-extern BOOLEAN btsnd_hcic_write_voice_settings(UINT16 flags);            /* Write Voice Settings */
+extern bool    btsnd_hcic_write_auth_enable(uint8_t flag);                 /* Write Authentication Enable */
+extern bool    btsnd_hcic_write_dev_class(DEV_CLASS dev);                /* Write Class of Device */
+extern bool    btsnd_hcic_write_voice_settings(uint16_t flags);            /* Write Voice Settings */
 
 /* Host Controller to Host flow control */
 #define HCI_HOST_FLOW_CTRL_OFF          0
@@ -556,15 +556,15 @@
 #define HCI_HOST_FLOW_CTRL_SCO_ON       2
 #define HCI_HOST_FLOW_CTRL_BOTH_ON      3
 
-extern BOOLEAN btsnd_hcic_write_auto_flush_tout(UINT16 handle,
-                                                UINT16 timeout);    /* Write Retransmit Timout */
+extern bool    btsnd_hcic_write_auto_flush_tout(uint16_t handle,
+                                                uint16_t timeout);    /* Write Retransmit Timout */
 
 #define HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT    4
 
 #define HCI_FLUSH_TOUT_HANDLE_OFF       0
 #define HCI_FLUSH_TOUT_TOUT_OFF         2
 
-extern BOOLEAN btsnd_hcic_read_tx_power(UINT16 handle, UINT8 type);     /* Read Tx Power */
+extern bool    btsnd_hcic_read_tx_power(uint16_t handle, uint8_t type);     /* Read Tx Power */
 
 #define HCIC_PARAM_SIZE_READ_TX_POWER    3
 
@@ -575,9 +575,9 @@
 #define HCI_READ_CURRENT                0x00
 #define HCI_READ_MAXIMUM                0x01
 
-extern BOOLEAN btsnd_hcic_host_num_xmitted_pkts (UINT8 num_handles,
-                                                 UINT16 *handle,
-                                                 UINT16 *num_pkts);         /* Set Host Buffer Size */
+extern bool    btsnd_hcic_host_num_xmitted_pkts (uint8_t num_handles,
+                                                 uint16_t *handle,
+                                                 uint16_t *num_pkts);         /* Set Host Buffer Size */
 
 #define HCIC_PARAM_SIZE_NUM_PKTS_DONE_SIZE    sizeof(btmsg_hcic_num_pkts_done_t)
 
@@ -588,7 +588,7 @@
 #define HCI_PKTS_DONE_NUM_PKTS_OFF      3
 
                                                                 /* Write Link Supervision Timeout */
-extern BOOLEAN btsnd_hcic_write_link_super_tout(UINT8 local_controller_id, UINT16 handle, UINT16 timeout);
+extern bool    btsnd_hcic_write_link_super_tout(uint8_t local_controller_id, uint16_t handle, uint16_t timeout);
 
 #define HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT        4
 
@@ -596,7 +596,7 @@
 #define HCI_LINK_SUPER_TOUT_TOUT_OFF    2
                                                                 /* Write Link Supervision Timeout */
 
-extern BOOLEAN btsnd_hcic_write_cur_iac_lap (UINT8 num_cur_iac,
+extern bool    btsnd_hcic_write_cur_iac_lap (uint8_t num_cur_iac,
                                              LAP * const iac_lap);  /* Write Current IAC LAP */
 
 #define MAX_IAC_LAPS    0x40
@@ -605,37 +605,37 @@
 #define HCI_WRITE_IAC_LAP_LAP_OFF       1
                                                                 /* Write Current IAC LAP */
 
-extern BOOLEAN btsnd_hcic_get_link_quality (UINT16 handle);            /* Get Link Quality */
-extern BOOLEAN btsnd_hcic_read_rssi (UINT16 handle);                   /* Read RSSI */
-extern BOOLEAN btsnd_hcic_enable_test_mode (void);                     /* Enable Device Under Test Mode */
-extern BOOLEAN btsnd_hcic_write_pagescan_type(UINT8 type);             /* Write Page Scan Type */
-extern BOOLEAN btsnd_hcic_write_inqscan_type(UINT8 type);              /* Write Inquiry Scan Type */
-extern BOOLEAN btsnd_hcic_write_inquiry_mode(UINT8 type);              /* Write Inquiry Mode */
+extern bool    btsnd_hcic_get_link_quality (uint16_t handle);            /* Get Link Quality */
+extern bool    btsnd_hcic_read_rssi (uint16_t handle);                   /* Read RSSI */
+extern bool    btsnd_hcic_enable_test_mode (void);                     /* Enable Device Under Test Mode */
+extern bool    btsnd_hcic_write_pagescan_type(uint8_t type);             /* Write Page Scan Type */
+extern bool    btsnd_hcic_write_inqscan_type(uint8_t type);              /* Write Inquiry Scan Type */
+extern bool    btsnd_hcic_write_inquiry_mode(uint8_t type);              /* Write Inquiry Mode */
 
 #define HCI_DATA_HANDLE_MASK 0x0FFF
 
-#define HCID_GET_HANDLE_EVENT(p)  (UINT16)((*((UINT8 *)((p) + 1) + (p)->offset) + \
-                                           (*((UINT8 *)((p) + 1) + (p)->offset + 1) << 8)))
+#define HCID_GET_HANDLE_EVENT(p)  (uint16_t)((*((uint8_t *)((p) + 1) + (p)->offset) + \
+                                           (*((uint8_t *)((p) + 1) + (p)->offset + 1) << 8)))
 
-#define HCID_GET_HANDLE(u16) (UINT16)((u16) & HCI_DATA_HANDLE_MASK)
+#define HCID_GET_HANDLE(u16) (uint16_t)((u16) & HCI_DATA_HANDLE_MASK)
 
 #define HCI_DATA_EVENT_MASK   3
 #define HCI_DATA_EVENT_OFFSET 12
-#define HCID_GET_EVENT(u16)   (UINT8)(((u16) >> HCI_DATA_EVENT_OFFSET) & HCI_DATA_EVENT_MASK)
+#define HCID_GET_EVENT(u16)   (uint8_t)(((u16) >> HCI_DATA_EVENT_OFFSET) & HCI_DATA_EVENT_MASK)
 
 #define HCI_DATA_BCAST_MASK   3
 #define HCI_DATA_BCAST_OFFSET 10
-#define HCID_GET_BCAST(u16)   (UINT8)(((u16) >> HCI_DATA_BCAST_OFFSET) & HCI_DATA_BCAST_MASK)
+#define HCID_GET_BCAST(u16)   (uint8_t)(((u16) >> HCI_DATA_BCAST_OFFSET) & HCI_DATA_BCAST_MASK)
 
-#define HCID_GET_ACL_LEN(p)     (UINT16)((*((UINT8 *)((p) + 1) + (p)->offset + 2) + \
-                                         (*((UINT8 *)((p) + 1) + (p)->offset + 3) << 8)))
+#define HCID_GET_ACL_LEN(p)     (uint16_t)((*((uint8_t *)((p) + 1) + (p)->offset + 2) + \
+                                         (*((uint8_t *)((p) + 1) + (p)->offset + 3) << 8)))
 
 #define HCID_HEADER_SIZE      4
 
-#define HCID_GET_SCO_LEN(p)  (*((UINT8 *)((p) + 1) + (p)->offset + 2))
+#define HCID_GET_SCO_LEN(p)  (*((uint8_t *)((p) + 1) + (p)->offset + 2))
 
-extern void btsnd_hcic_vendor_spec_cmd (void *buffer, UINT16 opcode,
-                                        UINT8 len, UINT8 *p_data,
+extern void btsnd_hcic_vendor_spec_cmd (void *buffer, uint16_t opcode,
+                                        uint8_t len, uint8_t *p_data,
                                         void *p_cmd_cplt_cback);
 
 #if (BLE_INCLUDED == TRUE)
@@ -687,125 +687,125 @@
 #define HCIC_PARAM_SIZE_BLE_WRITE_EXTENDED_SCAN_PARAM  11
 
 /* ULP HCI command */
-extern BOOLEAN btsnd_hcic_ble_set_evt_mask (BT_EVENT_MASK event_mask);
+extern bool    btsnd_hcic_ble_set_evt_mask (BT_EVENT_MASK event_mask);
 
-extern BOOLEAN btsnd_hcic_ble_read_buffer_size (void);
+extern bool    btsnd_hcic_ble_read_buffer_size (void);
 
-extern BOOLEAN btsnd_hcic_ble_read_local_spt_feat (void);
+extern bool    btsnd_hcic_ble_read_local_spt_feat (void);
 
-extern BOOLEAN btsnd_hcic_ble_set_local_used_feat (UINT8 feat_set[8]);
+extern bool    btsnd_hcic_ble_set_local_used_feat (uint8_t feat_set[8]);
 
-extern BOOLEAN btsnd_hcic_ble_set_random_addr (BD_ADDR random_addr);
+extern bool    btsnd_hcic_ble_set_random_addr (BD_ADDR random_addr);
 
-extern BOOLEAN btsnd_hcic_ble_write_adv_params (UINT16 adv_int_min, UINT16 adv_int_max,
-                                                UINT8 adv_type, UINT8 addr_type_own,
-                                                UINT8 addr_type_dir, BD_ADDR direct_bda,
-                                                UINT8 channel_map, UINT8 adv_filter_policy);
+extern bool    btsnd_hcic_ble_write_adv_params (uint16_t adv_int_min, uint16_t adv_int_max,
+                                                uint8_t adv_type, uint8_t addr_type_own,
+                                                uint8_t addr_type_dir, BD_ADDR direct_bda,
+                                                uint8_t channel_map, uint8_t adv_filter_policy);
 
-extern BOOLEAN btsnd_hcic_ble_read_adv_chnl_tx_power (void);
+extern bool    btsnd_hcic_ble_read_adv_chnl_tx_power (void);
 
-extern BOOLEAN btsnd_hcic_ble_set_adv_data (UINT8 data_len, UINT8 *p_data);
+extern bool    btsnd_hcic_ble_set_adv_data (uint8_t data_len, uint8_t *p_data);
 
-extern BOOLEAN btsnd_hcic_ble_set_scan_rsp_data (UINT8 data_len, UINT8 *p_scan_rsp);
+extern bool    btsnd_hcic_ble_set_scan_rsp_data (uint8_t data_len, uint8_t *p_scan_rsp);
 
-extern BOOLEAN btsnd_hcic_ble_set_adv_enable (UINT8 adv_enable);
+extern bool    btsnd_hcic_ble_set_adv_enable (uint8_t adv_enable);
 
-extern BOOLEAN btsnd_hcic_ble_set_scan_params (UINT8 scan_type,
-                                               UINT16 scan_int, UINT16 scan_win,
-                                               UINT8 addr_type, UINT8 scan_filter_policy);
+extern bool    btsnd_hcic_ble_set_scan_params (uint8_t scan_type,
+                                               uint16_t scan_int, uint16_t scan_win,
+                                               uint8_t addr_type, uint8_t scan_filter_policy);
 
-extern BOOLEAN btsnd_hcic_ble_set_scan_enable (UINT8 scan_enable, UINT8 duplicate);
+extern bool    btsnd_hcic_ble_set_scan_enable (uint8_t scan_enable, uint8_t duplicate);
 
-extern BOOLEAN btsnd_hcic_ble_create_ll_conn (UINT16 scan_int, UINT16 scan_win,
-                                              UINT8 init_filter_policy, UINT8 addr_type_peer, BD_ADDR bda_peer, UINT8 addr_type_own,
-                                              UINT16 conn_int_min, UINT16 conn_int_max, UINT16 conn_latency, UINT16 conn_timeout,
-                                              UINT16 min_ce_len, UINT16 max_ce_len);
+extern bool    btsnd_hcic_ble_create_ll_conn (uint16_t scan_int, uint16_t scan_win,
+                                              uint8_t init_filter_policy, uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t addr_type_own,
+                                              uint16_t conn_int_min, uint16_t conn_int_max, uint16_t conn_latency, uint16_t conn_timeout,
+                                              uint16_t min_ce_len, uint16_t max_ce_len);
 
-extern BOOLEAN btsnd_hcic_ble_create_conn_cancel (void);
+extern bool    btsnd_hcic_ble_create_conn_cancel (void);
 
-extern BOOLEAN btsnd_hcic_ble_read_white_list_size (void);
+extern bool    btsnd_hcic_ble_read_white_list_size (void);
 
-extern BOOLEAN btsnd_hcic_ble_clear_white_list (void);
+extern bool    btsnd_hcic_ble_clear_white_list (void);
 
-extern BOOLEAN btsnd_hcic_ble_add_white_list (UINT8 addr_type, BD_ADDR bda);
+extern bool    btsnd_hcic_ble_add_white_list (uint8_t addr_type, BD_ADDR bda);
 
-extern BOOLEAN btsnd_hcic_ble_remove_from_white_list (UINT8 addr_type, BD_ADDR bda);
+extern bool    btsnd_hcic_ble_remove_from_white_list (uint8_t addr_type, BD_ADDR bda);
 
-extern BOOLEAN btsnd_hcic_ble_upd_ll_conn_params (UINT16 handle, UINT16 conn_int_min, UINT16 conn_int_max,
-                                                  UINT16 conn_latency, UINT16 conn_timeout, UINT16 min_len, UINT16 max_len);
+extern bool    btsnd_hcic_ble_upd_ll_conn_params (uint16_t handle, uint16_t conn_int_min, uint16_t conn_int_max,
+                                                  uint16_t conn_latency, uint16_t conn_timeout, uint16_t min_len, uint16_t max_len);
 
-extern BOOLEAN btsnd_hcic_ble_set_host_chnl_class (UINT8 chnl_map[HCIC_BLE_CHNL_MAP_SIZE]);
+extern bool    btsnd_hcic_ble_set_host_chnl_class (uint8_t chnl_map[HCIC_BLE_CHNL_MAP_SIZE]);
 
-extern BOOLEAN btsnd_hcic_ble_read_chnl_map (UINT16 handle);
+extern bool    btsnd_hcic_ble_read_chnl_map (uint16_t handle);
 
-extern BOOLEAN btsnd_hcic_ble_read_remote_feat ( UINT16 handle);
+extern bool    btsnd_hcic_ble_read_remote_feat ( uint16_t handle);
 
-extern BOOLEAN btsnd_hcic_ble_encrypt (UINT8* key, UINT8 key_len, UINT8* plain_text, UINT8 pt_len, void *p_cmd_cplt_cback);
+extern bool    btsnd_hcic_ble_encrypt (uint8_t* key, uint8_t key_len, uint8_t* plain_text, uint8_t pt_len, void *p_cmd_cplt_cback);
 
-extern BOOLEAN btsnd_hcic_ble_rand (void *p_cmd_cplt_cback);
+extern bool    btsnd_hcic_ble_rand (void *p_cmd_cplt_cback);
 
-extern BOOLEAN btsnd_hcic_ble_start_enc ( UINT16 handle,
-                                          UINT8 rand[HCIC_BLE_RAND_DI_SIZE],
-                                          UINT16 ediv, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
+extern bool    btsnd_hcic_ble_start_enc ( uint16_t handle,
+                                          uint8_t rand[HCIC_BLE_RAND_DI_SIZE],
+                                          uint16_t ediv, uint8_t ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
 
-extern BOOLEAN btsnd_hcic_ble_ltk_req_reply (UINT16 handle, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
+extern bool    btsnd_hcic_ble_ltk_req_reply (uint16_t handle, uint8_t ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
 
-extern BOOLEAN btsnd_hcic_ble_ltk_req_neg_reply (UINT16 handle);
+extern bool    btsnd_hcic_ble_ltk_req_neg_reply (uint16_t handle);
 
-extern BOOLEAN btsnd_hcic_ble_read_supported_states (void);
+extern bool    btsnd_hcic_ble_read_supported_states (void);
 
-extern BOOLEAN btsnd_hcic_ble_write_host_supported (UINT8 le_host_spt, UINT8 simul_le_host_spt);
+extern bool    btsnd_hcic_ble_write_host_supported (uint8_t le_host_spt, uint8_t simul_le_host_spt);
 
-extern BOOLEAN btsnd_hcic_ble_read_host_supported (void);
+extern bool    btsnd_hcic_ble_read_host_supported (void);
 
-extern BOOLEAN btsnd_hcic_ble_receiver_test(UINT8 rx_freq);
+extern bool    btsnd_hcic_ble_receiver_test(uint8_t rx_freq);
 
-extern BOOLEAN btsnd_hcic_ble_transmitter_test(UINT8 tx_freq, UINT8 test_data_len,
-                                               UINT8 payload);
-extern BOOLEAN btsnd_hcic_ble_test_end(void);
+extern bool    btsnd_hcic_ble_transmitter_test(uint8_t tx_freq, uint8_t test_data_len,
+                                               uint8_t payload);
+extern bool    btsnd_hcic_ble_test_end(void);
 
-#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
+#if (BLE_LLT_INCLUDED == TRUE)
 
 #define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_REPLY           14
-extern BOOLEAN btsnd_hcic_ble_rc_param_req_reply(UINT16 handle,
-                                                 UINT16 conn_int_min, UINT16 conn_int_max,
-                                                 UINT16 conn_latency, UINT16 conn_timeout,
-                                                 UINT16 min_ce_len, UINT16 max_ce_len);
+extern bool    btsnd_hcic_ble_rc_param_req_reply(uint16_t handle,
+                                                 uint16_t conn_int_min, uint16_t conn_int_max,
+                                                 uint16_t conn_latency, uint16_t conn_timeout,
+                                                 uint16_t min_ce_len, uint16_t max_ce_len);
 
 #define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_NEG_REPLY       3
-extern BOOLEAN btsnd_hcic_ble_rc_param_req_neg_reply(UINT16 handle, UINT8 reason);
+extern bool    btsnd_hcic_ble_rc_param_req_neg_reply(uint16_t handle, uint8_t reason);
 
 #endif /* BLE_LLT_INCLUDED */
 
-extern BOOLEAN btsnd_hcic_ble_set_data_length(UINT16 conn_handle, UINT16 tx_octets,
-                                                      UINT16 tx_time);
+extern bool    btsnd_hcic_ble_set_data_length(uint16_t conn_handle, uint16_t tx_octets,
+                                                      uint16_t tx_time);
 
-extern BOOLEAN btsnd_hcic_ble_add_device_resolving_list (UINT8 addr_type_peer,
+extern bool    btsnd_hcic_ble_add_device_resolving_list (uint8_t addr_type_peer,
                                                                BD_ADDR bda_peer,
-                                                               UINT8 irk_peer[HCIC_BLE_IRK_SIZE],
-                                                               UINT8 irk_local[HCIC_BLE_IRK_SIZE]);
+                                                               uint8_t irk_peer[HCIC_BLE_IRK_SIZE],
+                                                               uint8_t irk_local[HCIC_BLE_IRK_SIZE]);
 
-extern BOOLEAN btsnd_hcic_ble_rm_device_resolving_list (UINT8 addr_type_peer,
+extern bool    btsnd_hcic_ble_rm_device_resolving_list (uint8_t addr_type_peer,
                                                                 BD_ADDR bda_peer);
 
-extern BOOLEAN btsnd_hcic_ble_clear_resolving_list (void);
+extern bool    btsnd_hcic_ble_clear_resolving_list (void);
 
-extern BOOLEAN btsnd_hcic_ble_read_resolvable_addr_peer (UINT8 addr_type_peer,
+extern bool    btsnd_hcic_ble_read_resolvable_addr_peer (uint8_t addr_type_peer,
                                                                  BD_ADDR bda_peer);
 
-extern BOOLEAN btsnd_hcic_ble_read_resolvable_addr_local (UINT8 addr_type_peer,
+extern bool    btsnd_hcic_ble_read_resolvable_addr_local (uint8_t addr_type_peer,
                                                                  BD_ADDR bda_peer);
 
-extern BOOLEAN btsnd_hcic_ble_set_addr_resolution_enable (UINT8 addr_resolution_enable);
+extern bool    btsnd_hcic_ble_set_addr_resolution_enable (uint8_t addr_resolution_enable);
 
-extern BOOLEAN btsnd_hcic_ble_set_rand_priv_addr_timeout (UINT16 rpa_timout);
+extern bool    btsnd_hcic_ble_set_rand_priv_addr_timeout (uint16_t rpa_timout);
 
 #endif /* BLE_INCLUDED */
 
-extern BOOLEAN btsnd_hcic_read_authenticated_payload_tout(UINT16 handle);
+extern bool    btsnd_hcic_read_authenticated_payload_tout(uint16_t handle);
 
-extern BOOLEAN btsnd_hcic_write_authenticated_payload_tout(UINT16 handle,
-                                                                   UINT16 timeout);
+extern bool    btsnd_hcic_write_authenticated_payload_tout(uint16_t handle,
+                                                                   uint16_t timeout);
 
 #define HCIC_PARAM_SIZE_WRITE_AUTHENT_PAYLOAD_TOUT  4
 
diff --git a/stack/include/hiddefs.h b/stack/include/hiddefs.h
index 1483b7c..705fcce 100644
--- a/stack/include/hiddefs.h
+++ b/stack/include/hiddefs.h
@@ -54,7 +54,7 @@
    HID_ERR_INVALID = 0xFF
 };
 
-typedef UINT8 tHID_STATUS;
+typedef uint8_t tHID_STATUS;
 
 #define    HID_L2CAP_CONN_FAIL (0x0100) /* Connection Attempt was made but failed */
 #define    HID_L2CAP_REQ_FAIL  (0x0200)  /* L2CAP_ConnectReq API failed */
@@ -77,7 +77,7 @@
 
 #define HID_GET_TRANS_FROM_HDR(x) (((x) >> 4) & 0x0f)
 #define HID_GET_PARAM_FROM_HDR(x) ((x) & 0x0f)
-#define HID_BUILD_HDR(t,p)  (UINT8)(((t) << 4) | ((p) & 0x0f))
+#define HID_BUILD_HDR(t,p)  (uint8_t)(((t) << 4) | ((p) & 0x0f))
 
 
 /* Parameters for Handshake
@@ -131,8 +131,8 @@
 
 typedef struct desc_info
 {
-    UINT16 dl_len;
-    UINT8 *dsc_list;
+    uint16_t dl_len;
+    uint8_t *dsc_list;
 } tHID_DEV_DSCP_INFO;
 
 #define HID_SSR_PARAM_INVALID    0xffff
@@ -142,16 +142,16 @@
     char svc_name[HID_MAX_SVC_NAME_LEN];   /*Service Name */
     char svc_descr[HID_MAX_SVC_DESCR_LEN]; /*Service Description*/
     char prov_name[HID_MAX_PROV_NAME_LEN]; /*Provider Name.*/
-    UINT16    rel_num;    /*Release Number */
-    UINT16    hpars_ver;  /*HID Parser Version.*/
-    UINT16    ssr_max_latency; /* HIDSSRHostMaxLatency value, if HID_SSR_PARAM_INVALID not used*/
-    UINT16    ssr_min_tout; /* HIDSSRHostMinTimeout value, if HID_SSR_PARAM_INVALID not used* */
-    UINT8     sub_class;    /*Device Subclass.*/
-    UINT8     ctry_code;     /*Country Code.*/
-    UINT16    sup_timeout;/* Supervisory Timeout */
+    uint16_t  rel_num;    /*Release Number */
+    uint16_t  hpars_ver;  /*HID Parser Version.*/
+    uint16_t  ssr_max_latency; /* HIDSSRHostMaxLatency value, if HID_SSR_PARAM_INVALID not used*/
+    uint16_t  ssr_min_tout; /* HIDSSRHostMinTimeout value, if HID_SSR_PARAM_INVALID not used* */
+    uint8_t   sub_class;    /*Device Subclass.*/
+    uint8_t   ctry_code;     /*Country Code.*/
+    uint16_t  sup_timeout;/* Supervisory Timeout */
 
     tHID_DEV_DSCP_INFO  dscp_info;   /* Descriptor list and Report list to be set in the SDP record.
-                                       This parameter is used if HID_DEV_USE_GLB_SDP_REC is set to FALSE.*/
+                                       This parameter is used if HID_DEV_USE_GLB_SDP_REC is set to false.*/
     tSDP_DISC_REC       *p_sdp_layer_rec;
 } tHID_DEV_SDP_INFO;
 
diff --git a/stack/include/hidh_api.h b/stack/include/hidh_api.h
index 2be317b..01d7678 100644
--- a/stack/include/hidh_api.h
+++ b/stack/include/hidh_api.h
@@ -53,7 +53,7 @@
 **  Type Definitions
 *****************************************************************************/
 
-typedef void (tHID_HOST_SDP_CALLBACK) (UINT16 result, UINT16 attr_mask,
+typedef void (tHID_HOST_SDP_CALLBACK) (uint16_t result, uint16_t attr_mask,
                                        tHID_DEV_SDP_INFO *sdp_rec );
 
 /* HID-HOST returns the events in the following table to the application via tHID_HOST_DEV_CALLBACK
@@ -80,10 +80,10 @@
     HID_HDEV_EVT_HANDSHAKE,
     HID_HDEV_EVT_VC_UNPLUG
 };
-typedef void (tHID_HOST_DEV_CALLBACK) (UINT8 dev_handle,
+typedef void (tHID_HOST_DEV_CALLBACK) (uint8_t dev_handle,
                                        BD_ADDR addr,
-                                       UINT8 event, /* Event from HID-DEVICE. */
-                                       UINT32 data, /* Integer data corresponding to the event.*/
+                                       uint8_t event, /* Event from HID-DEVICE. */
+                                       uint32_t data, /* Integer data corresponding to the event.*/
                                        BT_HDR *p_buf ); /* Pointer data corresponding to the event. */
 
 
@@ -102,7 +102,7 @@
 *******************************************************************************/
 extern tHID_STATUS HID_HostGetSDPRecord (BD_ADDR addr,
                                          tSDP_DISCOVERY_DB *p_db,
-                                         UINT32 db_len,
+                                         uint32_t db_len,
                                          tHID_HOST_SDP_CALLBACK *sdp_cback );
 
 /*******************************************************************************
@@ -136,8 +136,8 @@
 ** Returns          tHID_STATUS
 **
 *******************************************************************************/
-extern tHID_STATUS HID_HostAddDev (BD_ADDR addr, UINT16 attr_mask,
-                                   UINT8 *handle );
+extern tHID_STATUS HID_HostAddDev (BD_ADDR addr, uint16_t attr_mask,
+                                   uint8_t *handle );
 
 /*******************************************************************************
 **
@@ -148,7 +148,7 @@
 ** Returns          tHID_STATUS
 **
 *******************************************************************************/
-extern tHID_STATUS HID_HostRemoveDev (UINT8 dev_handle );
+extern tHID_STATUS HID_HostRemoveDev (uint8_t dev_handle );
 
 /*******************************************************************************
 **
@@ -160,7 +160,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern tHID_STATUS HID_HostOpenDev (UINT8 dev_handle );
+extern tHID_STATUS HID_HostOpenDev (uint8_t dev_handle );
 
 /*******************************************************************************
 **
@@ -171,9 +171,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern tHID_STATUS HID_HostWriteDev(UINT8 dev_handle, UINT8 t_type,
-                                    UINT8 param, UINT16 data,
-                                    UINT8 report_id, BT_HDR *pbuf);
+extern tHID_STATUS HID_HostWriteDev(uint8_t dev_handle, uint8_t t_type,
+                                    uint8_t param, uint16_t data,
+                                    uint8_t report_id, BT_HDR *pbuf);
 
 /*******************************************************************************
 **
@@ -184,7 +184,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern tHID_STATUS HID_HostCloseDev(UINT8 dev_handle );
+extern tHID_STATUS HID_HostCloseDev(uint8_t dev_handle );
 
 /*******************************************************************************
 ** Function         HID_HostInit
@@ -203,7 +203,7 @@
 **
 ** Returns         tHID_STATUS
 *******************************************************************************/
-extern tHID_STATUS HID_HostSetSecurityLevel(const char serv_name[], UINT8 sec_lvl );
+extern tHID_STATUS HID_HostSetSecurityLevel(const char serv_name[], uint8_t sec_lvl );
 
 /*******************************************************************************
 **
@@ -211,10 +211,10 @@
 **
 ** Description      This function checks if this device is  of type HID Device
 **
-** Returns          TRUE if device exists else FALSE
+** Returns          true if device exists else false
 **
 *******************************************************************************/
-BOOLEAN hid_known_hid_device (BD_ADDR bd_addr);
+bool    hid_known_hid_device (BD_ADDR bd_addr);
 
 
 /*******************************************************************************
@@ -227,7 +227,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-extern UINT8 HID_HostSetTraceLevel (UINT8 new_level);
+extern uint8_t HID_HostSetTraceLevel (uint8_t new_level);
 
 #ifdef __cplusplus
 }
diff --git a/stack/include/l2c_api.h b/stack/include/l2c_api.h
index ffe4fac..033af10 100644
--- a/stack/include/l2c_api.h
+++ b/stack/include/l2c_api.h
@@ -52,8 +52,8 @@
 #define L2CAP_PING_RESULT_NO_RESP   2       /* Remote L2CAP did not reply */
 
 /* result code for L2CA_DataWrite() */
-#define L2CAP_DW_FAILED        FALSE
-#define L2CAP_DW_SUCCESS       TRUE
+#define L2CAP_DW_FAILED        false
+#define L2CAP_DW_SUCCESS       true
 #define L2CAP_DW_CONGESTED     2
 
 /* Values for priority parameter to L2CA_SetAclPriority */
@@ -65,7 +65,7 @@
 #define L2CAP_CHNL_PRIORITY_MEDIUM  1
 #define L2CAP_CHNL_PRIORITY_LOW     2
 
-typedef UINT8 tL2CAP_CHNL_PRIORITY;
+typedef uint8_t tL2CAP_CHNL_PRIORITY;
 
 /* Values for Tx/Rx data rate parameter to L2CA_SetChnlDataRate */
 #define L2CAP_CHNL_DATA_RATE_HIGH       3
@@ -73,7 +73,7 @@
 #define L2CAP_CHNL_DATA_RATE_LOW        1
 #define L2CAP_CHNL_DATA_RATE_NO_TRAFFIC 0
 
-typedef UINT8 tL2CAP_CHNL_DATA_RATE;
+typedef uint8_t tL2CAP_CHNL_DATA_RATE;
 
 /* Data Packet Flags  (bits 2-15 are reserved) */
 /* layer specific 14-15 bits are used for FCR SAR */
@@ -141,13 +141,13 @@
 #define L2CAP_FCR_STREAM_MODE   0x04
 #define L2CAP_FCR_LE_COC_MODE   0x05
 
-    UINT8  mode;
+    uint8_t mode;
 
-    UINT8  tx_win_sz;
-    UINT8  max_transmit;
-    UINT16 rtrans_tout;
-    UINT16 mon_tout;
-    UINT16 mps;
+    uint8_t tx_win_sz;
+    uint8_t max_transmit;
+    uint16_t rtrans_tout;
+    uint16_t mon_tout;
+    uint16_t mps;
 } tL2CAP_FCR_OPTS;
 
 /* Define a structure to hold the configuration parameters. Since the
@@ -156,20 +156,20 @@
 */
 typedef struct
 {
-    UINT16      result;                 /* Only used in confirm messages */
-    BOOLEAN     mtu_present;
-    UINT16      mtu;
-    BOOLEAN     qos_present;
+    uint16_t    result;                 /* Only used in confirm messages */
+    bool        mtu_present;
+    uint16_t    mtu;
+    bool        qos_present;
     FLOW_SPEC   qos;
-    BOOLEAN     flush_to_present;
-    UINT16      flush_to;
-    BOOLEAN     fcr_present;
+    bool        flush_to_present;
+    uint16_t    flush_to;
+    bool        fcr_present;
     tL2CAP_FCR_OPTS fcr;
-    BOOLEAN     fcs_present;            /* Optionally bypasses FCS checks */
-    UINT8       fcs;                    /* '0' if desire is to bypass FCS, otherwise '1' */
-    BOOLEAN               ext_flow_spec_present;
+    bool        fcs_present;            /* Optionally bypasses FCS checks */
+    uint8_t     fcs;                    /* '0' if desire is to bypass FCS, otherwise '1' */
+    bool                  ext_flow_spec_present;
     tHCI_EXT_FLOW_SPEC    ext_flow_spec;
-    UINT16      flags;                  /* bit 0: 0-no continuation, 1-continuation */
+    uint16_t    flags;                  /* bit 0: 0-no continuation, 1-continuation */
 } tL2CAP_CFG_INFO;
 
 /* Define a structure to hold the configuration parameter for LE L2CAP connection
@@ -177,9 +177,9 @@
 */
 typedef struct
 {
-    UINT16  mtu;
-    UINT16  mps;
-    UINT16  credits;
+    uint16_t mtu;
+    uint16_t mps;
+    uint16_t credits;
 } tL2CAP_LE_CFG_INFO;
 
 /* L2CAP channel configured field bitmap */
@@ -190,7 +190,7 @@
 #define L2CAP_CH_CFG_MASK_FCS           0x0010
 #define L2CAP_CH_CFG_MASK_EXT_FLOW_SPEC 0x0020
 
-typedef UINT16 tL2CAP_CH_CFG_BITS;
+typedef uint16_t tL2CAP_CH_CFG_BITS;
 
 /*********************************
 **  Callback Functions Prototypes
@@ -202,48 +202,48 @@
 **              PSM that the remote wants to connect to
 **              Identifier that the remote sent
 */
-typedef void (tL2CA_CONNECT_IND_CB) (BD_ADDR, UINT16, UINT16, UINT8);
+typedef void (tL2CA_CONNECT_IND_CB) (BD_ADDR, uint16_t, uint16_t, uint8_t);
 
 
 /* Connection confirmation callback prototype. Parameters are
 **              Local CID
 **              Result - 0 = connected, non-zero means failure reason
 */
-typedef void (tL2CA_CONNECT_CFM_CB) (UINT16, UINT16);
+typedef void (tL2CA_CONNECT_CFM_CB) (uint16_t, uint16_t);
 
 
 /* Connection pending callback prototype. Parameters are
 **              Local CID
 */
-typedef void (tL2CA_CONNECT_PND_CB) (UINT16);
+typedef void (tL2CA_CONNECT_PND_CB) (uint16_t);
 
 
 /* Configuration indication callback prototype. Parameters are
 **              Local CID assigned to the connection
 **              Pointer to configuration info
 */
-typedef void (tL2CA_CONFIG_IND_CB) (UINT16, tL2CAP_CFG_INFO *);
+typedef void (tL2CA_CONFIG_IND_CB) (uint16_t, tL2CAP_CFG_INFO *);
 
 
 /* Configuration confirm callback prototype. Parameters are
 **              Local CID assigned to the connection
 **              Pointer to configuration info
 */
-typedef void (tL2CA_CONFIG_CFM_CB) (UINT16, tL2CAP_CFG_INFO *);
+typedef void (tL2CA_CONFIG_CFM_CB) (uint16_t, tL2CAP_CFG_INFO *);
 
 
 /* Disconnect indication callback prototype. Parameters are
 **              Local CID
 **              Boolean whether upper layer should ack this
 */
-typedef void (tL2CA_DISCONNECT_IND_CB) (UINT16, BOOLEAN);
+typedef void (tL2CA_DISCONNECT_IND_CB) (uint16_t, bool   );
 
 
 /* Disconnect confirm callback prototype. Parameters are
 **              Local CID
 **              Result
 */
-typedef void (tL2CA_DISCONNECT_CFM_CB) (UINT16, UINT16);
+typedef void (tL2CA_DISCONNECT_CFM_CB) (uint16_t, uint16_t);
 
 
 /* QOS Violation indication callback prototype. Parameters are
@@ -256,7 +256,7 @@
 **              Local CID
 **              Address of buffer
 */
-typedef void (tL2CA_DATA_IND_CB) (UINT16, BT_HDR *);
+typedef void (tL2CA_DATA_IND_CB) (uint16_t, BT_HDR *);
 
 
 /* Echo response callback prototype. Note that this is not included in the
@@ -264,21 +264,21 @@
 ** actually send an echo request. Parameters are
 **              Result
 */
-typedef void (tL2CA_ECHO_RSP_CB) (UINT16);
+typedef void (tL2CA_ECHO_RSP_CB) (uint16_t);
 
 
 /* Callback function prototype to pass broadcom specific echo response  */
 /* to the upper layer                                                   */
-typedef void (tL2CA_ECHO_DATA_CB) (BD_ADDR, UINT16, UINT8 *);
+typedef void (tL2CA_ECHO_DATA_CB) (BD_ADDR, uint16_t, uint8_t *);
 
 
 /* Congestion status callback protype. This callback is optional. If
 ** an application tries to send data when the transmit queue is full,
 ** the data will anyways be dropped. The parameter is:
 **              Local CID
-**              TRUE if congested, FALSE if uncongested
+**              true if congested, false if uncongested
 */
-typedef void (tL2CA_CONGESTION_STATUS_CB) (UINT16, BOOLEAN);
+typedef void (tL2CA_CONGESTION_STATUS_CB) (uint16_t, bool   );
 
 /* Callback prototype for number of packets completed events.
 ** This callback notifies the application when Number of Completed Packets
@@ -296,7 +296,7 @@
 **              Local CID
 **              Number of SDUs sent or dropped
 */
-typedef void (tL2CA_TX_COMPLETE_CB) (UINT16, UINT16);
+typedef void (tL2CA_TX_COMPLETE_CB) (uint16_t, uint16_t);
 
 /* Define the structure that applications use to register with
 ** L2CAP. This structure includes callback functions. All functions
@@ -324,12 +324,12 @@
 */
 typedef struct
 {
-    UINT8       preferred_mode;
-    UINT8       allowed_modes;
-    UINT16      user_rx_buf_size;
-    UINT16      user_tx_buf_size;
-    UINT16      fcr_rx_buf_size;
-    UINT16      fcr_tx_buf_size;
+    uint8_t     preferred_mode;
+    uint8_t     allowed_modes;
+    uint16_t    user_rx_buf_size;
+    uint16_t    user_tx_buf_size;
+    uint16_t    fcr_rx_buf_size;
+    uint16_t    fcr_tx_buf_size;
 
 } tL2CAP_ERTM_INFO;
 
@@ -366,7 +366,7 @@
 **                  BTM_SetSecurityLevel().
 **
 *******************************************************************************/
-extern UINT16 L2CA_Register (UINT16 psm, tL2CAP_APPL_INFO *p_cb_info);
+extern uint16_t L2CA_Register (uint16_t psm, tL2CAP_APPL_INFO *p_cb_info);
 
 /*******************************************************************************
 **
@@ -378,7 +378,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void L2CA_Deregister (UINT16 psm);
+extern void L2CA_Deregister (uint16_t psm);
 
 /*******************************************************************************
 **
@@ -390,7 +390,7 @@
 ** Returns          PSM to use.
 **
 *******************************************************************************/
-extern UINT16 L2CA_AllocatePSM(void);
+extern uint16_t L2CA_AllocatePSM(void);
 
 /*******************************************************************************
 **
@@ -404,7 +404,7 @@
 ** Returns          the CID of the connection, or 0 if it failed to start
 **
 *******************************************************************************/
-extern UINT16 L2CA_ConnectReq (UINT16 psm, BD_ADDR p_bd_addr);
+extern uint16_t L2CA_ConnectReq (uint16_t psm, BD_ADDR p_bd_addr);
 
 /*******************************************************************************
 **
@@ -414,11 +414,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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_ConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid,
-                                        UINT16 result, UINT16 status);
+extern bool    L2CA_ConnectRsp (BD_ADDR p_bd_addr, uint8_t id, uint16_t lcid,
+                                        uint16_t result, uint16_t status);
 
 /*******************************************************************************
 **
@@ -433,7 +433,7 @@
 ** Returns          the CID of the connection, or 0 if it failed to start
 **
 *******************************************************************************/
-extern UINT16 L2CA_ErtmConnectReq (UINT16 psm, BD_ADDR p_bd_addr,
+extern uint16_t L2CA_ErtmConnectReq (uint16_t psm, BD_ADDR p_bd_addr,
                                            tL2CAP_ERTM_INFO *p_ertm_info);
 
 /*******************************************************************************
@@ -450,7 +450,7 @@
 **                  and BTM_SetSecurityLevel().
 **
 *******************************************************************************/
-extern UINT16 L2CA_RegisterLECoc (UINT16 psm, tL2CAP_APPL_INFO *p_cb_info);
+extern uint16_t L2CA_RegisterLECoc (uint16_t psm, tL2CAP_APPL_INFO *p_cb_info);
 
 /*******************************************************************************
 **
@@ -462,7 +462,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern void L2CA_DeregisterLECoc (UINT16 psm);
+extern void L2CA_DeregisterLECoc (uint16_t psm);
 
 /*******************************************************************************
 **
@@ -476,7 +476,7 @@
 ** Returns          the CID of the connection, or 0 if it failed to start
 **
 *******************************************************************************/
-extern UINT16 L2CA_ConnectLECocReq (UINT16 psm, BD_ADDR p_bd_addr, tL2CAP_LE_CFG_INFO *p_cfg);
+extern uint16_t L2CA_ConnectLECocReq (uint16_t psm, BD_ADDR p_bd_addr, tL2CAP_LE_CFG_INFO *p_cfg);
 
 /*******************************************************************************
 **
@@ -486,11 +486,11 @@
 **                  L2CAP LE 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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_ConnectLECocRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid, UINT16 result,
-                                         UINT16 status, tL2CAP_LE_CFG_INFO *p_cfg);
+extern 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);
 
 /*******************************************************************************
 **
@@ -498,10 +498,10 @@
 **
 **  Description      Get peers configuration for LE Connection Oriented Channel.
 **
-**  Return value:    TRUE if peer is connected
+**  Return value:    true if peer is connected
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_GetPeerLECocConfig (UINT16 lcid, tL2CAP_LE_CFG_INFO* peer_cfg);
+extern bool    L2CA_GetPeerLECocConfig (uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg);
 
 // This function sets the callback routines for the L2CAP connection referred to by
 // |local_cid|. The callback routines can only be modified for outgoing connections
@@ -519,11 +519,11 @@
 **                  indication callback, and for which the higher layer wants
 **                  to use Enhanced Retransmission Mode.
 **
-** Returns          TRUE for success, FALSE for failure
+** Returns          true for success, false for failure
 **
 *******************************************************************************/
-extern BOOLEAN  L2CA_ErtmConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid,
-                                             UINT16 result, UINT16 status,
+extern 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);
 
 /*******************************************************************************
@@ -532,10 +532,10 @@
 **
 ** Description      Higher layers call this function to send configuration.
 **
-** Returns          TRUE if configuration sent, else FALSE
+** Returns          true if configuration sent, else false
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_ConfigReq (UINT16 cid, tL2CAP_CFG_INFO *p_cfg);
+extern bool    L2CA_ConfigReq (uint16_t cid, tL2CAP_CFG_INFO *p_cfg);
 
 /*******************************************************************************
 **
@@ -544,10 +544,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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_ConfigRsp (UINT16 cid, tL2CAP_CFG_INFO *p_cfg);
+extern bool    L2CA_ConfigRsp (uint16_t cid, tL2CAP_CFG_INFO *p_cfg);
 
 /*******************************************************************************
 **
@@ -555,10 +555,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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_DisconnectReq (UINT16 cid);
+extern bool    L2CA_DisconnectReq (uint16_t cid);
 
 /*******************************************************************************
 **
@@ -570,7 +570,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_DisconnectRsp (UINT16 cid);
+extern bool    L2CA_DisconnectRsp (uint16_t cid);
 
 /*******************************************************************************
 **
@@ -578,12 +578,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
 **
 *******************************************************************************/
-extern UINT8 L2CA_DataWrite (UINT16 cid, BT_HDR *p_data);
+extern uint8_t L2CA_DataWrite (uint16_t cid, BT_HDR *p_data);
 
 /*******************************************************************************
 **
@@ -591,10 +591,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.
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_Ping (BD_ADDR p_bd_addr, tL2CA_ECHO_RSP_CB *p_cb);
+extern bool    L2CA_Ping (BD_ADDR p_bd_addr, tL2CA_ECHO_RSP_CB *p_cb);
 
 /*******************************************************************************
 **
@@ -603,10 +603,10 @@
 ** 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.
 **
 *******************************************************************************/
-extern BOOLEAN  L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_callback);
+extern bool     L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_callback);
 
 // Given a local channel identifier, |lcid|, this function returns the bound remote
 // channel identifier, |rcid|, and the ACL link handle, |handle|. If |lcid| is not
@@ -626,11 +626,11 @@
 **                  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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout,
-                                            BOOLEAN is_global);
+extern bool    L2CA_SetIdleTimeout (uint16_t cid, uint16_t timeout,
+                                            bool    is_global);
 
 /*******************************************************************************
 **
@@ -646,12 +646,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.
 *******************************************************************************/
-extern BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout,
+extern bool    L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, uint16_t timeout,
                                            tBT_TRANSPORT transport);
 
 /*******************************************************************************
@@ -664,7 +664,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-extern UINT8 L2CA_SetTraceLevel (UINT8 trace_level);
+extern uint8_t L2CA_SetTraceLevel (uint8_t trace_level);
 
 /*******************************************************************************
 **
@@ -682,7 +682,7 @@
 ** Returns      the new (current) role
 **
 *******************************************************************************/
-extern UINT8 L2CA_SetDesireRole (UINT8 new_role);
+extern uint8_t L2CA_SetDesireRole (uint8_t new_role);
 
 /*******************************************************************************
 **
@@ -693,7 +693,7 @@
 ** Returns      CID of 0 if none.
 **
 *******************************************************************************/
-extern UINT16 L2CA_LocalLoopbackReq (UINT16 psm, UINT16 handle, BD_ADDR p_bd_addr);
+extern uint16_t L2CA_LocalLoopbackReq (uint16_t psm, uint16_t handle, BD_ADDR p_bd_addr);
 
 /*******************************************************************************
 **
@@ -709,7 +709,7 @@
 ** Returns      Number of buffers left queued for that CID
 **
 *******************************************************************************/
-extern UINT16   L2CA_FlushChannel (UINT16 lcid, UINT16 num_to_flush);
+extern uint16_t L2CA_FlushChannel (uint16_t lcid, uint16_t num_to_flush);
 
 
 /*******************************************************************************
@@ -720,10 +720,10 @@
 **                  (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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_SetAclPriority (BD_ADDR bd_addr, UINT8 priority);
+extern bool    L2CA_SetAclPriority (BD_ADDR bd_addr, uint8_t priority);
 
 /*******************************************************************************
 **
@@ -731,12 +731,12 @@
 **
 ** 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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_FlowControl (UINT16 cid, BOOLEAN data_enabled);
+extern bool    L2CA_FlowControl (uint16_t cid, bool    data_enabled);
 
 /*******************************************************************************
 **
@@ -744,11 +744,11 @@
 **
 ** 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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_SendTestSFrame (UINT16 cid, UINT8 sup_type,
-                                            UINT8 back_track);
+extern bool    L2CA_SendTestSFrame (uint16_t cid, uint8_t sup_type,
+                                            uint8_t back_track);
 
 /*******************************************************************************
 **
@@ -756,10 +756,10 @@
 **
 ** Description      Sets the transmission priority for a channel. (FCR Mode)
 **
-** Returns          TRUE if a valid channel, else FALSE
+** Returns          true if a valid channel, else false
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_SetTxPriority (UINT16 cid, tL2CAP_CHNL_PRIORITY priority);
+extern bool    L2CA_SetTxPriority (uint16_t cid, tL2CAP_CHNL_PRIORITY priority);
 
 /*******************************************************************************
 **
@@ -773,7 +773,7 @@
 ** Returns
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_RegForNoCPEvt(tL2CA_NOCP_CB *p_cb, BD_ADDR p_bda);
+extern bool    L2CA_RegForNoCPEvt(tL2CA_NOCP_CB *p_cb, BD_ADDR p_bda);
 
 /*******************************************************************************
 **
@@ -781,10 +781,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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_SetChnlDataRate (UINT16 cid, tL2CAP_CHNL_DATA_RATE tx, tL2CAP_CHNL_DATA_RATE rx);
+extern bool    L2CA_SetChnlDataRate (uint16_t cid, tL2CAP_CHNL_DATA_RATE tx, tL2CAP_CHNL_DATA_RATE rx);
 
 typedef void (tL2CA_RESERVE_CMPL_CBACK) (void);
 
@@ -801,15 +801,15 @@
 **                           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.
 *******************************************************************************/
-extern BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout);
+extern bool    L2CA_SetFlushTimeout (BD_ADDR bd_addr, uint16_t flush_tout);
 
 /*******************************************************************************
 **
@@ -821,12 +821,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
 **
 *******************************************************************************/
-extern UINT8 L2CA_DataWriteEx (UINT16 cid, BT_HDR *p_data, UINT16 flags);
+extern uint8_t L2CA_DataWriteEx (uint16_t cid, BT_HDR *p_data, uint16_t flags);
 
 /*******************************************************************************
 **
@@ -835,10 +835,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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_SetChnlFlushability (UINT16 cid, BOOLEAN is_flushable);
+extern bool    L2CA_SetChnlFlushability (uint16_t cid, bool    is_flushable);
 
 /*******************************************************************************
 **
@@ -849,10 +849,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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_GetPeerFeatures (BD_ADDR bd_addr, UINT32 *p_ext_feat, UINT8 *p_chnl_mask);
+extern bool    L2CA_GetPeerFeatures (BD_ADDR bd_addr, uint32_t *p_ext_feat, uint8_t *p_chnl_mask);
 
 /*******************************************************************************
 **
@@ -863,10 +863,10 @@
 **  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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr);
+extern bool    L2CA_GetBDAddrbyHandle (uint16_t handle, BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
@@ -879,7 +879,7 @@
 **  Return value:    Channel mode
 **
 *******************************************************************************/
-extern UINT8 L2CA_GetChnlFcrMode (UINT16 lcid);
+extern uint8_t L2CA_GetChnlFcrMode (uint16_t lcid);
 
 
 /*******************************************************************************
@@ -896,7 +896,7 @@
 #define L2CAP_UCD_INFO_TYPE_RECEPTION   0x01
 #define L2CAP_UCD_INFO_TYPE_MTU         0x02
 
-typedef void (tL2CA_UCD_DISCOVER_CB) (BD_ADDR, UINT8, UINT32);
+typedef void (tL2CA_UCD_DISCOVER_CB) (BD_ADDR, uint8_t, uint32_t);
 
 /* UCD data received. Parameters are
 **      BD Address of remote
@@ -908,9 +908,9 @@
 ** an application tries to send data when the transmit queue is full,
 ** the data will anyways be dropped. The parameter is:
 **              remote BD_ADDR
-**              TRUE if congested, FALSE if uncongested
+**              true if congested, false if uncongested
 */
-typedef void (tL2CA_UCD_CONGESTION_STATUS_CB) (BD_ADDR, BOOLEAN);
+typedef void (tL2CA_UCD_CONGESTION_STATUS_CB) (BD_ADDR, bool   );
 
 /* UCD registration info (the callback addresses and PSM)
 */
@@ -929,10 +929,10 @@
 **
 **  Parameters:     tL2CAP_UCD_CB_INFO
 **
-**  Return value:   TRUE if successs
+**  Return value:   true if successs
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_UcdRegister ( UINT16 psm, tL2CAP_UCD_CB_INFO *p_cb_info );
+extern bool    L2CA_UcdRegister ( uint16_t psm, tL2CAP_UCD_CB_INFO *p_cb_info );
 
 /*******************************************************************************
 **
@@ -942,10 +942,10 @@
 **
 **  Parameters:     PSM
 **
-**  Return value:   TRUE if successs
+**  Return value:   true if successs
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_UcdDeregister ( UINT16 psm );
+extern bool    L2CA_UcdDeregister ( uint16_t psm );
 
 /*******************************************************************************
 **
@@ -959,10 +959,10 @@
 **                              L2CAP_UCD_INFO_TYPE_MTU
 **
 **
-**  Return value:   TRUE if successs
+**  Return value:   true if successs
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_UcdDiscover ( UINT16 psm, BD_ADDR rem_bda, UINT8 info_type );
+extern bool    L2CA_UcdDiscover ( uint16_t psm, BD_ADDR rem_bda, uint8_t info_type );
 
 /*******************************************************************************
 **
@@ -981,7 +981,7 @@
 **                  L2CAP_DW_FAILED,  if error
 **
 *******************************************************************************/
-extern UINT16 L2CA_UcdDataWrite (UINT16 psm, BD_ADDR rem_bda, BT_HDR *p_buf, UINT16 flags);
+extern uint16_t L2CA_UcdDataWrite (uint16_t psm, BD_ADDR rem_bda, BT_HDR *p_buf, uint16_t flags);
 
 /*******************************************************************************
 **
@@ -992,10 +992,10 @@
 **  Parameters:     BD Addr
 **                  Timeout in second
 **
-**  Return value:   TRUE if successs
+**  Return value:   true if successs
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_UcdSetIdleTimeout ( BD_ADDR rem_bda, UINT16 timeout );
+extern bool    L2CA_UcdSetIdleTimeout ( BD_ADDR rem_bda, uint16_t timeout );
 
 /*******************************************************************************
 **
@@ -1003,10 +1003,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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_UCDSetTxPriority ( BD_ADDR rem_bda, tL2CAP_CHNL_PRIORITY priority );
+extern bool    L2CA_UCDSetTxPriority ( BD_ADDR rem_bda, tL2CAP_CHNL_PRIORITY priority );
 
 
 /*******************************************************************************
@@ -1018,26 +1018,26 @@
 /* Fixed channel connected and disconnected. Parameters are
 **      channel
 **      BD Address of remote
-**      TRUE if channel is connected, FALSE if disconnected
+**      true if channel is connected, false if disconnected
 **      Reason for connection failure
 **      transport : physical transport, BR/EDR or LE
 */
-typedef void (tL2CA_FIXED_CHNL_CB) (UINT16, BD_ADDR, BOOLEAN, UINT16, tBT_TRANSPORT);
+typedef void (tL2CA_FIXED_CHNL_CB) (uint16_t, BD_ADDR, bool   , uint16_t, tBT_TRANSPORT);
 
 /* Signalling data received. Parameters are
 **      channel
 **      BD Address of remote
 **      Pointer to buffer with data
 */
-typedef void (tL2CA_FIXED_DATA_CB) (UINT16, BD_ADDR, BT_HDR *);
+typedef void (tL2CA_FIXED_DATA_CB) (uint16_t, BD_ADDR, BT_HDR *);
 
 /* Congestion status callback protype. This callback is optional. If
 ** an application tries to send data when the transmit queue is full,
 ** the data will anyways be dropped. The parameter is:
 **      remote BD_ADDR
-**      TRUE if congested, FALSE if uncongested
+**      true if congested, false if uncongested
 */
-typedef void (tL2CA_FIXED_CONGESTION_STATUS_CB) (BD_ADDR, BOOLEAN);
+typedef void (tL2CA_FIXED_CONGESTION_STATUS_CB) (BD_ADDR, bool   );
 
 /* Fixed channel registration info (the callback addresses and channel config)
 */
@@ -1048,7 +1048,7 @@
     tL2CA_FIXED_CONGESTION_STATUS_CB *pL2CA_FixedCong_Cb;
     tL2CAP_FCR_OPTS         fixed_chnl_opts;
 
-    UINT16                  default_idle_tout;
+    uint16_t                default_idle_tout;
     tL2CA_TX_COMPLETE_CB    *pL2CA_FixedTxComplete_Cb; /* fixed channel tx complete callback */
 } tL2CAP_FIXED_CHNL_REG;
 
@@ -1063,10 +1063,10 @@
 **  Parameters:     Fixed Channel #
 **                  Channel Callbacks and config
 **
-**  Return value:   TRUE if registered OK
+**  Return value:   true if registered OK
 **
 *******************************************************************************/
-extern BOOLEAN  L2CA_RegisterFixedChannel (UINT16 fixed_cid, tL2CAP_FIXED_CHNL_REG *p_freg);
+extern bool     L2CA_RegisterFixedChannel (uint16_t fixed_cid, tL2CAP_FIXED_CHNL_REG *p_freg);
 
 /*******************************************************************************
 **
@@ -1077,10 +1077,10 @@
 **  Parameters:     Fixed CID
 **                  BD Address of remote
 **
-**  Return value:   TRUE if connection started
+**  Return value:   true if connection started
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR bd_addr);
+extern bool    L2CA_ConnectFixedChnl (uint16_t fixed_cid, BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
@@ -1096,7 +1096,7 @@
 **                  L2CAP_DW_FAILED,  if error
 **
 *******************************************************************************/
-extern UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf);
+extern uint16_t L2CA_SendFixedChnlData (uint16_t fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf);
 
 /*******************************************************************************
 **
@@ -1108,10 +1108,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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_RemoveFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda);
+extern bool    L2CA_RemoveFixedChnl (uint16_t fixed_cid, BD_ADDR rem_bda);
 
 /*******************************************************************************
 **
@@ -1127,10 +1127,10 @@
 **                  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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT16 idle_tout);
+extern bool    L2CA_SetFixedChannelTout (BD_ADDR rem_bda, uint16_t fixed_cid, uint16_t idle_tout);
 
 #endif /* (L2CAP_NUM_FIXED_CHNLS > 0) */
 
@@ -1144,10 +1144,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
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_GetCurrentConfig (UINT16 lcid,
+extern 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);
 
@@ -1158,10 +1158,10 @@
 ** Description  This function polulates the mtu, remote cid & lm_handle for
 **              a given local L2CAP channel
 **
-** Returns      TRUE if successful
+** Returns      true if successful
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_GetConnectionConfig(UINT16 lcid, UINT16 *mtu, UINT16 *rcid, UINT16 *handle);
+extern bool    L2CA_GetConnectionConfig(uint16_t lcid, uint16_t *mtu, uint16_t *rcid, uint16_t *handle);
 
 #if (BLE_INCLUDED == TRUE)
 /*******************************************************************************
@@ -1172,10 +1172,10 @@
 **
 **  Parameters:     BD Address of remote
 **
-**  Return value:   TRUE if connection was cancelled
+**  Return value:   true if connection was cancelled
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_CancelBleConnectReq (BD_ADDR rem_bda);
+extern bool    L2CA_CancelBleConnectReq (BD_ADDR rem_bda);
 
 /*******************************************************************************
 **
@@ -1185,11 +1185,11 @@
 **
 **  Parameters:     BD Address of remote
 **
-**  Return value:   TRUE if update started
+**  Return value:   true if update started
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bdRa, UINT16 min_int,
-                                         UINT16 max_int, UINT16 latency, UINT16 timeout);
+extern bool    L2CA_UpdateBleConnParams (BD_ADDR rem_bdRa, uint16_t min_int,
+                                         uint16_t max_int, uint16_t latency, uint16_t timeout);
 
 /*******************************************************************************
 **
@@ -1200,10 +1200,10 @@
 **  Parameters:     BD Address of remote
 **                  enable flag
 **
-**  Return value:   TRUE if update started
+**  Return value:   true if update started
 **
 *******************************************************************************/
-extern BOOLEAN L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, BOOLEAN enable);
+extern bool    L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, bool    enable);
 
 /*******************************************************************************
 **
@@ -1214,7 +1214,7 @@
 ** Returns          link role.
 **
 *******************************************************************************/
-extern UINT8 L2CA_GetBleConnRole (BD_ADDR bd_addr);
+extern uint8_t L2CA_GetBleConnRole (BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
@@ -1228,7 +1228,7 @@
 ** Returns          disconnect reason
 **
 *******************************************************************************/
-extern UINT16 L2CA_GetDisconnectReason (BD_ADDR remote_bda, tBT_TRANSPORT transport);
+extern uint16_t L2CA_GetDisconnectReason (BD_ADDR remote_bda, tBT_TRANSPORT transport);
 
 #endif /* (BLE_INCLUDED == TRUE) */
 
diff --git a/stack/include/mca_api.h b/stack/include/mca_api.h
index bb6919a..08b522c 100644
--- a/stack/include/mca_api.h
+++ b/stack/include/mca_api.h
@@ -45,7 +45,7 @@
 #define MCA_BUSY                   4       /* A procedure is already in progress */
 #define MCA_WRITE_FAIL             5       /* Write failed */
 #define MCA_BAD_MDL_ID             6       /* MDL ID is not valid for the current API */
-typedef UINT8 tMCA_RESULT;
+typedef uint8_t tMCA_RESULT;
 
 /* MDEP data type.  */
 #define MCA_TDEP_ECHO              0       /* MDEP for echo test  */
@@ -79,10 +79,10 @@
 /*****************************************************************************
 **  Type Definitions
 *****************************************************************************/
-typedef UINT8  tMCA_HANDLE; /* the handle for registration. 1 based index to rcb */
-typedef UINT8  tMCA_CL;     /* the handle for a control channel; reported at MCA_CONNECT_IND_EVT */
-typedef UINT8  tMCA_DEP;    /* the handle for MCA_CreateDep. This is also the local mdep_id */
-typedef UINT16 tMCA_DL;     /* the handle for the data channel. This is reported at MCA_OPEN_CFM_EVT or MCA_OPEN_IND_EVT */
+typedef uint8_t tMCA_HANDLE; /* the handle for registration. 1 based index to rcb */
+typedef uint8_t tMCA_CL;     /* the handle for a control channel; reported at MCA_CONNECT_IND_EVT */
+typedef uint8_t tMCA_DEP;    /* the handle for MCA_CreateDep. This is also the local mdep_id */
+typedef uint16_t tMCA_DL;     /* the handle for the data channel. This is reported at MCA_OPEN_CFM_EVT or MCA_OPEN_IND_EVT */
 
 /* This is the data callback function.  It is executed when MCAP has a data
 ** packet ready for the application.
@@ -92,98 +92,98 @@
 
 /* This structure contains parameters which are set at registration. */
 typedef struct {
-    UINT32      rsp_tout;   /* MCAP signaling response timeout */
-    UINT16      ctrl_psm;   /* L2CAP PSM for the MCAP control channel */
-    UINT16      data_psm;   /* L2CAP PSM for the MCAP data channel */
-    UINT16      sec_mask;   /* Security mask for BTM_SetSecurityLevel() */
+    uint32_t    rsp_tout;   /* MCAP signaling response timeout */
+    uint16_t    ctrl_psm;   /* L2CAP PSM for the MCAP control channel */
+    uint16_t    data_psm;   /* L2CAP PSM for the MCAP data channel */
+    uint16_t    sec_mask;   /* Security mask for BTM_SetSecurityLevel() */
 } tMCA_REG;
 
 /* This structure contains parameters to create a MDEP. */
 typedef struct {
-    UINT8           type;       /* MCA_TDEP_DATA, or MCA_TDEP_ECHO. a regiatration may have only one MCA_TDEP_ECHO MDEP */
-    UINT8           max_mdl;    /* The maximum number of MDLs for this MDEP (max is MCA_NUM_MDLS) */
+    uint8_t         type;       /* MCA_TDEP_DATA, or MCA_TDEP_ECHO. a regiatration may have only one MCA_TDEP_ECHO MDEP */
+    uint8_t         max_mdl;    /* The maximum number of MDLs for this MDEP (max is MCA_NUM_MDLS) */
     tMCA_DATA_CBACK *p_data_cback;  /* Data callback function */
 } tMCA_CS;
 
-#define MCA_FCS_NONE        0       /* fcs_present=FALSE */
-#define MCA_FCS_BYPASS      0x10    /* fcs_present=TRUE, fcs=L2CAP_CFG_FCS_BYPASS */
-#define MCA_FCS_USE         0x11    /* fcs_present=TRUE, fcs=L2CAP_CFG_FCS_USE */
-#define MCA_FCS_PRESNT_MASK 0x10    /* fcs_present=TRUE */
+#define MCA_FCS_NONE        0       /* fcs_present=false */
+#define MCA_FCS_BYPASS      0x10    /* fcs_present=true, fcs=L2CAP_CFG_FCS_BYPASS */
+#define MCA_FCS_USE         0x11    /* fcs_present=true, fcs=L2CAP_CFG_FCS_USE */
+#define MCA_FCS_PRESNT_MASK 0x10    /* fcs_present=true */
 #define MCA_FCS_USE_MASK    0x01    /* mask for fcs */
-typedef UINT8 tMCA_FCS_OPT;
+typedef uint8_t tMCA_FCS_OPT;
 
 /* This structure contains L2CAP configuration parameters for the channel. */
 typedef struct {
     tL2CAP_FCR_OPTS fcr_opt;
-    UINT16          user_rx_buf_size;
-    UINT16          user_tx_buf_size;
-    UINT16          fcr_rx_buf_size;
-    UINT16          fcr_tx_buf_size;
+    uint16_t        user_rx_buf_size;
+    uint16_t        user_tx_buf_size;
+    uint16_t        fcr_rx_buf_size;
+    uint16_t        fcr_tx_buf_size;
     tMCA_FCS_OPT    fcs;
-    UINT16          data_mtu;   /* L2CAP MTU of the MCAP data channel */
+    uint16_t        data_mtu;   /* L2CAP MTU of the MCAP data channel */
 } tMCA_CHNL_CFG;
 
 
 /* Header structure for callback event parameters. */
 typedef struct {
-    UINT16          mdl_id;     /* The associated MDL ID */
-    UINT8           op_code;    /* The op (request/response) code */
+    uint16_t        mdl_id;     /* The associated MDL ID */
+    uint8_t         op_code;    /* The op (request/response) code */
 } tMCA_EVT_HDR;
 
 /* Response Header structure for callback event parameters. */
 typedef struct {
-    UINT16          mdl_id;     /* The associated MDL ID */
-    UINT8           op_code;    /* The op (request/response) code */
-    UINT8           rsp_code;   /* The response code */
+    uint16_t        mdl_id;     /* The associated MDL ID */
+    uint8_t         op_code;    /* The op (request/response) code */
+    uint8_t         rsp_code;   /* The response code */
 } tMCA_RSP_EVT;
 
 /* This data structure is associated with the MCA_CREATE_IND_EVT. */
 typedef struct {
-    UINT16          mdl_id;     /* The associated MDL ID */
-    UINT8           op_code;    /* The op (request/response) code */
-    UINT8           dep_id;     /* MDEP ID */
-    UINT8           cfg;        /* The configuration to negotiate */
+    uint16_t        mdl_id;     /* The associated MDL ID */
+    uint8_t         op_code;    /* The op (request/response) code */
+    uint8_t         dep_id;     /* MDEP ID */
+    uint8_t         cfg;        /* The configuration to negotiate */
 } tMCA_CREATE_IND;
 
 /* This data structure is associated with the MCA_CREATE_CFM_EVT. */
 typedef struct {
-    UINT16          mdl_id;     /* The associated MDL ID */
-    UINT8           op_code;    /* The op (request/response) code */
-    UINT8           rsp_code;   /* The response code. */
-    UINT8           cfg;        /* The configuration to negotiate */
+    uint16_t        mdl_id;     /* The associated MDL ID */
+    uint8_t         op_code;    /* The op (request/response) code */
+    uint8_t         rsp_code;   /* The response code. */
+    uint8_t         cfg;        /* The configuration to negotiate */
 } tMCA_CREATE_CFM;
 
 /* This data structure is associated with MCA_CONNECT_IND_EVT. */
 typedef struct {
     BD_ADDR         bd_addr;    /* The peer address */
-    UINT16          mtu;        /* peer mtu */
+    uint16_t        mtu;        /* peer mtu */
 } tMCA_CONNECT_IND;
 
 /* This data structure is associated with MCA_DISCONNECT_IND_EVT. */
 typedef struct {
     BD_ADDR         bd_addr;    /* The peer address */
-    UINT16          reason;     /* disconnect reason given by L2CAP */
+    uint16_t        reason;     /* disconnect reason given by L2CAP */
 } tMCA_DISCONNECT_IND;
 
 /* This data structure is associated with MCA_OPEN_IND_EVT, and MCA_OPEN_CFM_EVT. */
 typedef struct {
-    UINT16          mdl_id;     /* The associated MDL ID */
+    uint16_t        mdl_id;     /* The associated MDL ID */
     tMCA_DL         mdl;        /* The handle for the data channel */
-    UINT16          mtu;        /* peer mtu */
+    uint16_t        mtu;        /* peer mtu */
 } tMCA_DL_OPEN;
 
 /* This data structure is associated with MCA_CLOSE_IND_EVT and MCA_CLOSE_CFM_EVT. */
 typedef struct {
-    UINT16          mdl_id;     /* The associated MDL ID */
+    uint16_t        mdl_id;     /* The associated MDL ID */
     tMCA_DL         mdl;        /* The handle for the data channel */
-    UINT16          reason;     /* disconnect reason given by L2CAP */
+    uint16_t        reason;     /* disconnect reason given by L2CAP */
 } tMCA_DL_CLOSE;
 
 /* This data structure is associated with MCA_CONG_CHG_EVT. */
 typedef struct {
-    UINT16          mdl_id;     /* N/A - This is a place holder */
+    uint16_t        mdl_id;     /* N/A - This is a place holder */
     tMCA_DL	        mdl;        /* The handle for the data channel */
-    BOOLEAN         cong;       /* TRUE, if the channel is congested */
+    bool            cong;       /* true, if the channel is congested */
 } tMCA_CONG_CHG;
 
 /* Union of all control callback event data structures */
@@ -210,7 +210,7 @@
 /* This is the control callback function.  This function passes control events
 ** to the application.
 */
-typedef void (tMCA_CTRL_CBACK)(tMCA_HANDLE handle, tMCA_CL mcl, UINT8 event,
+typedef void (tMCA_CTRL_CBACK)(tMCA_HANDLE handle, tMCA_CL mcl, uint8_t event,
                                 tMCA_CTRL *p_data);
 
 
@@ -247,7 +247,7 @@
 **                  the input parameter is 0xff.
 **
 *******************************************************************************/
-extern UINT8 MCA_SetTraceLevel (UINT8 level);
+extern uint8_t MCA_SetTraceLevel (uint8_t level);
 
 /*******************************************************************************
 **
@@ -322,8 +322,8 @@
 **
 *******************************************************************************/
 extern tMCA_RESULT MCA_ConnectReq(tMCA_HANDLE handle, BD_ADDR bd_addr,
-                                  UINT16 ctrl_psm,
-                                  UINT16 sec_mask);
+                                  uint16_t ctrl_psm,
+                                  uint16_t sec_mask);
 
 /*******************************************************************************
 **
@@ -355,9 +355,9 @@
 ** Returns          MCA_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern tMCA_RESULT MCA_CreateMdl(tMCA_CL mcl, tMCA_DEP dep, UINT16 data_psm,
-                                 UINT16 mdl_id, UINT8 peer_dep_id,
-                                 UINT8 cfg, const tMCA_CHNL_CFG *p_chnl_cfg);
+extern tMCA_RESULT MCA_CreateMdl(tMCA_CL mcl, tMCA_DEP dep, uint16_t data_psm,
+                                 uint16_t mdl_id, uint8_t peer_dep_id,
+                                 uint8_t cfg, const tMCA_CHNL_CFG *p_chnl_cfg);
 
 /*******************************************************************************
 **
@@ -374,7 +374,7 @@
 **
 *******************************************************************************/
 extern tMCA_RESULT MCA_CreateMdlRsp(tMCA_CL mcl, tMCA_DEP dep,
-                                    UINT16 mdl_id, UINT8 cfg, UINT8 rsp_code,
+                                    uint16_t mdl_id, uint8_t cfg, uint8_t rsp_code,
                                     const tMCA_CHNL_CFG *p_chnl_cfg);
 
 /*******************************************************************************
@@ -403,8 +403,8 @@
 ** Returns          MCA_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern tMCA_RESULT MCA_ReconnectMdl(tMCA_CL mcl, tMCA_DEP dep, UINT16 data_psm,
-                                    UINT16 mdl_id, const tMCA_CHNL_CFG *p_chnl_cfg);
+extern tMCA_RESULT MCA_ReconnectMdl(tMCA_CL mcl, tMCA_DEP dep, uint16_t data_psm,
+                                    uint16_t mdl_id, const tMCA_CHNL_CFG *p_chnl_cfg);
 
 /*******************************************************************************
 **
@@ -420,7 +420,7 @@
 **
 *******************************************************************************/
 extern tMCA_RESULT MCA_ReconnectMdlRsp(tMCA_CL mcl, tMCA_DEP dep,
-                                       UINT16 mdl_id, UINT8 rsp_code,
+                                       uint16_t mdl_id, uint8_t rsp_code,
                                        const tMCA_CHNL_CFG *p_chnl_cfg);
 
 /*******************************************************************************
@@ -459,7 +459,7 @@
 ** Returns          MCA_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-extern tMCA_RESULT MCA_Delete(tMCA_CL mcl, UINT16 mdl_id);
+extern tMCA_RESULT MCA_Delete(tMCA_CL mcl, uint16_t mdl_id);
 
 /*******************************************************************************
 **
@@ -490,6 +490,6 @@
 ** Returns          L2CAP channel ID if successful, otherwise 0.
 **
 *******************************************************************************/
-extern UINT16 MCA_GetL2CapChannel (tMCA_DL mdl);
+extern uint16_t MCA_GetL2CapChannel (tMCA_DL mdl);
 
 #endif /* MCA_API_H */
diff --git a/stack/include/pan_api.h b/stack/include/pan_api.h
index b4e8431..5b57c2a 100644
--- a/stack/include/pan_api.h
+++ b/stack/include/pan_api.h
@@ -87,7 +87,7 @@
     PAN_FAILURE                                                 /* Failure                      */
 
 };
-typedef UINT8 tPAN_RESULT;
+typedef uint8_t tPAN_RESULT;
 
 
 /*****************************************************************
@@ -95,19 +95,19 @@
 *****************************************************************/
 
 /* This is call back function used to report connection status
-**      to the application. The second parameter TRUE means
-**      to create the bridge and FALSE means to remove it.
+**      to the application. The second parameter true means
+**      to create the bridge and false means to remove it.
 */
-typedef void (tPAN_CONN_STATE_CB) (UINT16 handle, BD_ADDR bd_addr, tPAN_RESULT state, BOOLEAN is_role_change,
-                                        UINT8 src_role, UINT8 dst_role);
+typedef void (tPAN_CONN_STATE_CB) (uint16_t handle, BD_ADDR bd_addr, tPAN_RESULT state, bool    is_role_change,
+                                        uint8_t src_role, uint8_t dst_role);
 
 
 /* This is call back function used to create bridge for the
 **      Connected device. The parameter "state" indicates
-**      whether to create the bridge or remove it. TRUE means
-**      to create the bridge and FALSE means to remove it.
+**      whether to create the bridge or remove it. true means
+**      to create the bridge and false means to remove it.
 */
-typedef void (tPAN_BRIDGE_REQ_CB) (BD_ADDR bd_addr, BOOLEAN state);
+typedef void (tPAN_BRIDGE_REQ_CB) (BD_ADDR bd_addr, bool    state);
 
 
 /* Data received indication callback prototype. Parameters are
@@ -118,17 +118,17 @@
 **              Length of data (non-GKI)
 **              ext is flag to indicate whether it has aby extension headers
 **              Flag used to indicate to forward on LAN
-**                      FALSE - Use it for internal stack
-**                      TRUE  - Send it across the ethernet as well
+**                      false - Use it for internal stack
+**                      true  - Send it across the ethernet as well
 */
-typedef void (tPAN_DATA_IND_CB) (UINT16 handle,
+typedef void (tPAN_DATA_IND_CB) (uint16_t handle,
                                  BD_ADDR src,
                                  BD_ADDR dst,
-                                 UINT16 protocol,
-                                 UINT8 *p_data,
-                                 UINT16 len,
-                                 BOOLEAN ext,
-                                 BOOLEAN forward);
+                                 uint16_t protocol,
+                                 uint8_t *p_data,
+                                 uint16_t len,
+                                 bool    ext,
+                                 bool    forward);
 
 
 /* Data buffer received indication callback prototype. Parameters are
@@ -138,28 +138,28 @@
 **              pointer to the data buffer
 **              ext is flag to indicate whether it has aby extension headers
 **              Flag used to indicate to forward on LAN
-**                      FALSE - Use it for internal stack
-**                      TRUE  - Send it across the ethernet as well
+**                      false - Use it for internal stack
+**                      true  - Send it across the ethernet as well
 */
-typedef void (tPAN_DATA_BUF_IND_CB) (UINT16 handle,
+typedef void (tPAN_DATA_BUF_IND_CB) (uint16_t handle,
                                      BD_ADDR src,
                                      BD_ADDR dst,
-                                     UINT16 protocol,
+                                     uint16_t protocol,
                                      BT_HDR *p_buf,
-                                     BOOLEAN ext,
-                                     BOOLEAN forward);
+                                     bool    ext,
+                                     bool    forward);
 
 
 /* Flow control callback for TX data. Parameters are
 **              Handle to the connection
 **              Event  flow status
 */
-typedef void (tPAN_TX_DATA_FLOW_CB) (UINT16 handle,
+typedef void (tPAN_TX_DATA_FLOW_CB) (uint16_t handle,
                                      tPAN_RESULT  event);
 
 /* Filters received indication callback prototype. Parameters are
 **              Handle to the connection
-**              TRUE if the cb is called for indication
+**              true if the cb is called for indication
 **              Ignore this if it is indication, otherwise it is the result
 **                      for the filter set operation performed by the local
 **                      device
@@ -170,17 +170,17 @@
 **                      two bytes will be starting of the first range and
 **                      next two bytes will be ending of the range.
 */
-typedef void (tPAN_FILTER_IND_CB) (UINT16 handle,
-                                   BOOLEAN indication,
+typedef void (tPAN_FILTER_IND_CB) (uint16_t handle,
+                                   bool    indication,
                                    tBNEP_RESULT result,
-                                   UINT16 num_filters,
-                                   UINT8 *p_filters);
+                                   uint16_t num_filters,
+                                   uint8_t *p_filters);
 
 
 
 /* Multicast Filters received indication callback prototype. Parameters are
 **              Handle to the connection
-**              TRUE if the cb is called for indication
+**              true if the cb is called for indication
 **              Ignore this if it is indication, otherwise it is the result
 **                      for the filter set operation performed by the local
 **                      device
@@ -190,11 +190,11 @@
 **                      First six bytes will be starting of the first range and
 **                      next six bytes will be ending of the range.
 */
-typedef void (tPAN_MFILTER_IND_CB) (UINT16 handle,
-                                    BOOLEAN indication,
+typedef void (tPAN_MFILTER_IND_CB) (uint16_t handle,
+                                    bool    indication,
                                     tBNEP_RESULT result,
-                                    UINT16 num_mfilters,
-                                    UINT8 *p_mfilters);
+                                    uint16_t num_mfilters,
+                                    uint8_t *p_mfilters);
 
 
 
@@ -266,7 +266,7 @@
 **                                      PAN_ROLE_GN_SERVER is for GN role
 **                                      PAN_ROLE_NAP_SERVER is for NAP role
 **                  sec_mask    - Security mask for different roles
-**                                      It is array of UINT8. The byte represent the
+**                                      It is array of uint8_t. The byte represent the
 **                                      security for roles PANU, GN and NAP in order
 **                  p_user_name - Service name for PANU role
 **                  p_gn_name   - Service name for GN role
@@ -277,8 +277,8 @@
 **                  PAN_FAILURE     - if the role is not valid
 **
 *******************************************************************************/
-extern tPAN_RESULT PAN_SetRole (UINT8 role,
-                                UINT8 *sec_mask,
+extern tPAN_RESULT PAN_SetRole (uint8_t role,
+                                uint8_t *sec_mask,
                                 char *p_user_name,
                                 char *p_gn_name,
                                 char *p_nap_name);
@@ -306,7 +306,7 @@
 **                                           allowed at that point of time
 **
 *******************************************************************************/
-extern tPAN_RESULT PAN_Connect (BD_ADDR rem_bda, UINT8 src_role, UINT8 dst_role, UINT16 *handle);
+extern tPAN_RESULT PAN_Connect (BD_ADDR rem_bda, uint8_t src_role, uint8_t dst_role, uint16_t *handle);
 
 /*******************************************************************************
 **
@@ -321,7 +321,7 @@
 **                                           there is an error in disconnecting
 **
 *******************************************************************************/
-extern tPAN_RESULT PAN_Disconnect (UINT16 handle);
+extern tPAN_RESULT PAN_Disconnect (uint16_t handle);
 
 /*******************************************************************************
 **
@@ -346,13 +346,13 @@
 **                                           there is an error in sending data
 **
 *******************************************************************************/
-extern tPAN_RESULT PAN_Write (UINT16 handle,
+extern tPAN_RESULT PAN_Write (uint16_t handle,
                               BD_ADDR dst,
                               BD_ADDR src,
-                              UINT16 protocol,
-                              UINT8 *p_data,
-                              UINT16 len,
-                              BOOLEAN ext);
+                              uint16_t protocol,
+                              uint8_t *p_data,
+                              uint16_t len,
+                              bool    ext);
 
 /*******************************************************************************
 **
@@ -376,12 +376,12 @@
 **                                           there is an error in sending data
 **
 *******************************************************************************/
-extern tPAN_RESULT PAN_WriteBuf (UINT16 handle,
+extern tPAN_RESULT PAN_WriteBuf (uint16_t handle,
                                  BD_ADDR dst,
                                  BD_ADDR src,
-                                 UINT16 protocol,
+                                 uint16_t protocol,
                                  BT_HDR *p_buf,
-                                 BOOLEAN ext);
+                                 bool    ext);
 
 /*******************************************************************************
 **
@@ -399,10 +399,10 @@
 **                  PAN_FAILURE        if connection not found or error in setting
 **
 *******************************************************************************/
-extern tPAN_RESULT PAN_SetProtocolFilters (UINT16 handle,
-                                           UINT16 num_filters,
-                                           UINT16 *p_start_array,
-                                           UINT16 *p_end_array);
+extern tPAN_RESULT PAN_SetProtocolFilters (uint16_t handle,
+                                           uint16_t num_filters,
+                                           uint16_t *p_start_array,
+                                           uint16_t *p_end_array);
 
 /*******************************************************************************
 **
@@ -422,10 +422,10 @@
 **                  PAN_FAILURE        if connection not found or error in setting
 **
 *******************************************************************************/
-extern tBNEP_RESULT PAN_SetMulticastFilters (UINT16 handle,
-                                             UINT16 num_mcast_filters,
-                                             UINT8 *p_start_array,
-                                             UINT8 *p_end_array);
+extern tBNEP_RESULT PAN_SetMulticastFilters (uint16_t handle,
+                                             uint16_t num_mcast_filters,
+                                             uint8_t *p_start_array,
+                                             uint8_t *p_end_array);
 
 /*******************************************************************************
 **
@@ -437,7 +437,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-extern UINT8 PAN_SetTraceLevel (UINT8 new_level);
+extern uint8_t PAN_SetTraceLevel (uint8_t new_level);
 
 /*******************************************************************************
 **
diff --git a/stack/include/port_api.h b/stack/include/port_api.h
index 7216848..cdbd17a 100644
--- a/stack/include/port_api.h
+++ b/stack/include/port_api.h
@@ -51,29 +51,29 @@
 #define PORT_BAUD_RATE_115200     0x07
 #define PORT_BAUD_RATE_230400     0x08
 
-    UINT8  baud_rate;
+    uint8_t baud_rate;
 
 #define PORT_5_BITS               0x00
 #define PORT_6_BITS               0x01
 #define PORT_7_BITS               0x02
 #define PORT_8_BITS               0x03
 
-    UINT8  byte_size;
+    uint8_t byte_size;
 
 #define PORT_ONESTOPBIT           0x00
 #define PORT_ONE5STOPBITS         0x01
-    UINT8   stop_bits;
+    uint8_t stop_bits;
 
 #define PORT_PARITY_NO            0x00
 #define PORT_PARITY_YES           0x01
-    UINT8   parity;
+    uint8_t parity;
 
 #define PORT_ODD_PARITY           0x00
 #define PORT_EVEN_PARITY          0x01
 #define PORT_MARK_PARITY          0x02
 #define PORT_SPACE_PARITY         0x03
 
-    UINT8   parity_type;
+    uint8_t parity_type;
 
 #define PORT_FC_OFF               0x00
 #define PORT_FC_XONXOFF_ON_INPUT  0x01
@@ -83,15 +83,15 @@
 #define PORT_FC_DSR_ON_INPUT      0x10
 #define PORT_FC_DSR_ON_OUTPUT     0x20
 
-    UINT8 fc_type;
+    uint8_t fc_type;
 
-    UINT8 rx_char1;
+    uint8_t rx_char1;
 
 #define PORT_XON_DC1              0x11
-    UINT8 xon_char;
+    uint8_t xon_char;
 
 #define PORT_XOFF_DC3             0x13
-    UINT8 xoff_char;
+    uint8_t xoff_char;
 
 } tPORT_STATE;
 
@@ -100,14 +100,14 @@
 ** Define the callback function prototypes.  Parameters are specific
 ** to each event and are described bellow
 */
-typedef int  (tPORT_DATA_CALLBACK) (UINT16 port_handle, void *p_data, UINT16 len);
+typedef int  (tPORT_DATA_CALLBACK) (uint16_t port_handle, void *p_data, uint16_t len);
 
 #define DATA_CO_CALLBACK_TYPE_INCOMING          1
 #define DATA_CO_CALLBACK_TYPE_OUTGOING_SIZE     2
 #define DATA_CO_CALLBACK_TYPE_OUTGOING          3
-typedef int  (tPORT_DATA_CO_CALLBACK) (UINT16 port_handle, UINT8* p_buf, UINT16 len, int type);
+typedef int  (tPORT_DATA_CO_CALLBACK) (uint16_t port_handle, uint8_t* p_buf, uint16_t len, int type);
 
-typedef void (tPORT_CALLBACK) (UINT32 code, UINT16 port_handle);
+typedef void (tPORT_CALLBACK) (uint32_t code, uint16_t port_handle);
 
 /*
 ** Define events that registered application can receive in the callback
@@ -197,7 +197,7 @@
 ** Parameters:      scn          - Service Channel Number as registered with
 **                                 the SDP (server) or obtained using SDP from
 **                                 the peer device (client).
-**                  is_server    - TRUE if requesting application is a server
+**                  is_server    - true if requesting application is a server
 **                  mtu          - Maximum frame size the application can accept
 **                  bd_addr      - BD_ADDR of the peer (client)
 **                  mask         - specifies events to be enabled.  A value
@@ -216,9 +216,9 @@
 ** (scn * 2 + 1) dlci.
 **
 *******************************************************************************/
-extern int RFCOMM_CreateConnection (UINT16 uuid, UINT8 scn,
-                                            BOOLEAN is_server, UINT16 mtu,
-                                            BD_ADDR bd_addr, UINT16 *p_handle,
+extern int RFCOMM_CreateConnection (uint16_t uuid, uint8_t scn,
+                                            bool    is_server, uint16_t mtu,
+                                            BD_ADDR bd_addr, uint16_t *p_handle,
                                             tPORT_CALLBACK *p_mgmt_cb);
 
 
@@ -231,7 +231,7 @@
 ** Parameters:      handle     - Handle of the port returned in the Open
 **
 *******************************************************************************/
-extern int RFCOMM_RemoveConnection (UINT16 handle);
+extern int RFCOMM_RemoveConnection (uint16_t handle);
 
 
 /*******************************************************************************
@@ -243,7 +243,7 @@
 ** Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 **
 *******************************************************************************/
-extern int RFCOMM_RemoveServer (UINT16 handle);
+extern int RFCOMM_RemoveServer (uint16_t handle);
 
 
 /*******************************************************************************
@@ -258,7 +258,7 @@
 **                                 specified in the mask occurs.
 **
 *******************************************************************************/
-extern int PORT_SetEventCallback (UINT16 port_handle,
+extern int PORT_SetEventCallback (uint16_t port_handle,
                                   tPORT_CALLBACK *p_port_cb);
 
 /*******************************************************************************
@@ -270,7 +270,7 @@
 ** Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 **
 *******************************************************************************/
-int PORT_ClearKeepHandleFlag (UINT16 port_handle);
+int PORT_ClearKeepHandleFlag (uint16_t port_handle);
 
 /*******************************************************************************
 **
@@ -284,10 +284,10 @@
 **                                 packet is received.
 **
 *******************************************************************************/
-extern int PORT_SetDataCallback (UINT16 port_handle,
+extern int PORT_SetDataCallback (uint16_t port_handle,
                                  tPORT_DATA_CALLBACK *p_cb);
 
-extern int PORT_SetDataCOCallback (UINT16 port_handle, tPORT_DATA_CO_CALLBACK *p_port_cb);
+extern int PORT_SetDataCOCallback (uint16_t port_handle, tPORT_DATA_CO_CALLBACK *p_port_cb);
 /*******************************************************************************
 **
 ** Function         PORT_SetEventMask
@@ -299,7 +299,7 @@
 **                           of zero disables all events.
 **
 *******************************************************************************/
-extern int PORT_SetEventMask (UINT16 port_handle, UINT32 mask);
+extern int PORT_SetEventMask (uint16_t port_handle, uint32_t mask);
 
 
 /*******************************************************************************
@@ -314,21 +314,21 @@
 **                  p_lcid     - OUT L2CAP's LCID
 **
 *******************************************************************************/
-extern int PORT_CheckConnection (UINT16 handle, BD_ADDR bd_addr,
-                                 UINT16 *p_lcid);
+extern int PORT_CheckConnection (uint16_t handle, BD_ADDR bd_addr,
+                                 uint16_t *p_lcid);
 
 /*******************************************************************************
 **
 ** Function         PORT_IsOpening
 **
-** Description      This function returns TRUE if there is any RFCOMM connection
+** Description      This function returns true if there is any RFCOMM connection
 **                  opening in process.
 **
-** Parameters:      TRUE if any connection opening is found
+** Parameters:      true if any connection opening is found
 **                  bd_addr    - bd_addr of the peer
 **
 *******************************************************************************/
-extern BOOLEAN PORT_IsOpening (BD_ADDR bd_addr);
+extern bool    PORT_IsOpening (BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
@@ -342,7 +342,7 @@
 **                               configuration information for the connection.
 **
 *******************************************************************************/
-extern int PORT_SetState (UINT16 handle, tPORT_STATE *p_settings);
+extern int PORT_SetState (uint16_t handle, tPORT_STATE *p_settings);
 
 /*******************************************************************************
 **
@@ -354,7 +354,7 @@
 **                  p_rx_queue_count - Pointer to return queue count in.
 **
 *******************************************************************************/
-extern int PORT_GetRxQueueCnt (UINT16 handle, UINT16 *p_rx_queue_count);
+extern int PORT_GetRxQueueCnt (uint16_t handle, uint16_t *p_rx_queue_count);
 
 /*******************************************************************************
 **
@@ -368,7 +368,7 @@
 **                               configuration information is returned.
 **
 *******************************************************************************/
-extern int PORT_GetState (UINT16 handle, tPORT_STATE *p_settings);
+extern int PORT_GetState (uint16_t handle, tPORT_STATE *p_settings);
 
 
 /*******************************************************************************
@@ -392,7 +392,7 @@
 #define PORT_CLR_DCD            0x08        /* DCE only */
 #define PORT_BREAK              0x09        /* Break event */
 
-extern int PORT_Control (UINT16 handle, UINT8 signal);
+extern int PORT_Control (uint16_t handle, uint8_t signal);
 
 
 /*******************************************************************************
@@ -407,7 +407,7 @@
 **                  enable     - enables data flow
 **
 *******************************************************************************/
-extern int PORT_FlowControl (UINT16 handle, BOOLEAN enable);
+extern int PORT_FlowControl (uint16_t handle, bool    enable);
 
 
 /*******************************************************************************
@@ -437,7 +437,7 @@
 #define PORT_PPP_DEFAULT_SIGNAL_STATE   (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON)
 #define PORT_DUN_DEFAULT_SIGNAL_STATE   (PORT_DTRDSR_ON | PORT_CTSRTS_ON)
 
-extern int PORT_GetModemStatus (UINT16 handle, UINT8 *p_control_signal);
+extern int PORT_GetModemStatus (uint16_t handle, uint8_t *p_control_signal);
 
 
 /*******************************************************************************
@@ -469,14 +469,14 @@
 #define PORT_FLAG_DSR_HOLD  0x02    /* Tx is waiting for DSR signal */
 #define PORT_FLAG_RLSD_HOLD 0x04    /* Tx is waiting for RLSD signal */
 
-    UINT16  flags;
-    UINT16  in_queue_size;          /* Number of bytes in the input queue */
-    UINT16  out_queue_size;         /* Number of bytes in the output queue */
-    UINT16  mtu_size;               /* peer MTU size */
+    uint16_t flags;
+    uint16_t in_queue_size;          /* Number of bytes in the input queue */
+    uint16_t out_queue_size;         /* Number of bytes in the output queue */
+    uint16_t mtu_size;               /* peer MTU size */
 } tPORT_STATUS;
 
 
-extern int PORT_ClearError (UINT16 handle, UINT16 *p_errors,
+extern int PORT_ClearError (uint16_t handle, uint16_t *p_errors,
                             tPORT_STATUS *p_status);
 
 
@@ -490,7 +490,7 @@
 **                  errors     - receive error codes
 **
 *******************************************************************************/
-extern int PORT_SendError (UINT16 handle, UINT8 errors);
+extern int PORT_SendError (uint16_t handle, uint8_t errors);
 
 
 /*******************************************************************************
@@ -504,7 +504,7 @@
 **                               connection status
 **
 *******************************************************************************/
-extern int PORT_GetQueueStatus (UINT16 handle, tPORT_STATUS *p_status);
+extern int PORT_GetQueueStatus (uint16_t handle, tPORT_STATUS *p_status);
 
 
 /*******************************************************************************
@@ -521,7 +521,7 @@
 #define PORT_PURGE_TXCLEAR  0x01
 #define PORT_PURGE_RXCLEAR  0x02
 
-extern int PORT_Purge (UINT16 handle, UINT8 purge_flags);
+extern int PORT_Purge (uint16_t handle, uint8_t purge_flags);
 
 
 /*******************************************************************************
@@ -539,7 +539,7 @@
 **                  pp_buf      - pointer to address of buffer with data,
 **
 *******************************************************************************/
-extern int PORT_Read (UINT16 handle, BT_HDR **pp_buf);
+extern int PORT_Read (uint16_t handle, BT_HDR **pp_buf);
 
 
 /*******************************************************************************
@@ -556,8 +556,8 @@
 **                  p_len       - Byte count received
 **
 *******************************************************************************/
-extern int PORT_ReadData (UINT16 handle, char *p_data, UINT16 max_len,
-                          UINT16 *p_len);
+extern int PORT_ReadData (uint16_t handle, char *p_data, uint16_t max_len,
+                          uint16_t *p_len);
 
 
 /*******************************************************************************
@@ -571,7 +571,7 @@
 **                  p_buf       - pointer to the buffer with data,
 **
 *******************************************************************************/
-extern int PORT_Write (UINT16 handle, BT_HDR *p_buf);
+extern int PORT_Write (uint16_t handle, BT_HDR *p_buf);
 
 
 /*******************************************************************************
@@ -587,8 +587,8 @@
 **                  p_len       - Bytes written
 **
 *******************************************************************************/
-extern int PORT_WriteData (UINT16 handle, char *p_data, UINT16 max_len,
-                           UINT16 *p_len);
+extern int PORT_WriteData (uint16_t handle, char *p_data, uint16_t max_len,
+                           uint16_t *p_len);
 
 /*******************************************************************************
 **
@@ -600,7 +600,7 @@
 ** Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 **
 *******************************************************************************/
-extern int PORT_WriteDataCO (UINT16 handle, int* p_len);
+extern int PORT_WriteDataCO (uint16_t handle, int* p_len);
 
 /*******************************************************************************
 **
@@ -613,7 +613,7 @@
 **                  max_len     - Byte count requested
 **
 *******************************************************************************/
-extern int PORT_Test (UINT16 handle, UINT8 *p_data, UINT16 len);
+extern int PORT_Test (uint16_t handle, uint8_t *p_data, uint16_t len);
 
 
 /*******************************************************************************
@@ -636,7 +636,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-extern UINT8 PORT_SetTraceLevel (UINT8 new_level);
+extern uint8_t PORT_SetTraceLevel (uint8_t new_level);
 
 
 /*******************************************************************************
diff --git a/stack/include/profiles_api.h b/stack/include/profiles_api.h
index eee0dd8..bb8a6ec 100644
--- a/stack/include/profiles_api.h
+++ b/stack/include/profiles_api.h
@@ -63,8 +63,8 @@
 */
 typedef struct
 {
-    UINT8   level;
-    UINT8   mask;
+    uint8_t level;
+    uint8_t mask;
 } tBT_SECURITY;
 
 #endif  /* PROFILES_API_H */
diff --git a/stack/include/sdp_api.h b/stack/include/sdp_api.h
index 09f79f2..ae6983c 100644
--- a/stack/include/sdp_api.h
+++ b/stack/include/sdp_api.h
@@ -73,19 +73,19 @@
 *****************************************************************************/
 
 /* Define a callback function for when discovery is complete. */
-typedef void (tSDP_DISC_CMPL_CB) (UINT16 result);
-typedef void (tSDP_DISC_CMPL_CB2) (UINT16 result, void* user_data);
+typedef void (tSDP_DISC_CMPL_CB) (uint16_t result);
+typedef void (tSDP_DISC_CMPL_CB2) (uint16_t result, void* user_data);
 
 typedef struct
 {
     BD_ADDR         peer_addr;
-    UINT16          peer_mtu;
+    uint16_t        peer_mtu;
 } tSDP_DR_OPEN;
 
 typedef struct
 {
-    UINT8           *p_data;
-    UINT16          data_len;
+    uint8_t         *p_data;
+    uint16_t        data_len;
 } tSDP_DR_DATA;
 
 typedef union
@@ -95,17 +95,17 @@
 } tSDP_DATA;
 
 /* Define a callback function for when discovery result is received. */
-typedef void (tSDP_DISC_RES_CB) (UINT16 event, tSDP_DATA *p_data);
+typedef void (tSDP_DISC_RES_CB) (uint16_t event, tSDP_DATA *p_data);
 
 /* Define a structure to hold the discovered service information. */
 typedef struct
 {
     union
     {
-        UINT8       u8;                         /* 8-bit integer            */
-        UINT16      u16;                        /* 16-bit integer           */
-        UINT32      u32;                        /* 32-bit integer           */
-        UINT8       array[4];                   /* Variable length field    */
+        uint8_t     u8;                         /* 8-bit integer            */
+        uint16_t    u16;                        /* 16-bit integer           */
+        uint32_t    u32;                        /* 32-bit integer           */
+        uint8_t     array[4];                   /* Variable length field    */
         struct t_sdp_disc_attr *p_sub_attr;     /* Addr of first sub-attr (list)*/
     } v;
 
@@ -114,8 +114,8 @@
 typedef struct t_sdp_disc_attr
 {
     struct t_sdp_disc_attr *p_next_attr;        /* Addr of next linked attr     */
-    UINT16                  attr_id;            /* Attribute ID                 */
-    UINT16                  attr_len_type;      /* Length and type fields       */
+    uint16_t                attr_id;            /* Attribute ID                 */
+    uint16_t                attr_len_type;      /* Length and type fields       */
     tSDP_DISC_ATVAL         attr_value;         /* Variable length entry data   */
 } tSDP_DISC_ATTR;
 
@@ -123,38 +123,38 @@
 {
     tSDP_DISC_ATTR          *p_first_attr;      /* First attribute of record    */
     struct t_sdp_disc_rec   *p_next_rec;        /* Addr of next linked record   */
-    UINT32                  time_read;          /* The time the record was read */
+    uint32_t                time_read;          /* The time the record was read */
     BD_ADDR                 remote_bd_addr;     /* Remote BD address            */
 } tSDP_DISC_REC;
 
 typedef struct
 {
-    UINT32          mem_size;                   /* Memory size of the DB        */
-    UINT32          mem_free;                   /* Memory still available       */
+    uint32_t        mem_size;                   /* Memory size of the DB        */
+    uint32_t        mem_free;                   /* Memory still available       */
     tSDP_DISC_REC   *p_first_rec;               /* Addr of first record in DB   */
-    UINT16          num_uuid_filters;           /* Number of UUIds to filter    */
+    uint16_t        num_uuid_filters;           /* Number of UUIds to filter    */
     tSDP_UUID       uuid_filters[SDP_MAX_UUID_FILTERS]; /* UUIDs to filter      */
-    UINT16          num_attr_filters;           /* Number of attribute filters  */
-    UINT16          attr_filters[SDP_MAX_ATTR_FILTERS]; /* Attributes to filter */
-    UINT8           *p_free_mem;                /* Pointer to free memory       */
+    uint16_t        num_attr_filters;           /* Number of attribute filters  */
+    uint16_t        attr_filters[SDP_MAX_ATTR_FILTERS]; /* Attributes to filter */
+    uint8_t         *p_free_mem;                /* Pointer to free memory       */
 #if (SDP_RAW_DATA_INCLUDED == TRUE)
-    UINT8           *raw_data;                  /* Received record from server. allocated/released by client  */
-    UINT32          raw_size;                   /* size of raw_data */
-    UINT32          raw_used;                   /* length of raw_data used */
+    uint8_t         *raw_data;                  /* Received record from server. allocated/released by client  */
+    uint32_t        raw_size;                   /* size of raw_data */
+    uint32_t        raw_used;                   /* length of raw_data used */
 #endif
 }tSDP_DISCOVERY_DB;
 
 /* This structure is used to add protocol lists and find protocol elements */
 typedef struct
 {
-    UINT16      protocol_uuid;
-    UINT16      num_params;
-    UINT16      params[SDP_MAX_PROTOCOL_PARAMS];
+    uint16_t    protocol_uuid;
+    uint16_t    num_params;
+    uint16_t    params[SDP_MAX_PROTOCOL_PARAMS];
 } tSDP_PROTOCOL_ELEM;
 
 typedef struct
 {
-    UINT16              num_elems;
+    uint16_t            num_elems;
     tSDP_PROTOCOL_ELEM  list_elem[SDP_MAX_LIST_ELEMS];
 } tSDP_PROTO_LIST_ELEM;
 
@@ -163,11 +163,11 @@
 /* Used to set the DI record */
 typedef struct t_sdp_di_record
 {
-    UINT16       vendor;
-    UINT16       vendor_id_source;
-    UINT16       product;
-    UINT16       version;
-    BOOLEAN      primary_record;
+    uint16_t     vendor;
+    uint16_t     vendor_id_source;
+    uint16_t     product;
+    uint16_t     version;
+    bool         primary_record;
     char         client_executable_url[SDP_MAX_ATTR_LEN];   /* optional */
     char         service_description[SDP_MAX_ATTR_LEN];     /* optional */
     char         documentation_url[SDP_MAX_ATTR_LEN];       /* optional */
@@ -176,7 +176,7 @@
 /* Used to get the DI record */
 typedef struct t_sdp_di_get_record
 {
-    UINT16          spec_id;
+    uint16_t        spec_id;
     tSDP_DI_RECORD  rec;
 }tSDP_DI_GET_RECORD;
 
@@ -188,14 +188,14 @@
 **
 ** Description      This function is called to initialize a discovery database.
 **
-** Returns          TRUE if successful, FALSE if one or more parameters are bad
+** Returns          true if successful, false if one or more parameters are bad
 **
 *******************************************************************************/
-BOOLEAN SDP_InitDiscoveryDb (tSDP_DISCOVERY_DB *p_db, UINT32 len,
-                                    UINT16 num_uuid,
+bool    SDP_InitDiscoveryDb (tSDP_DISCOVERY_DB *p_db, uint32_t len,
+                                    uint16_t num_uuid,
                                     tSDP_UUID *p_uuid_list,
-                                    UINT16 num_attr,
-                                    UINT16 *p_attr_list);
+                                    uint16_t num_attr,
+                                    uint16_t *p_attr_list);
 
 /*******************************************************************************
 **
@@ -203,10 +203,10 @@
 **
 ** Description      This function cancels an active query to an SDP server.
 **
-** Returns          TRUE if discovery cancelled, FALSE if a matching activity is not found.
+** Returns          true if discovery cancelled, false if a matching activity is not found.
 **
 *******************************************************************************/
-BOOLEAN SDP_CancelServiceSearch (tSDP_DISCOVERY_DB *p_db);
+bool    SDP_CancelServiceSearch (tSDP_DISCOVERY_DB *p_db);
 
 /*******************************************************************************
 **
@@ -214,10 +214,10 @@
 **
 ** Description      This function queries an SDP server for information.
 **
-** Returns          TRUE if discovery started, FALSE if failed.
+** Returns          true if discovery started, false if failed.
 **
 *******************************************************************************/
-BOOLEAN SDP_ServiceSearchRequest (UINT8 *p_bd_addr,
+bool    SDP_ServiceSearchRequest (uint8_t *p_bd_addr,
                                          tSDP_DISCOVERY_DB *p_db,
                                          tSDP_DISC_CMPL_CB *p_cb);
 
@@ -232,10 +232,10 @@
 **                  SDP_ServiceSearchRequest is that this one does a
 **                  combined ServiceSearchAttributeRequest SDP function.
 **
-** Returns          TRUE if discovery started, FALSE if failed.
+** Returns          true if discovery started, false if failed.
 **
 *******************************************************************************/
-BOOLEAN SDP_ServiceSearchAttributeRequest (UINT8 *p_bd_addr,
+bool    SDP_ServiceSearchAttributeRequest (uint8_t *p_bd_addr,
                                                   tSDP_DISCOVERY_DB *p_db,
                                                   tSDP_DISC_CMPL_CB *p_cb);
 
@@ -250,10 +250,10 @@
 **                  combined ServiceSearchAttributeRequest SDP function with the
 **                  user data piggyback
 **
-** Returns          TRUE if discovery started, FALSE if failed.
+** Returns          true if discovery started, false if failed.
 **
 *******************************************************************************/
-BOOLEAN SDP_ServiceSearchAttributeRequest2 (UINT8 *p_bd_addr,
+bool    SDP_ServiceSearchAttributeRequest2 (uint8_t *p_bd_addr,
                                                    tSDP_DISCOVERY_DB *p_db,
                                                    tSDP_DISC_CMPL_CB2 *p_cb, void * user_data);
 
@@ -272,7 +272,7 @@
 **
 *******************************************************************************/
 tSDP_DISC_REC *SDP_FindAttributeInDb (tSDP_DISCOVERY_DB *p_db,
-                                             UINT16 attr_id,
+                                             uint16_t attr_id,
                                              tSDP_DISC_REC *p_start_rec);
 
 
@@ -287,7 +287,7 @@
 **
 *******************************************************************************/
 tSDP_DISC_ATTR *SDP_FindAttributeInRec (tSDP_DISC_REC *p_rec,
-                                               UINT16 attr_id);
+                                               uint16_t attr_id);
 
 
 /*******************************************************************************
@@ -303,7 +303,7 @@
 **
 *******************************************************************************/
 tSDP_DISC_REC *SDP_FindServiceInDb (tSDP_DISCOVERY_DB *p_db,
-                                           UINT16 service_uuid,
+                                           uint16_t service_uuid,
                                            tSDP_DISC_REC *p_start_rec);
 
 
@@ -337,10 +337,10 @@
 ** Parameters:      p_rec      - pointer to a SDP record.
 **                  p_uuid     - output parameter to save the UUID found.
 **
-** Returns          TRUE if found, otherwise FALSE.
+** Returns          true if found, otherwise false.
 **
 *******************************************************************************/
-BOOLEAN SDP_FindServiceUUIDInRec_128bit(tSDP_DISC_REC *p_rec, tBT_UUID * p_uuid);
+bool    SDP_FindServiceUUIDInRec_128bit(tSDP_DISC_REC *p_rec, tBT_UUID * p_uuid);
 
 /*******************************************************************************
 **
@@ -364,12 +364,12 @@
 ** Description      This function looks at a specific discovery record for a
 **                  protocol list element.
 **
-** Returns          TRUE if found, FALSE if not
+** Returns          true if found, false if not
 **                  If found, the passed protocol list element is filled in.
 **
 *******************************************************************************/
-BOOLEAN SDP_FindProtocolListElemInRec (tSDP_DISC_REC *p_rec,
-                                              UINT16 layer_uuid,
+bool    SDP_FindProtocolListElemInRec (tSDP_DISC_REC *p_rec,
+                                              uint16_t layer_uuid,
                                               tSDP_PROTOCOL_ELEM *p_elem);
 
 
@@ -380,12 +380,12 @@
 ** Description      This function looks at a specific discovery record for a
 **                  protocol list element.
 **
-** Returns          TRUE if found, FALSE if not
+** Returns          true if found, false if not
 **                  If found, the passed protocol list element is filled in.
 **
 *******************************************************************************/
-BOOLEAN SDP_FindAddProtoListsElemInRec (tSDP_DISC_REC *p_rec,
-                                               UINT16 layer_uuid,
+bool    SDP_FindAddProtoListsElemInRec (tSDP_DISC_REC *p_rec,
+                                               uint16_t layer_uuid,
                                                tSDP_PROTOCOL_ELEM *p_elem);
 
 
@@ -398,14 +398,14 @@
 **                  The version number consists of an 8-bit major version and
 **                  an 8-bit minor version.
 **
-** Returns          TRUE if found, FALSE if not
+** Returns          true if found, false if not
 **                  If found, the major and minor version numbers that were passed
 **                  in are filled in.
 **
 *******************************************************************************/
-BOOLEAN SDP_FindProfileVersionInRec (tSDP_DISC_REC *p_rec,
-                                            UINT16 profile_uuid,
-                                            UINT16 *p_version);
+bool    SDP_FindProfileVersionInRec (tSDP_DISC_REC *p_rec,
+                                            uint16_t profile_uuid,
+                                            uint16_t *p_version);
 
 
 /* API into SDP for local service database updates */
@@ -422,7 +422,7 @@
 ** Returns          Record handle if OK, else 0.
 **
 *******************************************************************************/
-UINT32 SDP_CreateRecord (void);
+uint32_t SDP_CreateRecord (void);
 
 
 /*******************************************************************************
@@ -435,10 +435,10 @@
 **
 **                  If a record handle of 0 is passed, all records are deleted.
 **
-** Returns          TRUE if succeeded, else FALSE
+** Returns          true if succeeded, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_DeleteRecord (UINT32 handle);
+bool    SDP_DeleteRecord (uint32_t handle);
 
 
 /*******************************************************************************
@@ -454,7 +454,7 @@
 **                  The size of data copied into p_data is in *p_data_len.
 **
 *******************************************************************************/
-INT32 SDP_ReadRecord(UINT32 handle, UINT8 *p_data, INT32 *p_data_len);
+int32_t SDP_ReadRecord(uint32_t handle, uint8_t *p_data, int32_t *p_data_len);
 
 /*******************************************************************************
 **
@@ -467,12 +467,12 @@
 **
 ** NOTE             Attribute values must be passed as a Big Endian stream.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddAttribute (UINT32 handle, UINT16 attr_id,
-                                 UINT8 attr_type, UINT32 attr_len,
-                                 UINT8 *p_val);
+bool    SDP_AddAttribute (uint32_t handle, uint16_t attr_id,
+                                 uint8_t attr_type, uint32_t attr_len,
+                                 uint8_t *p_val);
 
 
 /*******************************************************************************
@@ -486,12 +486,12 @@
 **
 ** NOTE             Element values must be passed as a Big Endian stream.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddSequence (UINT32 handle,  UINT16 attr_id,
-                                UINT16 num_elem, UINT8 type[],
-                                UINT8 len[], UINT8 *p_val[]);
+bool    SDP_AddSequence (uint32_t handle,  uint16_t attr_id,
+                                uint16_t num_elem, uint8_t type[],
+                                uint8_t len[], uint8_t *p_val[]);
 
 
 /*******************************************************************************
@@ -503,11 +503,11 @@
 **                  If the sequence already exists in the record, it is replaced
 **                  with the new sequence.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddUuidSequence (UINT32 handle,  UINT16 attr_id,
-                                    UINT16 num_uuids, UINT16 *p_uuids);
+bool    SDP_AddUuidSequence (uint32_t handle,  uint16_t attr_id,
+                                    uint16_t num_uuids, uint16_t *p_uuids);
 
 
 /*******************************************************************************
@@ -519,10 +519,10 @@
 **                  If the protocol list already exists in the record, it is replaced
 **                  with the new list.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddProtocolList (UINT32 handle, UINT16 num_elem,
+bool    SDP_AddProtocolList (uint32_t handle, uint16_t num_elem,
                                     tSDP_PROTOCOL_ELEM *p_elem_list);
 
 
@@ -535,10 +535,10 @@
 **                  If the protocol list already exists in the record, it is replaced
 **                  with the new list.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddAdditionProtoLists (UINT32 handle, UINT16 num_elem,
+bool    SDP_AddAdditionProtoLists (uint32_t handle, uint16_t num_elem,
                                           tSDP_PROTO_LIST_ELEM *p_proto_list);
 
 
@@ -551,12 +551,12 @@
 **                  If the version already exists in the record, it is replaced
 **                  with the new one.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddProfileDescriptorList (UINT32 handle,
-                                             UINT16 profile_uuid,
-                                             UINT16 version);
+bool    SDP_AddProfileDescriptorList (uint32_t handle,
+                                             uint16_t profile_uuid,
+                                             uint16_t version);
 
 /*******************************************************************************
 **
@@ -567,12 +567,12 @@
 **                  If the version already exists in the record, it is replaced
 **                  with the new one.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddLanguageBaseAttrIDList (UINT32 handle,
-                                              UINT16 lang, UINT16 char_enc,
-                                              UINT16 base_id);
+bool    SDP_AddLanguageBaseAttrIDList (uint32_t handle,
+                                              uint16_t lang, uint16_t char_enc,
+                                              uint16_t base_id);
 
 /*******************************************************************************
 **
@@ -583,12 +583,12 @@
 **                  If the service list already exists in the record, it is replaced
 **                  with the new list.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddServiceClassIdList (UINT32 handle,
-                                          UINT16 num_services,
-                                          UINT16 *p_service_uuids);
+bool    SDP_AddServiceClassIdList (uint32_t handle,
+                                          uint16_t num_services,
+                                          uint16_t *p_service_uuids);
 
 /*******************************************************************************
 **
@@ -597,10 +597,10 @@
 ** Description      This function is called to delete an attribute from a record.
 **                  This would be through the SDP database maintenance API.
 **
-** Returns          TRUE if deleted OK, else FALSE if not found
+** Returns          true if deleted OK, else false if not found
 **
 *******************************************************************************/
-BOOLEAN SDP_DeleteAttribute (UINT32 handle, UINT16 attr_id);
+bool    SDP_DeleteAttribute (uint32_t handle, uint16_t attr_id);
 
 /* Device Identification APIs */
 
@@ -613,8 +613,8 @@
 ** Returns          Returns SDP_SUCCESS if record added successfully, else error
 **
 *******************************************************************************/
-UINT16 SDP_SetLocalDiRecord (tSDP_DI_RECORD *device_info,
-                                    UINT32 *p_handle);
+uint16_t SDP_SetLocalDiRecord (tSDP_DI_RECORD *device_info,
+                                    uint32_t *p_handle);
 
 /*******************************************************************************
 **
@@ -625,8 +625,8 @@
 ** Returns          SDP_SUCCESS if query started successfully, else error
 **
 *******************************************************************************/
-UINT16 SDP_DiDiscover (BD_ADDR remote_device,
-                              tSDP_DISCOVERY_DB *p_db, UINT32 len,
+uint16_t SDP_DiDiscover (BD_ADDR remote_device,
+                              tSDP_DISCOVERY_DB *p_db, uint32_t len,
                               tSDP_DISC_CMPL_CB *p_cb);
 
 /*******************************************************************************
@@ -638,7 +638,7 @@
 ** Returns          number of DI records found
 **
 *******************************************************************************/
-UINT8  SDP_GetNumDiRecords (tSDP_DISCOVERY_DB *p_db);
+uint8_t SDP_GetNumDiRecords (tSDP_DISCOVERY_DB *p_db);
 
 /*******************************************************************************
 **
@@ -650,7 +650,7 @@
 ** Returns          SDP_SUCCESS if record retrieved, else error
 **
 *******************************************************************************/
-UINT16 SDP_GetDiRecord (UINT8 getRecordIndex,
+uint16_t SDP_GetDiRecord (uint8_t getRecordIndex,
                                tSDP_DI_GET_RECORD *device_info,
                                tSDP_DISCOVERY_DB *p_db);
 
@@ -664,7 +664,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-UINT8 SDP_SetTraceLevel (UINT8 new_level);
+uint8_t SDP_SetTraceLevel (uint8_t new_level);
 
 /*******************************************************************************
 **
@@ -675,10 +675,10 @@
 **
 ** Parameters:      p_rec      - pointer to a SDP record.
 **
-** Returns          TRUE if found, otherwise FALSE.
+** Returns          true if found, otherwise false.
 **
 *******************************************************************************/
-BOOLEAN SDP_FindServiceUUIDInRec(tSDP_DISC_REC *p_rec, tBT_UUID *p_uuid);
+bool    SDP_FindServiceUUIDInRec(tSDP_DISC_REC *p_rec, tBT_UUID *p_uuid);
 
 #ifdef __cplusplus
 }
diff --git a/stack/include/sdpdefs.h b/stack/include/sdpdefs.h
index 8b0eedf..07dfa5e 100644
--- a/stack/include/sdpdefs.h
+++ b/stack/include/sdpdefs.h
@@ -276,7 +276,7 @@
 
 #define UUID_SERVCLASS_TEST_SERVER              0x9000      /* Test Group UUID */
 
-#if (BTM_WBS_INCLUDED == TRUE )
+#if (BTM_WBS_INCLUDED == TRUE)
 #define UUID_CODEC_CVSD                         0x0001   /* CVSD */
 #define UUID_CODEC_MSBC                         0x0002   /* mSBC */
 #endif
@@ -308,8 +308,8 @@
 #define  SIZE_IN_NEXT_LONG            7
 
 /* Language Encoding Constants */
-#define LANG_ID_CODE_ENGLISH            ((UINT16) 0x656e)   /* "en" */
-#define LANG_ID_CHAR_ENCODE_UTF8        ((UINT16) 0x006a)   /* UTF-8 */
+#define LANG_ID_CODE_ENGLISH            ((uint16_t) 0x656e)   /* "en" */
+#define LANG_ID_CHAR_ENCODE_UTF8        ((uint16_t) 0x006a)   /* UTF-8 */
 
 /* Constants used for display purposes only.  These define ovelapping attribute values */
 #define  ATTR_ID_VERS_OR_GRP_OR_DRELNUM_OR_IPSUB_OR_SPECID  0x0200
diff --git a/stack/include/smp_api.h b/stack/include/smp_api.h
index 7f051f0..75c8f17 100644
--- a/stack/include/smp_api.h
+++ b/stack/include/smp_api.h
@@ -33,7 +33,7 @@
 #define SMP_PIN_CODE_LEN_MAX    PIN_CODE_LEN
 #define SMP_PIN_CODE_LEN_MIN    6
 
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
 /* SMP command code */
 #define SMP_OPCODE_PAIRING_REQ            0x01
 #define SMP_OPCODE_PAIRING_RSP            0x02
@@ -68,7 +68,7 @@
 #define SMP_SC_LOC_OOB_DATA_UP_EVT  10  /* SC OOB local data set is created */
                                         /* (as result of SMP_CrLocScOobData(...)) */
 #define SMP_BR_KEYS_REQ_EVT     12      /* SMP over BR keys request event */
-typedef UINT8   tSMP_EVT;
+typedef uint8_t tSMP_EVT;
 
 
 /* pairing failure reason code */
@@ -108,7 +108,7 @@
 #define SMP_CONN_TOUT               (SMP_MAX_FAIL_RSN_PER_SPEC + 0x0B)
 #define SMP_SUCCESS                 0
 
-typedef UINT8 tSMP_STATUS;
+typedef uint8_t tSMP_STATUS;
 
 
 /* Device IO capability */
@@ -118,7 +118,7 @@
 #define SMP_IO_CAP_NONE     BTM_IO_CAP_NONE   /* NoInputNoOutput */
 #define SMP_IO_CAP_KBDISP   BTM_IO_CAP_KBDISP   /* Keyboard Display */
 #define SMP_IO_CAP_MAX      BTM_IO_CAP_MAX
-typedef UINT8  tSMP_IO_CAP;
+typedef uint8_t tSMP_IO_CAP;
 
 #ifndef SMP_DEFAULT_IO_CAPS
     #define SMP_DEFAULT_IO_CAPS     SMP_IO_CAP_KBDISP
@@ -131,7 +131,7 @@
     SMP_OOB_PRESENT,
     SMP_OOB_UNKNOWN
 };
-typedef UINT8  tSMP_OOB_FLAG;
+typedef uint8_t tSMP_OOB_FLAG;
 
 /* type of OOB data required from application */
 enum
@@ -141,7 +141,7 @@
     SMP_OOB_LOCAL,
     SMP_OOB_BOTH
 };
-typedef UINT8   tSMP_OOB_DATA_TYPE;
+typedef uint8_t tSMP_OOB_DATA_TYPE;
 
 #define SMP_AUTH_NO_BOND        0x00
 #define SMP_AUTH_GEN_BOND       0x01 //todo sdh change GEN_BOND to BOND
@@ -182,12 +182,12 @@
  /* All AuthReq RFU bits are set to 1 - NOTE: reserved bit in Bonding_Flags is not set */
 #define SMP_AUTH_ALL_RFU_SET    0xF8
 
-typedef UINT8 tSMP_AUTH_REQ;
+typedef uint8_t tSMP_AUTH_REQ;
 
 #define SMP_SEC_NONE                 0
 #define SMP_SEC_UNAUTHENTICATE      (1 << 0)
 #define SMP_SEC_AUTHENTICATED       (1 << 2)
-typedef UINT8 tSMP_SEC_LEVEL;
+typedef uint8_t tSMP_SEC_LEVEL;
 
 /* Maximum Encryption Key Size range */
 #define SMP_ENCR_KEY_SIZE_MIN       7
@@ -198,7 +198,7 @@
 #define SMP_SEC_KEY_TYPE_ID                 (1 << 1)    /* identity key */
 #define SMP_SEC_KEY_TYPE_CSRK               (1 << 2)    /* slave CSRK */
 #define SMP_SEC_KEY_TYPE_LK                 (1 << 3)    /* BR/EDR link key */
-typedef UINT8 tSMP_KEYS;
+typedef uint8_t tSMP_KEYS;
 
 #define SMP_BR_SEC_DEFAULT_KEY   (SMP_SEC_KEY_TYPE_ENC | SMP_SEC_KEY_TYPE_ID | \
                                   SMP_SEC_KEY_TYPE_CSRK)
@@ -213,7 +213,7 @@
 #define SMP_SC_KEY_CLEARED      3   /* passkey cleared */
 #define SMP_SC_KEY_COMPLT       4   /* passkey entry completed */
 #define SMP_SC_KEY_OUT_OF_RANGE 5   /* out of range */
-typedef UINT8 tSMP_SC_KEY_TYPE;
+typedef uint8_t tSMP_SC_KEY_TYPE;
 
 /* data type for BTM_SP_IO_REQ_EVT */
 typedef struct
@@ -221,7 +221,7 @@
     tSMP_IO_CAP     io_cap;         /* local IO capabilities */
     tSMP_OOB_FLAG   oob_data;       /* OOB data present (locally) for the peer device */
     tSMP_AUTH_REQ   auth_req;       /* Authentication required (for local device) */
-    UINT8           max_key_size;   /* max encryption key size */
+    uint8_t         max_key_size;   /* max encryption key size */
     tSMP_KEYS       init_keys;      /* initiator keys to be distributed */
     tSMP_KEYS       resp_keys;      /* responder keys */
 } tSMP_IO_REQ;
@@ -230,8 +230,8 @@
 {
     tSMP_STATUS reason;
     tSMP_SEC_LEVEL sec_level;
-    BOOLEAN is_pair_cancel;
-    BOOLEAN smp_over_br;
+    bool    is_pair_cancel;
+    bool    smp_over_br;
 } tSMP_CMPL;
 
 typedef struct
@@ -243,7 +243,7 @@
 /* the data associated with the info sent to the peer via OOB interface */
 typedef struct
 {
-    BOOLEAN         present;
+    bool            present;
     BT_OCTET16      randomizer;
     BT_OCTET16      commitment;
 
@@ -258,7 +258,7 @@
 /* the data associated with the info received from the peer via OOB interface */
 typedef struct
 {
-    BOOLEAN         present;
+    bool            present;
     BT_OCTET16      randomizer;
     BT_OCTET16      commitment;
     tBLE_BD_ADDR    addr_rcvd_from;
@@ -273,7 +273,7 @@
 
 typedef union
 {
-    UINT32          passkey;
+    uint32_t        passkey;
     tSMP_IO_REQ     io_req;     /* IO request */
     tSMP_CMPL       cmplt;
     tSMP_OOB_DATA_TYPE  req_oob_type;
@@ -284,18 +284,18 @@
 /* AES Encryption output */
 typedef struct
 {
-    UINT8   status;
-    UINT8   param_len;
-    UINT16  opcode;
-    UINT8   param_buf[BT_OCTET16_LEN];
+    uint8_t  status;
+    uint8_t  param_len;
+    uint16_t opcode;
+    uint8_t  param_buf[BT_OCTET16_LEN];
 } tSMP_ENC;
 
 /* Security Manager events - Called by the stack when Security Manager related events occur.*/
-typedef UINT8 (tSMP_CALLBACK) (tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data);
+typedef uint8_t (tSMP_CALLBACK) (tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data);
 
 /* callback function for CMAC algorithm
 */
-typedef void (tCMAC_CMPL_CBACK)(UINT8 *p_mac, UINT16 tlen, UINT32 sign_counter);
+typedef void (tCMAC_CMPL_CBACK)(uint8_t *p_mac, uint16_t tlen, uint32_t sign_counter);
 
 /*****************************************************************************
 **  External Function Declarations
@@ -323,7 +323,7 @@
 ** Returns          The new or current trace level
 **
 *******************************************************************************/
-extern UINT8 SMP_SetTraceLevel (UINT8 new_level);
+extern uint8_t SMP_SetTraceLevel (uint8_t new_level);
 
 /*******************************************************************************
 **
@@ -334,7 +334,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern BOOLEAN SMP_Register (tSMP_CALLBACK *p_cback);
+extern bool    SMP_Register (tSMP_CALLBACK *p_cback);
 
 /*******************************************************************************
 **
@@ -364,10 +364,10 @@
 **
 ** Description      This function is called to cancel a SMP pairing.
 **
-** Returns          TRUE - pairing cancelled
+** Returns          true - pairing cancelled
 **
 *******************************************************************************/
-extern  BOOLEAN SMP_PairCancel (BD_ADDR bd_addr);
+extern  bool    SMP_PairCancel (BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
@@ -382,7 +382,7 @@
 ** Returns          None
 **
 *******************************************************************************/
-extern void SMP_SecurityGrant(BD_ADDR bd_addr, UINT8 res);
+extern void SMP_SecurityGrant(BD_ADDR bd_addr, uint8_t res);
 
 /*******************************************************************************
 **
@@ -397,7 +397,7 @@
 **                  BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
 **
 *******************************************************************************/
-extern void SMP_PasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey);
+extern void SMP_PasskeyReply (BD_ADDR bd_addr, uint8_t res, uint32_t passkey);
 
 /*******************************************************************************
 **
@@ -411,7 +411,7 @@
 **                  res          - comparison result SMP_SUCCESS if success
 **
 *******************************************************************************/
-extern void SMP_ConfirmReply (BD_ADDR bd_addr, UINT8 res);
+extern void SMP_ConfirmReply (BD_ADDR bd_addr, uint8_t res);
 
 /*******************************************************************************
 **
@@ -425,8 +425,8 @@
 **                  p_data      - SM Randomizer  C.
 **
 *******************************************************************************/
-extern void SMP_OobDataReply(BD_ADDR bd_addr, tSMP_STATUS res, UINT8 len,
-                             UINT8 *p_data);
+extern void SMP_OobDataReply(BD_ADDR bd_addr, tSMP_STATUS res, uint8_t len,
+                             uint8_t *p_data);
 
 /*******************************************************************************
 **
@@ -438,7 +438,7 @@
 ** Parameters:      p_data      - pointer to the data
 **
 *******************************************************************************/
-extern void SMP_SecureConnectionOobDataReply(UINT8 *p_data);
+extern void SMP_SecureConnectionOobDataReply(uint8_t *p_data);
 
 /*******************************************************************************
 **
@@ -454,10 +454,10 @@
 **                  pt_len              - plain text length
 **                  p_out               - pointer to the encrypted outputs
 **
-**  Returns         Boolean - TRUE: encryption is successful
+**  Returns         Boolean - true: encryption is successful
 *******************************************************************************/
-extern BOOLEAN SMP_Encrypt (UINT8 *key, UINT8 key_len,
-                            UINT8 *plain_text, UINT8 pt_len,
+extern bool    SMP_Encrypt (uint8_t *key, uint8_t key_len,
+                            uint8_t *plain_text, uint8_t pt_len,
                             tSMP_ENC *p_out);
 
 /*******************************************************************************
@@ -471,7 +471,7 @@
 **                  value        - keypress notification parameter value
 **
 *******************************************************************************/
-extern void SMP_KeypressNotification (BD_ADDR bd_addr, UINT8 value);
+extern void SMP_KeypressNotification (BD_ADDR bd_addr, uint8_t value);
 
 /*******************************************************************************
 **
@@ -483,9 +483,9 @@
 ** Parameters:      bd_addr      - Address of the device to send OOB data block
 **                                 to.
 **
-**  Returns         Boolean - TRUE: creation of local SC OOB data set started.
+**  Returns         Boolean - true: creation of local SC OOB data set started.
 *******************************************************************************/
-extern BOOLEAN SMP_CreateLocalSecureConnectionsOobData (
+extern bool    SMP_CreateLocalSecureConnectionsOobData (
                                                                   tBLE_BD_ADDR *addr_to_send_to);
 
 #ifdef __cplusplus
diff --git a/stack/include/srvc_api.h b/stack/include/srvc_api.h
index cdd1fd6..2988a29 100644
--- a/stack/include/srvc_api.h
+++ b/stack/include/srvc_api.h
@@ -30,7 +30,7 @@
 #define DIS_SUCCESS             GATT_SUCCESS
 #define DIS_ILLEGAL_PARAM       GATT_ILLEGAL_PARAMETER
 #define DIS_NO_RESOURCES        GATT_NO_RESOURCES
-typedef UINT8 tDIS_STATUS;
+typedef uint8_t tDIS_STATUS;
 
 
 /*****************************************************************************
@@ -46,7 +46,7 @@
 #define DIS_ATTR_MANU_NAME_BIT      0x0040
 #define DIS_ATTR_IEEE_DATA_BIT      0x0080
 #define DIS_ATTR_PNP_ID_BIT         0x0100
-typedef UINT16  tDIS_ATTR_MASK;
+typedef uint16_t tDIS_ATTR_MASK;
 
 #define DIS_ATTR_ALL_MASK           0xffff
 
@@ -54,22 +54,22 @@
 
 typedef struct
 {
-    UINT16      len;
-    UINT8       *p_data;
+    uint16_t    len;
+    uint8_t     *p_data;
 }tDIS_STRING;
 
 typedef struct
 {
-    UINT16       vendor_id;
-    UINT16       product_id;
-    UINT16       product_version;
-    UINT8        vendor_id_src;
+    uint16_t     vendor_id;
+    uint16_t     product_id;
+    uint16_t     product_version;
+    uint8_t      vendor_id_src;
 
 }tDIS_PNP_ID;
 
 typedef union
 {
-    UINT64              system_id;
+    uint64_t            system_id;
     tDIS_PNP_ID         pnp_id;
     tDIS_STRING         data_str;
 }tDIS_ATTR;
@@ -78,10 +78,10 @@
 
 typedef struct
 {
-    UINT16                  attr_mask;
-    UINT64                  system_id;
+    uint16_t                attr_mask;
+    uint64_t                system_id;
     tDIS_PNP_ID             pnp_id;
-    UINT8                   *data_string[DIS_MAX_STRING_DATA];
+    uint8_t                 *data_string[DIS_MAX_STRING_DATA];
 }tDIS_VALUE;
 
 
@@ -93,8 +93,8 @@
 typedef struct
 {
     BD_ADDR remote_bda;
-    BOOLEAN need_rsp;
-    UINT16  clt_cfg;
+    bool    need_rsp;
+    uint16_t clt_cfg;
 }tBA_WRITE_DATA;
 
 #define BA_READ_CLT_CFG_REQ     1
@@ -103,16 +103,16 @@
 #define BA_READ_LEVEL_REQ       4
 #define BA_WRITE_CLT_CFG_REQ    5
 
-typedef void (tBA_CBACK)(UINT8 app_id, UINT8 event, tBA_WRITE_DATA *p_data);
+typedef void (tBA_CBACK)(uint8_t app_id, uint8_t event, tBA_WRITE_DATA *p_data);
 
 #define BA_LEVEL_NOTIFY         0x01
 #define BA_LEVEL_PRE_FMT        0x02
 #define BA_LEVEL_RPT_REF        0x04
-typedef UINT8   tBA_LEVEL_DESCR;
+typedef uint8_t tBA_LEVEL_DESCR;
 
 typedef struct
 {
-    BOOLEAN         is_pri;
+    bool            is_pri;
     tBA_LEVEL_DESCR     ba_level_descr;
     tGATT_TRANSPORT transport;
     tBA_CBACK       *p_cback;
@@ -121,8 +121,8 @@
 
 typedef union
 {
-    UINT8       ba_level;
-    UINT16      clt_cfg;
+    uint8_t     ba_level;
+    uint16_t    clt_cfg;
     tGATT_CHAR_RPT_REF  rpt_ref;
     tGATT_CHAR_PRES     pres_fmt;
 }tBA_RSP_DATA;
@@ -176,7 +176,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-extern BOOLEAN DIS_ReadDISInfo(BD_ADDR peer_bda, tDIS_READ_CBACK *p_cback,
+extern bool    DIS_ReadDISInfo(BD_ADDR peer_bda, tDIS_READ_CBACK *p_cback,
                                tDIS_ATTR_MASK mask);
 
 /*******************************************************************************
@@ -189,7 +189,7 @@
 ** Description      Instantiate a Battery service
 **
 *******************************************************************************/
-extern UINT16 Battery_Instantiate (UINT8 app_id, tBA_REG_INFO *p_reg_info);
+extern uint16_t Battery_Instantiate (uint8_t app_id, tBA_REG_INFO *p_reg_info);
 
 /*******************************************************************************
 **
@@ -198,7 +198,7 @@
 ** Description      Respond to a battery service request
 **
 *******************************************************************************/
-extern void Battery_Rsp (UINT8 app_id, tGATT_STATUS st, UINT8 event, tBA_RSP_DATA *p_rsp);
+extern void Battery_Rsp (uint8_t app_id, tGATT_STATUS st, uint8_t event, tBA_RSP_DATA *p_rsp);
 /*******************************************************************************
 **
 ** Function         Battery_Notify
@@ -206,7 +206,7 @@
 ** Description      Send battery level notification
 **
 *******************************************************************************/
-extern void Battery_Notify (UINT8 app_id, BD_ADDR remote_bda, UINT8 battery_level);
+extern void Battery_Notify (uint8_t app_id, BD_ADDR remote_bda, uint8_t battery_level);
 
 
 #ifdef __cplusplus
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);
 }
diff --git a/stack/mcap/mca_api.c b/stack/mcap/mca_api.c
index 21c3640..6201e52 100644
--- a/stack/mcap/mca_api.c
+++ b/stack/mcap/mca_api.c
@@ -96,7 +96,7 @@
 **                  the input parameter is 0xff.
 **
 *******************************************************************************/
-UINT8 MCA_SetTraceLevel (UINT8 level)
+uint8_t MCA_SetTraceLevel (uint8_t level)
 {
     if (level != 0xFF)
         mca_cb.trace_level = level;
@@ -147,14 +147,14 @@
                 L2CA_Register(p_reg->data_psm, (tL2CAP_APPL_INFO *) &l2c_dacp_appl))
             {
                 /* set security level */
-                BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_MCAP_CTRL, p_reg->sec_mask,
+                BTM_SetSecurityLevel(false, "", BTM_SEC_SERVICE_MCAP_CTRL, p_reg->sec_mask,
                     p_reg->ctrl_psm, BTM_SEC_PROTO_MCA, MCA_CTRL_TCID);
 
                 /* in theory, we do not need this one for data_psm
                  * If we don't, L2CAP rejects with security block (3),
                  * which is different reject code from what MCAP spec suggests.
                  * we set this one, so mca_l2c_dconn_ind_cback can reject /w no resources (4) */
-                BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_MCAP_DATA, p_reg->sec_mask,
+                BTM_SetSecurityLevel(false, "", BTM_SEC_SERVICE_MCAP_DATA, p_reg->sec_mask,
                     p_reg->data_psm, BTM_SEC_PROTO_MCA, MCA_CTRL_TCID);
             }
             else
@@ -331,7 +331,7 @@
 **
 *******************************************************************************/
 tMCA_RESULT MCA_ConnectReq(tMCA_HANDLE handle, BD_ADDR bd_addr,
-                           UINT16 ctrl_psm, UINT16 sec_mask)
+                           uint16_t ctrl_psm, uint16_t sec_mask)
 {
     tMCA_RESULT result = MCA_BAD_HANDLE;
     tMCA_CCB    *p_ccb;
@@ -352,7 +352,7 @@
         result = MCA_NO_RESOURCES;
         if (p_ccb->ctrl_vpsm)
         {
-            BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_MCAP_CTRL, sec_mask,
+            BTM_SetSecurityLevel(true, "", BTM_SEC_SERVICE_MCAP_CTRL, sec_mask,
                 p_ccb->ctrl_vpsm, BTM_SEC_PROTO_MCA, MCA_CTRL_TCID);
             p_ccb->lcid = mca_l2c_open_req(bd_addr, p_ccb->ctrl_vpsm, NULL);
             if (p_ccb->lcid)
@@ -418,9 +418,9 @@
 ** Returns          MCA_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-tMCA_RESULT MCA_CreateMdl(tMCA_CL mcl, tMCA_DEP dep, UINT16 data_psm,
-                                         UINT16 mdl_id, UINT8 peer_dep_id,
-                                         UINT8 cfg, const tMCA_CHNL_CFG *p_chnl_cfg)
+tMCA_RESULT MCA_CreateMdl(tMCA_CL mcl, tMCA_DEP dep, uint16_t data_psm,
+                                         uint16_t mdl_id, uint8_t peer_dep_id,
+                                         uint8_t cfg, const tMCA_CHNL_CFG *p_chnl_cfg)
 {
     tMCA_RESULT     result = MCA_BAD_HANDLE;
     tMCA_CCB        *p_ccb = mca_ccb_by_hdl(mcl);
@@ -465,7 +465,7 @@
                 p_evt_data->param       = cfg;
                 p_evt_data->op_code     = MCA_OP_MDL_CREATE_REQ;
                 p_evt_data->hdr.event   = MCA_CCB_API_REQ_EVT;
-                p_evt_data->hdr.layer_specific   = FALSE;
+                p_evt_data->hdr.layer_specific   = false;
                 mca_ccb_event(p_ccb, MCA_CCB_API_REQ_EVT, (tMCA_CCB_EVT *)p_evt_data);
                 return MCA_SUCCESS;
             } else {
@@ -494,7 +494,7 @@
 **
 *******************************************************************************/
 tMCA_RESULT MCA_CreateMdlRsp(tMCA_CL mcl, tMCA_DEP dep,
-                                            UINT16 mdl_id, UINT8 cfg, UINT8 rsp_code,
+                                            uint16_t mdl_id, uint8_t cfg, uint8_t rsp_code,
                                             const tMCA_CHNL_CFG *p_chnl_cfg)
 {
     tMCA_RESULT     result = MCA_BAD_HANDLE;
@@ -591,8 +591,8 @@
 ** Returns          MCA_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-tMCA_RESULT MCA_ReconnectMdl(tMCA_CL mcl, tMCA_DEP dep, UINT16 data_psm,
-                                            UINT16 mdl_id, const tMCA_CHNL_CFG *p_chnl_cfg)
+tMCA_RESULT MCA_ReconnectMdl(tMCA_CL mcl, tMCA_DEP dep, uint16_t data_psm,
+                                            uint16_t mdl_id, const tMCA_CHNL_CFG *p_chnl_cfg)
 {
     tMCA_RESULT     result = MCA_BAD_HANDLE;
     tMCA_CCB        *p_ccb = mca_ccb_by_hdl(mcl);
@@ -656,7 +656,7 @@
 **
 *******************************************************************************/
 tMCA_RESULT MCA_ReconnectMdlRsp(tMCA_CL mcl, tMCA_DEP dep,
-                                               UINT16 mdl_id, UINT8 rsp_code,
+                                               uint16_t mdl_id, uint8_t rsp_code,
                                                const tMCA_CHNL_CFG *p_chnl_cfg)
 {
     tMCA_RESULT     result = MCA_BAD_HANDLE;
@@ -742,7 +742,7 @@
         }
 
         p_dcb->p_chnl_cfg       = p_chnl_cfg;
-        BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_MCAP_DATA, p_ccb->sec_mask,
+        BTM_SetSecurityLevel(true, "", BTM_SEC_SERVICE_MCAP_DATA, p_ccb->sec_mask,
             p_ccb->data_vpsm, BTM_SEC_PROTO_MCA, p_ccb->p_tx_req->dcb_idx);
         p_dcb->lcid = mca_l2c_open_req(p_ccb->peer_addr, p_ccb->data_vpsm, p_dcb->p_chnl_cfg);
         if (p_dcb->lcid)
@@ -814,7 +814,7 @@
 ** Returns          MCA_SUCCESS if successful, otherwise error.
 **
 *******************************************************************************/
-tMCA_RESULT MCA_Delete(tMCA_CL mcl, UINT16 mdl_id)
+tMCA_RESULT MCA_Delete(tMCA_CL mcl, uint16_t mdl_id)
 {
     tMCA_RESULT     result = MCA_BAD_HANDLE;
     tMCA_CCB        *p_ccb = mca_ccb_by_hdl(mcl);
@@ -893,9 +893,9 @@
 ** Returns          L2CAP channel ID if successful, otherwise 0.
 **
 *******************************************************************************/
-UINT16 MCA_GetL2CapChannel (tMCA_DL mdl)
+uint16_t MCA_GetL2CapChannel (tMCA_DL mdl)
 {
-    UINT16  lcid = 0;
+    uint16_t lcid = 0;
     tMCA_DCB *p_dcb = mca_dcb_by_hdl(mdl);
 
     MCA_TRACE_API ("MCA_GetL2CapChannel: %d ", mdl);
diff --git a/stack/mcap/mca_cact.c b/stack/mcap/mca_cact.c
index 583a342..8513bb8 100644
--- a/stack/mcap/mca_cact.c
+++ b/stack/mcap/mca_cact.c
@@ -65,7 +65,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void mca_ccb_report_event(tMCA_CCB *p_ccb, UINT8 event, tMCA_CTRL *p_data)
+void mca_ccb_report_event(tMCA_CCB *p_ccb, uint8_t event, tMCA_CTRL *p_data)
 {
     if (p_ccb && p_ccb->p_rcb && p_ccb->p_rcb->p_cback)
         (*p_ccb->p_rcb->p_cback)(mca_rcb_to_handle(p_ccb->p_rcb), mca_ccb_to_hdl(p_ccb), event, p_data);
@@ -98,8 +98,8 @@
 void mca_ccb_snd_req(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data)
 {
     tMCA_CCB_MSG *p_msg = (tMCA_CCB_MSG *)p_data;
-    UINT8   *p, *p_start;
-    BOOLEAN is_abort = FALSE;
+    uint8_t *p, *p_start;
+    bool    is_abort = false;
     tMCA_DCB *p_dcb;
 
     MCA_TRACE_DEBUG ("mca_ccb_snd_req cong=%d req=%d", p_ccb->cong, p_msg->op_code);
@@ -113,7 +113,7 @@
         mca_dcb_event(p_dcb, MCA_DCB_API_CLOSE_EVT, NULL);
         osi_free_and_reset((void **)&p_ccb->p_tx_req);
         p_ccb->status = MCA_CCB_STAT_NORM;
-        is_abort = TRUE;
+        is_abort = true;
     }
 
     /* no pending outgoing messages or it's an abort request for a pending data channel */
@@ -125,14 +125,14 @@
             BT_HDR *p_pkt = (BT_HDR *)osi_malloc(MCA_CTRL_MTU);
 
             p_pkt->offset = L2CAP_MIN_OFFSET;
-            p = p_start = (UINT8*)(p_pkt + 1) + L2CAP_MIN_OFFSET;
+            p = p_start = (uint8_t*)(p_pkt + 1) + L2CAP_MIN_OFFSET;
             *p++ = p_msg->op_code;
             UINT16_TO_BE_STREAM (p, p_msg->mdl_id);
             if (p_msg->op_code == MCA_OP_MDL_CREATE_REQ) {
                 *p++ = p_msg->mdep_id;
                 *p++ = p_msg->param;
             }
-            p_msg->hdr.layer_specific = TRUE;   /* mark this message as sent */
+            p_msg->hdr.layer_specific = true;   /* mark this message as sent */
             p_pkt->len = p - p_start;
             L2CA_DataWrite (p_ccb->lcid, p_pkt);
             period_ms_t interval_ms = p_ccb->p_rcb->reg.rsp_tout * 1000;
@@ -162,29 +162,29 @@
 void mca_ccb_snd_rsp(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data)
 {
     tMCA_CCB_MSG *p_msg = (tMCA_CCB_MSG *)p_data;
-    UINT8   *p, *p_start;
-    BOOLEAN chk_mdl = FALSE;
+    uint8_t *p, *p_start;
+    bool    chk_mdl = false;
     BT_HDR *p_pkt = (BT_HDR *)osi_malloc(MCA_CTRL_MTU);
 
     MCA_TRACE_DEBUG("%s cong=%d req=%d", __func__, p_ccb->cong, p_msg->op_code);
     /* assume that API functions verified the parameters */
 
     p_pkt->offset = L2CAP_MIN_OFFSET;
-    p = p_start = (UINT8*)(p_pkt + 1) + L2CAP_MIN_OFFSET;
+    p = p_start = (uint8_t*)(p_pkt + 1) + L2CAP_MIN_OFFSET;
     *p++ = p_msg->op_code;
     *p++ = p_msg->rsp_code;
     UINT16_TO_BE_STREAM (p, p_msg->mdl_id);
     if (p_msg->op_code == MCA_OP_MDL_CREATE_RSP) {
         *p++ = p_msg->param;
-        chk_mdl = TRUE;
+        chk_mdl = true;
     }
     else if (p_msg->op_code == MCA_OP_MDL_RECONNECT_RSP) {
-        chk_mdl = TRUE;
+        chk_mdl = true;
     }
 
     if (chk_mdl && p_msg->rsp_code == MCA_RSP_SUCCESS) {
         mca_dcb_by_hdl(p_msg->dcb_idx);
-        BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_MCAP_DATA,
+        BTM_SetSecurityLevel(false, "", BTM_SEC_SERVICE_MCAP_DATA,
                              p_ccb->sec_mask,
                              p_ccb->p_rcb->reg.data_psm, BTM_SEC_PROTO_MCA,
                              p_msg->dcb_idx);
@@ -256,18 +256,18 @@
 void mca_ccb_hdl_req(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data)
 {
     BT_HDR  *p_pkt = &p_data->hdr;
-    UINT8   *p, *p_start;
+    uint8_t *p, *p_start;
     tMCA_DCB    *p_dcb;
     tMCA_CTRL       evt_data;
     tMCA_CCB_MSG    *p_rx_msg = NULL;
-    UINT8           reject_code = MCA_RSP_NO_RESOURCE;
-    BOOLEAN         send_rsp = FALSE;
-    BOOLEAN         check_req = FALSE;
-    UINT8           reject_opcode;
+    uint8_t         reject_code = MCA_RSP_NO_RESOURCE;
+    bool            send_rsp = false;
+    bool            check_req = false;
+    uint8_t         reject_opcode;
 
     MCA_TRACE_DEBUG ("mca_ccb_hdl_req status:%d", p_ccb->status);
     p_rx_msg = (tMCA_CCB_MSG *)p_pkt;
-    p = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+    p = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
     evt_data.hdr.op_code = *p++;
     BE_STREAM_TO_UINT16 (evt_data.hdr.mdl_id, p);
     reject_opcode = evt_data.hdr.op_code+1;
@@ -280,7 +280,7 @@
         if ((p_ccb->status == MCA_CCB_STAT_PENDING) && (evt_data.hdr.op_code == MCA_OP_MDL_ABORT_REQ))
         {
             reject_code = MCA_RSP_SUCCESS;
-            send_rsp = TRUE;
+            send_rsp = true;
             /* clear the pending status */
             p_ccb->status = MCA_CCB_STAT_NORM;
             if (p_ccb->p_tx_req && ((p_dcb = mca_dcb_by_hdl(p_ccb->p_tx_req->dcb_idx))!= NULL))
@@ -306,7 +306,7 @@
         {
             MCA_TRACE_DEBUG ("local is ACP. accept the cmd from INT");
             /* local is acceptor, need to handle the request */
-            check_req = TRUE;
+            check_req = true;
             reject_code = MCA_RSP_SUCCESS;
             /* drop the previous request */
             if ((p_ccb->p_tx_req->op_code == MCA_OP_MDL_CREATE_REQ) &&
@@ -327,7 +327,7 @@
     else if (p_pkt->layer_specific != MCA_RSP_SUCCESS)
     {
 
-        reject_code = (UINT8)p_pkt->layer_specific;
+        reject_code = (uint8_t)p_pkt->layer_specific;
         if (((evt_data.hdr.op_code >= MCA_NUM_STANDARD_OPCODE) &&
             (evt_data.hdr.op_code < MCA_FIRST_SYNC_OP)) ||
             (evt_data.hdr.op_code > MCA_LAST_SYNC_OP))
@@ -339,7 +339,7 @@
     }
     else
     {
-        check_req = TRUE;
+        check_req = true;
         reject_code = MCA_RSP_SUCCESS;
     }
 
@@ -395,7 +395,7 @@
                 case MCA_OP_MDL_DELETE_REQ:
                     /* delete the associated mdl */
                     mca_dcb_close_by_mdl_id(p_ccb, evt_data.hdr.mdl_id);
-                    send_rsp = TRUE;
+                    send_rsp = true;
                     break;
                 }
             }
@@ -406,7 +406,7 @@
         || send_rsp) {
         BT_HDR *p_buf = (BT_HDR *)osi_malloc(MCA_CTRL_MTU);
         p_buf->offset = L2CAP_MIN_OFFSET;
-        p = p_start = (UINT8*)(p_buf + 1) + L2CAP_MIN_OFFSET;
+        p = p_start = (uint8_t*)(p_buf + 1) + L2CAP_MIN_OFFSET;
         *p++ = reject_opcode;
         *p++ = reject_code;
         UINT16_TO_BE_STREAM(p, evt_data.hdr.mdl_id);
@@ -452,9 +452,9 @@
 void mca_ccb_hdl_rsp(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data)
 {
     BT_HDR  *p_pkt = &p_data->hdr;
-    UINT8   *p;
+    uint8_t *p;
     tMCA_CTRL   evt_data;
-    BOOLEAN     chk_mdl = FALSE;
+    bool        chk_mdl = false;
     tMCA_DCB    *p_dcb;
     tMCA_RESULT result = MCA_BAD_HANDLE;
     tMCA_TC_TBL *p_tbl;
@@ -462,7 +462,7 @@
     if (p_ccb->p_tx_req)
     {
         /* verify that the received response matches the sent request */
-        p = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+        p = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
         evt_data.hdr.op_code = *p++;
         if ((evt_data.hdr.op_code == 0) ||
             ((p_ccb->p_tx_req->op_code + 1) == evt_data.hdr.op_code))
@@ -473,10 +473,10 @@
             if (evt_data.hdr.op_code == MCA_OP_MDL_CREATE_RSP)
             {
                 evt_data.create_cfm.cfg = *p++;
-                chk_mdl = TRUE;
+                chk_mdl = true;
             }
             else if (evt_data.hdr.op_code == MCA_OP_MDL_RECONNECT_RSP)
-                    chk_mdl = TRUE;
+                    chk_mdl = true;
 
             if (chk_mdl)
             {
@@ -498,7 +498,7 @@
                     else if (p_dcb->p_chnl_cfg)
                     {
                         /* the data channel configuration is known. Proceed with data channel initiation */
-                        BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_MCAP_DATA, p_ccb->sec_mask,
+                        BTM_SetSecurityLevel(true, "", BTM_SEC_SERVICE_MCAP_DATA, p_ccb->sec_mask,
                             p_ccb->data_vpsm, BTM_SEC_PROTO_MCA, p_ccb->p_tx_req->dcb_idx);
                         p_dcb->lcid = mca_l2c_open_req(p_ccb->peer_addr, p_ccb->data_vpsm, p_dcb->p_chnl_cfg);
                         if (p_dcb->lcid)
@@ -553,7 +553,7 @@
 void mca_ccb_ll_open (tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data)
 {
     tMCA_CTRL    evt_data;
-    p_ccb->cong  = FALSE;
+    p_ccb->cong  = false;
     evt_data.connect_ind.mtu = p_data->open.peer_mtu;
     memcpy (evt_data.connect_ind.bd_addr, p_ccb->peer_addr, BD_ADDR_LEN);
     mca_ccb_report_event (p_ccb, MCA_CONNECT_IND_EVT, &evt_data);
diff --git a/stack/mcap/mca_csm.c b/stack/mcap/mca_csm.c
index 1ded765..c95b8e8 100644
--- a/stack/mcap/mca_csm.c
+++ b/stack/mcap/mca_csm.c
@@ -72,7 +72,7 @@
 #define MCA_CCB_NUM_COLS           2       /* number of columns in state tables */
 
 /* state table for opening state */
-const UINT8 mca_ccb_st_opening[][MCA_CCB_NUM_COLS] = {
+const uint8_t mca_ccb_st_opening[][MCA_CCB_NUM_COLS] = {
 /* Event                            Action              Next State */
 /* MCA_CCB_API_CONNECT_EVT    */   {MCA_CCB_IGNORE,     MCA_CCB_OPENING_ST},
 /* MCA_CCB_API_DISCONNECT_EVT */   {MCA_CCB_DO_DISCONN, MCA_CCB_CLOSING_ST},
@@ -88,7 +88,7 @@
 };
 
 /* state table for open state */
-const UINT8 mca_ccb_st_open[][MCA_CCB_NUM_COLS] = {
+const uint8_t mca_ccb_st_open[][MCA_CCB_NUM_COLS] = {
 /* Event                            Action              Next State */
 /* MCA_CCB_API_CONNECT_EVT    */   {MCA_CCB_IGNORE,     MCA_CCB_OPEN_ST},
 /* MCA_CCB_API_DISCONNECT_EVT */   {MCA_CCB_DO_DISCONN, MCA_CCB_CLOSING_ST},
@@ -104,7 +104,7 @@
 };
 
 /* state table for closing state */
-const UINT8 mca_ccb_st_closing[][MCA_CCB_NUM_COLS] = {
+const uint8_t mca_ccb_st_closing[][MCA_CCB_NUM_COLS] = {
 /* Event                            Action              Next State */
 /* MCA_CCB_API_CONNECT_EVT    */   {MCA_CCB_IGNORE,     MCA_CCB_CLOSING_ST},
 /* MCA_CCB_API_DISCONNECT_EVT */   {MCA_CCB_IGNORE,     MCA_CCB_CLOSING_ST},
@@ -120,7 +120,7 @@
 };
 
 /* type for state table */
-typedef const UINT8 (*tMCA_CCB_ST_TBL)[MCA_CCB_NUM_COLS];
+typedef const uint8_t (*tMCA_CCB_ST_TBL)[MCA_CCB_NUM_COLS];
 
 /* state table */
 const tMCA_CCB_ST_TBL mca_ccb_st_tbl[] = {
@@ -180,10 +180,10 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void mca_ccb_event(tMCA_CCB *p_ccb, UINT8 event, tMCA_CCB_EVT *p_data)
+void mca_ccb_event(tMCA_CCB *p_ccb, uint8_t event, tMCA_CCB_EVT *p_data)
 {
     tMCA_CCB_ST_TBL    state_table;
-    UINT8              action;
+    uint8_t            action;
 
 #if (BT_TRACE_VERBOSE == TRUE)
     MCA_TRACE_EVENT("CCB ccb=%d event=%s state=%s", mca_ccb_to_hdl(p_ccb), mca_ccb_evt_str[event], mca_ccb_st_str[p_ccb->state]);
@@ -268,7 +268,7 @@
                 p_ccb_tmp->p_rcb = p_rcb;
                 p_ccb_tmp->mca_ccb_timer = alarm_new("mca.mca_ccb_timer");
                 p_ccb_tmp->state = MCA_CCB_OPENING_ST;
-                p_ccb_tmp->cong  = TRUE;
+                p_ccb_tmp->cong  = true;
                 memcpy(p_ccb_tmp->peer_addr, bd_addr, BD_ADDR_LEN);
                 p_ccb = p_ccb_tmp;
                 break;
@@ -330,7 +330,7 @@
 *******************************************************************************/
 tMCA_CL mca_ccb_to_hdl(tMCA_CCB *p_ccb)
 {
-    return (UINT8) (p_ccb - mca_cb.ccb + 1);
+    return (uint8_t) (p_ccb - mca_cb.ccb + 1);
 }
 
 /*******************************************************************************
@@ -359,12 +359,12 @@
 **
 ** Description      This function checkes if a given mdl_id is in use.
 **
-** Returns          TRUE, if the given mdl_id is currently used in the MCL.
+** Returns          true, if the given mdl_id is currently used in the MCL.
 **
 *******************************************************************************/
-BOOLEAN mca_ccb_uses_mdl_id(tMCA_CCB *p_ccb, UINT16 mdl_id)
+bool    mca_ccb_uses_mdl_id(tMCA_CCB *p_ccb, uint16_t mdl_id)
 {
-    BOOLEAN uses = FALSE;
+    bool    uses = false;
     tMCA_DCB *p_dcb;
     int       i;
 
@@ -374,7 +374,7 @@
     {
         if (p_dcb->state != MCA_DCB_NULL_ST && p_dcb->mdl_id == mdl_id)
         {
-            uses = TRUE;
+            uses = true;
             break;
         }
     }
diff --git a/stack/mcap/mca_dact.c b/stack/mcap/mca_dact.c
index 63e9ad2..9895dd7 100644
--- a/stack/mcap/mca_dact.c
+++ b/stack/mcap/mca_dact.c
@@ -64,11 +64,11 @@
 {
     tMCA_CTRL   evt_data;
     tMCA_CCB    *p_ccb = p_dcb->p_ccb;
-    UINT8       event = MCA_OPEN_IND_EVT;
+    uint8_t     event = MCA_OPEN_IND_EVT;
 
     if (p_data->open.param == MCA_INT)
         event = MCA_OPEN_CFM_EVT;
-    p_dcb->cong  = FALSE;
+    p_dcb->cong  = false;
     evt_data.open_cfm.mtu       = p_data->open.peer_mtu;
     evt_data.open_cfm.mdl_id    = p_dcb->mdl_id;
     evt_data.open_cfm.mdl       = mca_dcb_to_hdl(p_dcb);
@@ -120,7 +120,7 @@
     tMCA_CLOSE  close;
     UNUSED(p_data);
 
-    if ((p_dcb->lcid == 0) || (L2CA_DisconnectReq(p_dcb->lcid) == FALSE))
+    if ((p_dcb->lcid == 0) || (L2CA_DisconnectReq(p_dcb->lcid) == false))
     {
         close.param  = MCA_INT;
         close.reason = L2CAP_DISC_OK;
@@ -140,13 +140,13 @@
 *******************************************************************************/
 void mca_dcb_snd_data (tMCA_DCB *p_dcb, tMCA_DCB_EVT *p_data)
 {
-    UINT8   status;
+    uint8_t status;
 
     /* do not need to check cong, because API already checked the status */
     status = L2CA_DataWrite (p_dcb->lcid, p_data->p_pkt);
     if (status == L2CAP_DW_CONGESTED)
     {
-        p_dcb->cong = TRUE;
+        p_dcb->cong = true;
         mca_dcb_report_cong(p_dcb);
     }
 }
diff --git a/stack/mcap/mca_dsm.c b/stack/mcap/mca_dsm.c
index c76e020..cc2aaa5 100644
--- a/stack/mcap/mca_dsm.c
+++ b/stack/mcap/mca_dsm.c
@@ -62,7 +62,7 @@
 #define MCA_DCB_NUM_COLS           2       /* number of columns in state tables */
 
 /* state table for opening state */
-const UINT8 mca_dcb_st_opening[][MCA_DCB_NUM_COLS] = {
+const uint8_t mca_dcb_st_opening[][MCA_DCB_NUM_COLS] = {
 /* Event                            Action              Next State */
 /* MCA_DCB_API_CLOSE_EVT    */   {MCA_DCB_DO_DISCONN,   MCA_DCB_CLOSING_ST},
 /* MCA_DCB_API_WRITE_EVT    */   {MCA_DCB_IGNORE,       MCA_DCB_OPENING_ST},
@@ -73,7 +73,7 @@
 };
 
 /* state table for open state */
-const UINT8 mca_dcb_st_open[][MCA_DCB_NUM_COLS] = {
+const uint8_t mca_dcb_st_open[][MCA_DCB_NUM_COLS] = {
 /* Event                            Action              Next State */
 /* MCA_DCB_API_CLOSE_EVT    */   {MCA_DCB_DO_DISCONN,   MCA_DCB_CLOSING_ST},
 /* MCA_DCB_API_WRITE_EVT    */   {MCA_DCB_SND_DATA,     MCA_DCB_OPEN_ST},
@@ -84,7 +84,7 @@
 };
 
 /* state table for closing state */
-const UINT8 mca_dcb_st_closing[][MCA_DCB_NUM_COLS] = {
+const uint8_t mca_dcb_st_closing[][MCA_DCB_NUM_COLS] = {
 /* Event                            Action              Next State */
 /* MCA_DCB_API_CLOSE_EVT    */   {MCA_DCB_IGNORE,       MCA_DCB_CLOSING_ST},
 /* MCA_DCB_API_WRITE_EVT    */   {MCA_DCB_IGNORE,       MCA_DCB_CLOSING_ST},
@@ -95,7 +95,7 @@
 };
 
 /* type for state table */
-typedef const UINT8 (*tMCA_DCB_ST_TBL)[MCA_DCB_NUM_COLS];
+typedef const uint8_t (*tMCA_DCB_ST_TBL)[MCA_DCB_NUM_COLS];
 
 /* state table */
 const tMCA_DCB_ST_TBL mca_dcb_st_tbl[] = {
@@ -134,10 +134,10 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void mca_dcb_event(tMCA_DCB *p_dcb, UINT8 event, tMCA_DCB_EVT *p_data)
+void mca_dcb_event(tMCA_DCB *p_dcb, uint8_t event, tMCA_DCB_EVT *p_data)
 {
     tMCA_DCB_ST_TBL    state_table;
-    UINT8              action;
+    uint8_t            action;
 
     if (p_dcb == NULL)
         return;
@@ -190,7 +190,7 @@
             {
                 p_dcb_tmp->p_ccb = p_ccb;
                 p_dcb_tmp->state = MCA_DCB_OPENING_ST;
-                p_dcb_tmp->cong  = TRUE;
+                p_dcb_tmp->cong  = true;
                 p_dcb_tmp->p_cs  = p_cs;
                 p_dcb = p_dcb_tmp;
                 break;
@@ -210,14 +210,14 @@
 ** Returns          the number of free mdl for the given dep
 **
 *******************************************************************************/
-UINT8 mca_dep_free_mdl(tMCA_CCB *p_ccb, tMCA_DEP dep)
+uint8_t mca_dep_free_mdl(tMCA_CCB *p_ccb, tMCA_DEP dep)
 {
     tMCA_DCB *p_dcb;
     tMCA_RCB *p_rcb = p_ccb->p_rcb;
     tMCA_CS  *p_cs;
     int       i, max;
-    UINT8   count = 0;
-    UINT8   left;
+    uint8_t count = 0;
+    uint8_t left;
 
     if (dep < MCA_NUM_DEPS)
     {
@@ -256,7 +256,7 @@
 void mca_dcb_dealloc(tMCA_DCB *p_dcb, tMCA_DCB_EVT *p_data)
 {
     tMCA_CCB *p_ccb = p_dcb->p_ccb;
-    UINT8    event = MCA_CLOSE_IND_EVT;
+    uint8_t  event = MCA_CLOSE_IND_EVT;
     tMCA_CTRL   evt_data;
 
     MCA_TRACE_DEBUG("mca_dcb_dealloc");
@@ -288,7 +288,7 @@
 *******************************************************************************/
 tMCA_DL mca_dcb_to_hdl(tMCA_DCB *p_dcb)
 {
-    return (UINT8) (p_dcb - mca_cb.dcb + 1);
+    return (uint8_t) (p_dcb - mca_cb.dcb + 1);
 }
 
 /*******************************************************************************
@@ -320,7 +320,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void mca_dcb_close_by_mdl_id(tMCA_CCB*p_ccb, UINT16 mdl_id)
+void mca_dcb_close_by_mdl_id(tMCA_CCB*p_ccb, uint16_t mdl_id)
 {
     tMCA_DCB *p_dcb;
     int       i;
diff --git a/stack/mcap/mca_int.h b/stack/mcap/mca_int.h
index 50a52cc..73b3d7f 100644
--- a/stack/mcap/mca_int.h
+++ b/stack/mcap/mca_int.h
@@ -46,11 +46,11 @@
 /* Header structure for api/received request/response. */
 typedef struct {
     BT_HDR          hdr;        /* layer specific information */
-    UINT8           op_code;    /* the request/response opcode */
-    UINT8           rsp_code;   /* valid only if op_code is a response */
-    UINT16          mdl_id;     /* the MDL ID associated with this request/response */
-    UINT8           param;      /* other parameter */
-    UINT8           mdep_id;    /* the MDEP ID associated with this request/response */
+    uint8_t         op_code;    /* the request/response opcode */
+    uint8_t         rsp_code;   /* valid only if op_code is a response */
+    uint16_t        mdl_id;     /* the MDL ID associated with this request/response */
+    uint8_t         param;      /* other parameter */
+    uint8_t         mdep_id;    /* the MDEP ID associated with this request/response */
     /* tMCA_HANDLE     rcb_idx;    For internal use only */
     /* tMCA_CL         ccb_idx;    For internal use only */
     tMCA_DL         dcb_idx;    /* For internal use only */
@@ -59,23 +59,23 @@
 /* This data structure is associated with the AVDT_OPEN_IND_EVT and AVDT_OPEN_CFM_EVT. */
 typedef struct {
     BT_HDR          hdr;                /* Event header */
-    UINT16          peer_mtu;           /* Transport channel L2CAP MTU of the peer */
-    UINT16          lcid;               /* L2CAP LCID  */
-    UINT8           param;
+    uint16_t        peer_mtu;           /* Transport channel L2CAP MTU of the peer */
+    uint16_t        lcid;               /* L2CAP LCID  */
+    uint8_t         param;
 } tMCA_OPEN;
 
 typedef struct {
-    UINT16          reason;     /* disconnect reason from L2CAP */
-    UINT8           param;      /* MCA_INT or MCA_ACP */
-    UINT16          lcid;       /* L2CAP LCID  */
+    uint16_t        reason;     /* disconnect reason from L2CAP */
+    uint8_t         param;      /* MCA_INT or MCA_ACP */
+    uint16_t        lcid;       /* L2CAP LCID  */
 } tMCA_CLOSE;
 
 /* Header structure for state machine event parameters. */
 typedef union {
     BT_HDR          hdr;        /* layer specific information */
     tMCA_CCB_MSG    api;
-    BOOLEAN         llcong;
-    UINT8           param;
+    bool            llcong;
+    uint8_t         param;
     tMCA_OPEN       open;
     tMCA_CLOSE      close;
 } tMCA_CCB_EVT;
@@ -89,7 +89,7 @@
     MCA_CCB_CLOSING_ST,		/* disconnecting */
     MCA_CCB_MAX_ST
 };
-typedef UINT8 tMCA_CCB_STATE;
+typedef uint8_t tMCA_CCB_STATE;
 
 /* control channel events */
 enum
@@ -113,8 +113,8 @@
     tMCA_CLOSE      close;
     BT_HDR          hdr;        /* layer specific information */
     BT_HDR          *p_pkt;
-    BOOLEAN         llcong;
-    UINT16          mdl_id;     /* the MDL ID associated with this request/response */
+    bool            llcong;
+    uint16_t        mdl_id;     /* the MDL ID associated with this request/response */
     /* tMCA_HANDLE     rcb_idx;    For internal use only */
     /* tMCA_CL         ccb_idx;    For internal use only */
     /* tMCA_DL         dcb_idx;    For internal use only */
@@ -129,7 +129,7 @@
     MCA_DCB_CLOSING_ST,     /* disconnecting */
     MCA_DCB_MAX_ST
 };
-typedef UINT8 tMCA_DCB_STATE;
+typedef uint8_t tMCA_DCB_STATE;
 
 /* data channel events */
 enum
@@ -169,20 +169,20 @@
 
 /* transport channel table */
 typedef struct {
-    UINT16  peer_mtu;       /* L2CAP mtu of the peer device */
-    UINT16  my_mtu;         /* Our MTU for this channel */
-    UINT16  lcid;           /* L2CAP LCID */
-    UINT8   tcid;           /* transport channel id (0, for control channel. (MDEP ID + 1) for data channel) */
+    uint16_t peer_mtu;       /* L2CAP mtu of the peer device */
+    uint16_t my_mtu;         /* Our MTU for this channel */
+    uint16_t lcid;           /* L2CAP LCID */
+    uint8_t tcid;           /* transport channel id (0, for control channel. (MDEP ID + 1) for data channel) */
     tMCA_DL cb_idx;         /* 1-based index to ccb or dcb */
-    UINT8   state;          /* transport channel state */
-    UINT8   cfg_flags;      /* L2CAP configuration flags */
-    UINT8   id;             /* L2CAP id sent by peer device (need this to handle security pending) */
+    uint8_t state;          /* transport channel state */
+    uint8_t cfg_flags;      /* L2CAP configuration flags */
+    uint8_t id;             /* L2CAP id sent by peer device (need this to handle security pending) */
 } tMCA_TC_TBL;
 
 /* transport control block */
 typedef struct {
     tMCA_TC_TBL     tc_tbl[MCA_NUM_TC_TBL];
-    UINT8           lcid_tbl[MAX_L2CAP_CHANNELS];   /* map LCID to tc_tbl index */
+    uint8_t         lcid_tbl[MAX_L2CAP_CHANNELS];   /* map LCID to tc_tbl index */
 } tMCA_TC;
 
 /* registration control block */
@@ -199,7 +199,7 @@
     MCA_CCB_STAT_RECONN,    /* reinitiate connection after transitioning from CLOSING to IDLE state  */
     MCA_CCB_STAT_DISC       /* MCA_DisconnectReq or MCA_Deregister is called. waiting for all associated CL and DL to detach */
 };
-typedef UINT8 tMCA_CCB_STAT;
+typedef uint8_t tMCA_CCB_STAT;
 
 /* control channel control block */
 /* the ccbs association with the rcbs
@@ -213,12 +213,12 @@
     tMCA_CCB_MSG    *p_tx_req;          /* Current request being sent/awaiting response */
     tMCA_CCB_MSG    *p_rx_msg;          /* Current message received/being processed */
     BD_ADDR         peer_addr;          /* BD address of peer */
-    UINT16          sec_mask;           /* Security mask for connections as initiator */
-    UINT16          ctrl_vpsm;          /* The virtual PSM that peer is listening for control channel */
-    UINT16          data_vpsm;          /* The virtual PSM that peer is listening for data channel. */
-    UINT16          lcid;               /* L2CAP lcid for this control channel */
-    UINT8           state;              /* The CCB state machine state */
-    BOOLEAN         cong;               /* Whether control channel is congested */
+    uint16_t        sec_mask;           /* Security mask for connections as initiator */
+    uint16_t        ctrl_vpsm;          /* The virtual PSM that peer is listening for control channel */
+    uint16_t        data_vpsm;          /* The virtual PSM that peer is listening for data channel. */
+    uint16_t        lcid;               /* L2CAP lcid for this control channel */
+    uint8_t         state;              /* The CCB state machine state */
+    bool            cong;               /* Whether control channel is congested */
     tMCA_CCB_STAT   status;             /* see tMCA_CCB_STAT */
 } tMCA_CCB;
 typedef void (*tMCA_CCB_ACTION)(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data);
@@ -229,7 +229,7 @@
     MCA_DCB_STAT_DEL,       /* MCA_Delete is called. waiting for the DL to detach */
     MCA_DCB_STAT_DISC       /* MCA_CloseReq is called. waiting for the DL to detach */
 };
-typedef UINT8 tMCA_DCB_STAT;
+typedef uint8_t tMCA_DCB_STAT;
 
 /* data channel control block */
 /* the dcbs association with the ccbs
@@ -247,10 +247,10 @@
     BT_HDR              *p_data;        /* data packet held due to L2CAP channel congestion */
     tMCA_CS             *p_cs;          /* the associated MDEP info. p_cs->type is the mdep id(internal use) */
     const tMCA_CHNL_CFG *p_chnl_cfg;    /* cfg params for L2CAP channel */
-    UINT16              mdl_id;         /* the MDL ID for this data channel */
-    UINT16              lcid;           /* L2CAP lcid */
-    UINT8               state;          /* The DCB state machine state */
-    BOOLEAN             cong;           /* Whether data channel is congested */
+    uint16_t            mdl_id;         /* the MDL ID for this data channel */
+    uint16_t            lcid;           /* L2CAP lcid */
+    uint8_t             state;          /* The DCB state machine state */
+    bool                cong;           /* Whether data channel is congested */
     tMCA_DCB_STAT       status;         /* see tMCA_DCB_STAT */
 } tMCA_DCB;
 
@@ -262,21 +262,21 @@
     tMCA_CCB        ccb[MCA_NUM_CCBS];  /* control channel control blocks */
     tMCA_DCB        dcb[MCA_NUM_DCBS];  /* data channel control blocks */
     tMCA_TC         tc;                 /* transport control block */
-    UINT8           trace_level;        /* trace level */
+    uint8_t         trace_level;        /* trace level */
 } tMCA_CB;
 
 /* csm functions */
-extern void mca_ccb_event(tMCA_CCB *p_ccb, UINT8 event, tMCA_CCB_EVT *p_data);
+extern void mca_ccb_event(tMCA_CCB *p_ccb, uint8_t event, tMCA_CCB_EVT *p_data);
 extern tMCA_CCB *mca_ccb_by_bd(tMCA_HANDLE handle, BD_ADDR bd_addr);
 extern tMCA_CCB *mca_ccb_alloc(tMCA_HANDLE handle, BD_ADDR bd_addr);
 extern void mca_ccb_rsp_tout(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data);
 extern void mca_ccb_dealloc(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data);
 extern tMCA_CL mca_ccb_to_hdl(tMCA_CCB *p_ccb);
 extern tMCA_CCB *mca_ccb_by_hdl(tMCA_CL mcl);
-extern BOOLEAN mca_ccb_uses_mdl_id(tMCA_CCB *p_ccb, UINT16 mdl_id);
+extern bool    mca_ccb_uses_mdl_id(tMCA_CCB *p_ccb, uint16_t mdl_id);
 
 /* cact functions */
-extern void mca_ccb_report_event(tMCA_CCB *p_ccb, UINT8 event, tMCA_CTRL *p_data);
+extern void mca_ccb_report_event(tMCA_CCB *p_ccb, uint8_t event, tMCA_CTRL *p_data);
 extern void mca_ccb_free_msg(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data);
 extern void mca_ccb_snd_req(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data);
 extern void mca_ccb_snd_rsp(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data);
@@ -288,13 +288,13 @@
 extern void mca_ccb_dl_open (tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data);
 
 /* dsm functions */
-extern void mca_dcb_event(tMCA_DCB *p_dcb, UINT8 event, tMCA_DCB_EVT *p_data);
+extern void mca_dcb_event(tMCA_DCB *p_dcb, uint8_t event, tMCA_DCB_EVT *p_data);
 extern tMCA_DCB *mca_dcb_alloc(tMCA_CCB*p_ccb, tMCA_DEP dep);
-extern UINT8 mca_dep_free_mdl(tMCA_CCB*p_ccb, tMCA_DEP dep);
+extern uint8_t mca_dep_free_mdl(tMCA_CCB*p_ccb, tMCA_DEP dep);
 extern void mca_dcb_dealloc(tMCA_DCB *p_dcb, tMCA_DCB_EVT *p_data);
 extern tMCA_DL mca_dcb_to_hdl(tMCA_DCB *p_dcb);
 extern tMCA_DCB *mca_dcb_by_hdl(tMCA_DL hdl);
-extern void mca_dcb_close_by_mdl_id(tMCA_CCB*p_ccb, UINT16 mdl_id);
+extern void mca_dcb_close_by_mdl_id(tMCA_CCB*p_ccb, uint16_t mdl_id);
 
 /* dact functions */
 extern void mca_dcb_tc_open (tMCA_DCB *p_dcb, tMCA_DCB_EVT *p_data);
@@ -306,38 +306,38 @@
 
 
 /* main/utils functions */
-extern tMCA_HANDLE mca_handle_by_cpsm(UINT16 psm);
-extern tMCA_HANDLE mca_handle_by_dpsm(UINT16 psm);
+extern tMCA_HANDLE mca_handle_by_cpsm(uint16_t psm);
+extern tMCA_HANDLE mca_handle_by_dpsm(uint16_t psm);
 extern tMCA_TC_TBL * mca_tc_tbl_calloc(tMCA_CCB *p_ccb);
 extern tMCA_TC_TBL * mca_tc_tbl_dalloc(tMCA_DCB *p_dcb);
-extern tMCA_TC_TBL * mca_tc_tbl_by_lcid(UINT16 lcid);
-extern void mca_free_tc_tbl_by_lcid(UINT16 lcid);
+extern tMCA_TC_TBL * mca_tc_tbl_by_lcid(uint16_t lcid);
+extern void mca_free_tc_tbl_by_lcid(uint16_t lcid);
 extern void mca_set_cfg_by_tbl(tL2CAP_CFG_INFO *p_cfg, tMCA_TC_TBL *p_tbl);
-extern void mca_tc_close_ind(tMCA_TC_TBL *p_tbl, UINT16 reason);
+extern void mca_tc_close_ind(tMCA_TC_TBL *p_tbl, uint16_t reason);
 extern void mca_tc_open_ind(tMCA_TC_TBL *p_tbl);
-extern void mca_tc_cong_ind(tMCA_TC_TBL *p_tbl, BOOLEAN is_congested);
+extern void mca_tc_cong_ind(tMCA_TC_TBL *p_tbl, bool    is_congested);
 extern void mca_tc_data_ind(tMCA_TC_TBL *p_tbl, BT_HDR *p_buf);
 extern tMCA_RCB * mca_rcb_alloc(tMCA_REG *p_reg);
 extern void mca_rcb_dealloc(tMCA_HANDLE handle);
 extern tMCA_HANDLE mca_rcb_to_handle(tMCA_RCB *p_rcb);
 extern tMCA_RCB *mca_rcb_by_handle(tMCA_HANDLE handle);
-extern BOOLEAN mca_is_valid_dep_id(tMCA_RCB *p_rcb, tMCA_DEP dep);
+extern bool    mca_is_valid_dep_id(tMCA_RCB *p_rcb, tMCA_DEP dep);
 extern void mca_ccb_timer_timeout(void *data);
 extern void mca_stop_timer(tMCA_CCB *p_ccb);
 
 /* l2c functions */
-extern UINT16 mca_l2c_open_req(BD_ADDR bd_addr, UINT16 PSM, const tMCA_CHNL_CFG *p_chnl_cfg);
+extern uint16_t mca_l2c_open_req(BD_ADDR bd_addr, uint16_t PSM, const tMCA_CHNL_CFG *p_chnl_cfg);
 
 /* callback function declarations */
-extern void mca_l2c_cconn_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id);
-extern void mca_l2c_dconn_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id);
-extern void mca_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result);
-extern void mca_l2c_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg);
-extern void mca_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg);
-extern void mca_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed);
-extern void mca_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result);
-extern void mca_l2c_congestion_ind_cback(UINT16 lcid, BOOLEAN is_congested);
-extern void mca_l2c_data_ind_cback(UINT16 lcid, BT_HDR *p_buf);
+extern void mca_l2c_cconn_ind_cback(BD_ADDR bd_addr, uint16_t lcid, uint16_t psm, uint8_t id);
+extern void mca_l2c_dconn_ind_cback(BD_ADDR bd_addr, uint16_t lcid, uint16_t psm, uint8_t id);
+extern void mca_l2c_connect_cfm_cback(uint16_t lcid, uint16_t result);
+extern void mca_l2c_config_cfm_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg);
+extern void mca_l2c_config_ind_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg);
+extern void mca_l2c_disconnect_ind_cback(uint16_t lcid, bool    ack_needed);
+extern void mca_l2c_disconnect_cfm_cback(uint16_t lcid, uint16_t result);
+extern void mca_l2c_congestion_ind_cback(uint16_t lcid, bool    is_congested);
+extern void mca_l2c_data_ind_cback(uint16_t lcid, BT_HDR *p_buf);
 
 /*****************************************************************************
 ** global data
@@ -346,7 +346,7 @@
 /******************************************************************************
 ** Main Control Block
 *******************************************************************************/
-#if MCA_DYNAMIC_MEMORY == FALSE
+#if (MCA_DYNAMIC_MEMORY == FALSE)
 extern tMCA_CB  mca_cb;
 #else
 extern tMCA_CB *mca_cb_ptr;
@@ -356,7 +356,7 @@
 /* L2CAP callback registration structure */
 extern const tL2CAP_APPL_INFO mca_l2c_int_appl;
 extern const tL2CAP_FCR_OPTS mca_l2c_fcr_opts_def;
-extern const UINT8 mca_std_msg_len[];
+extern const uint8_t mca_std_msg_len[];
 
 #ifdef __cplusplus
 }
diff --git a/stack/mcap/mca_l2c.c b/stack/mcap/mca_l2c.c
index 62caf78..89e9d36 100644
--- a/stack/mcap/mca_l2c.c
+++ b/stack/mcap/mca_l2c.c
@@ -70,7 +70,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void mca_sec_check_complete_term (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, UINT8 res)
+static void mca_sec_check_complete_term (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, uint8_t res)
 {
     tMCA_TC_TBL     *p_tbl = (tMCA_TC_TBL *)p_ref_data;
     tL2CAP_CFG_INFO cfg;
@@ -117,7 +117,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void mca_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, UINT8 res)
+static void mca_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, uint8_t res)
 {
     tMCA_TC_TBL     *p_tbl = (tMCA_TC_TBL *)p_ref_data;
     tL2CAP_CFG_INFO cfg;
@@ -150,12 +150,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void mca_l2c_cconn_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
+void mca_l2c_cconn_ind_cback(BD_ADDR bd_addr, uint16_t lcid, uint16_t psm, uint8_t id)
 {
     tMCA_HANDLE handle = mca_handle_by_cpsm(psm);
     tMCA_CCB    *p_ccb;
     tMCA_TC_TBL *p_tbl = NULL;
-    UINT16      result = L2CAP_CONN_NO_RESOURCES;
+    uint16_t    result = L2CAP_CONN_NO_RESOURCES;
     tBTM_STATUS rc;
     tL2CAP_ERTM_INFO ertm_info, *p_ertm_info = NULL;
     tL2CAP_CFG_INFO  cfg;
@@ -175,7 +175,7 @@
             p_tbl->cfg_flags= MCA_L2C_CFG_CONN_ACP;
             /* proceed with connection */
             /* Check the security */
-            rc = btm_sec_mx_access_request (bd_addr, psm, FALSE, BTM_SEC_PROTO_MCA, 0,
+            rc = btm_sec_mx_access_request (bd_addr, psm, false, BTM_SEC_PROTO_MCA, 0,
                                             &mca_sec_check_complete_term, p_tbl);
             if (rc == BTM_CMD_STARTED)
             {
@@ -226,13 +226,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void mca_l2c_dconn_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
+void mca_l2c_dconn_ind_cback(BD_ADDR bd_addr, uint16_t lcid, uint16_t psm, uint8_t id)
 {
     tMCA_HANDLE handle = mca_handle_by_dpsm(psm);
     tMCA_CCB    *p_ccb;
     tMCA_DCB       *p_dcb;
     tMCA_TC_TBL    *p_tbl = NULL;
-    UINT16          result;
+    uint16_t        result;
     tL2CAP_CFG_INFO cfg;
     tL2CAP_ERTM_INFO *p_ertm_info = NULL, ertm_info;
     const tMCA_CHNL_CFG   *p_chnl_cfg;
@@ -293,7 +293,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void mca_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
+void mca_l2c_connect_cfm_cback(uint16_t lcid, uint16_t result)
 {
     tMCA_TC_TBL    *p_tbl;
     tL2CAP_CFG_INFO cfg;
@@ -336,7 +336,7 @@
 
                         /* Check the security */
                         btm_sec_mx_access_request (p_ccb->peer_addr, p_ccb->ctrl_vpsm,
-                                                   TRUE, BTM_SEC_PROTO_MCA,
+                                                   true, BTM_SEC_PROTO_MCA,
                                                    p_tbl->tcid,
                                                    &mca_sec_check_complete_orig, p_tbl);
                     }
@@ -363,7 +363,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void mca_l2c_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
+void mca_l2c_config_cfm_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg)
 {
     tMCA_TC_TBL    *p_tbl;
 
@@ -405,10 +405,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void mca_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
+void mca_l2c_config_ind_cback(uint16_t lcid, tL2CAP_CFG_INFO *p_cfg)
 {
     tMCA_TC_TBL    *p_tbl;
-    UINT16          result = L2CAP_CFG_OK;
+    uint16_t        result = L2CAP_CFG_OK;
 
     /* look up info for this channel */
     if ((p_tbl = mca_tc_tbl_by_lcid(lcid)) != NULL)
@@ -458,10 +458,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void mca_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed)
+void mca_l2c_disconnect_ind_cback(uint16_t lcid, bool    ack_needed)
 {
     tMCA_TC_TBL    *p_tbl;
-    UINT16         reason = L2CAP_DISC_TIMEOUT;
+    uint16_t       reason = L2CAP_DISC_TIMEOUT;
 
     MCA_TRACE_DEBUG("mca_l2c_disconnect_ind_cback lcid: %d, ack_needed: %d",
                      lcid, ack_needed);
@@ -491,7 +491,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void mca_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result)
+void mca_l2c_disconnect_cfm_cback(uint16_t lcid, uint16_t result)
 {
     tMCA_TC_TBL    *p_tbl;
 
@@ -516,7 +516,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void mca_l2c_congestion_ind_cback(UINT16 lcid, BOOLEAN is_congested)
+void mca_l2c_congestion_ind_cback(uint16_t lcid, bool    is_congested)
 {
     tMCA_TC_TBL    *p_tbl;
 
@@ -537,7 +537,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void mca_l2c_data_ind_cback(UINT16 lcid, BT_HDR *p_buf)
+void mca_l2c_data_ind_cback(uint16_t lcid, BT_HDR *p_buf)
 {
     tMCA_TC_TBL    *p_tbl;
 
@@ -560,7 +560,7 @@
 ** Returns          void.
 **
 *******************************************************************************/
-UINT16 mca_l2c_open_req(BD_ADDR bd_addr, UINT16 psm, const tMCA_CHNL_CFG *p_chnl_cfg)
+uint16_t mca_l2c_open_req(BD_ADDR bd_addr, uint16_t psm, const tMCA_CHNL_CFG *p_chnl_cfg)
 {
     tL2CAP_ERTM_INFO ertm_info;
 
diff --git a/stack/mcap/mca_main.c b/stack/mcap/mca_main.c
index d1591b3..49f1b74 100644
--- a/stack/mcap/mca_main.c
+++ b/stack/mcap/mca_main.c
@@ -33,7 +33,7 @@
 #include "l2c_api.h"
 
 /* Main Control block for MCA */
-#if MCA_DYNAMIC_MEMORY == FALSE
+#if (MCA_DYNAMIC_MEMORY == FALSE)
 tMCA_CB mca_cb;
 #endif
 
@@ -42,7 +42,7 @@
 *****************************************************************************/
 
 /* table of standard opcode message size */
-const UINT8 mca_std_msg_len[MCA_NUM_STANDARD_OPCODE] = {
+const uint8_t mca_std_msg_len[MCA_NUM_STANDARD_OPCODE] = {
     4,          /* MCA_OP_ERROR_RSP         */
     5,          /* MCA_OP_MDL_CREATE_REQ    */
     5,          /* MCA_OP_MDL_CREATE_RSP    */
@@ -65,7 +65,7 @@
 ** Returns          the MCA handle.
 **
 *******************************************************************************/
-tMCA_HANDLE mca_handle_by_cpsm(UINT16 psm)
+tMCA_HANDLE mca_handle_by_cpsm(uint16_t psm)
 {
     int     i;
     tMCA_HANDLE handle = 0;
@@ -92,7 +92,7 @@
 ** Returns          the MCA handle.
 **
 *******************************************************************************/
-tMCA_HANDLE mca_handle_by_dpsm(UINT16 psm)
+tMCA_HANDLE mca_handle_by_dpsm(uint16_t psm)
 {
     int     i;
     tMCA_HANDLE handle = 0;
@@ -201,9 +201,9 @@
 ** Returns          The tranport table.
 **
 *******************************************************************************/
-tMCA_TC_TBL *mca_tc_tbl_by_lcid(UINT16 lcid)
+tMCA_TC_TBL *mca_tc_tbl_by_lcid(uint16_t lcid)
 {
-    UINT8 idx;
+    uint8_t idx;
 
     if (lcid)
     {
@@ -227,9 +227,9 @@
 ** Returns          void.
 **
 *******************************************************************************/
-void mca_free_tc_tbl_by_lcid(UINT16 lcid)
+void mca_free_tc_tbl_by_lcid(uint16_t lcid)
 {
-    UINT8 idx;
+    uint8_t idx;
 
     if (lcid)
     {
@@ -272,13 +272,13 @@
         }
     }
     memset(p_cfg, 0, sizeof(tL2CAP_CFG_INFO));
-    p_cfg->mtu_present = TRUE;
+    p_cfg->mtu_present = true;
     p_cfg->mtu = p_tbl->my_mtu;
-    p_cfg->fcr_present = TRUE;
+    p_cfg->fcr_present = true;
     memcpy(&p_cfg->fcr, p_opt, sizeof (tL2CAP_FCR_OPTS));
     if (fcs & MCA_FCS_PRESNT_MASK)
     {
-        p_cfg->fcs_present = TRUE;
+        p_cfg->fcs_present = true;
         p_cfg->fcs = (fcs & MCA_FCS_USE_MASK);
     }
 }
@@ -296,7 +296,7 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void mca_tc_close_ind(tMCA_TC_TBL *p_tbl, UINT16 reason)
+void mca_tc_close_ind(tMCA_TC_TBL *p_tbl, uint16_t reason)
 {
     tMCA_CCB   *p_ccb;
     tMCA_DCB   *p_dcb;
@@ -404,7 +404,7 @@
 ** Returns          Nothing.
 **
 *******************************************************************************/
-void mca_tc_cong_ind(tMCA_TC_TBL *p_tbl, BOOLEAN is_congested)
+void mca_tc_cong_ind(tMCA_TC_TBL *p_tbl, bool    is_congested)
 {
     tMCA_CCB   *p_ccb;
     tMCA_DCB   *p_dcb;
@@ -445,9 +445,9 @@
 {
     tMCA_CCB   *p_ccb;
     tMCA_DCB   *p_dcb;
-    UINT8       event = MCA_CCB_MSG_RSP_EVT;
-    UINT8       *p;
-    UINT8       rej_rsp_code = MCA_RSP_SUCCESS;
+    uint8_t     event = MCA_CCB_MSG_RSP_EVT;
+    uint8_t     *p;
+    uint8_t     rej_rsp_code = MCA_RSP_SUCCESS;
 
     MCA_TRACE_DEBUG("%s() - tcid: %d, cb_idx: %d", __func__, p_tbl->tcid, p_tbl->cb_idx);
 
@@ -457,7 +457,7 @@
         p_ccb = mca_ccb_by_hdl((tMCA_CL)p_tbl->cb_idx);
         if (p_ccb)
         {
-            p = (UINT8*)(p_buf+1) + p_buf->offset;
+            p = (uint8_t*)(p_buf+1) + p_buf->offset;
             /* all the request opcode has bit 0 set. response code has bit 0 clear */
             if ((*p) & 0x01)
                 event = MCA_CCB_MSG_REQ_EVT;
@@ -544,7 +544,7 @@
 void mca_rcb_dealloc(tMCA_HANDLE handle)
 {
     int      i;
-    BOOLEAN  done = TRUE;
+    bool     done = true;
     tMCA_RCB *p_rcb;
     tMCA_CCB *p_ccb;
 
@@ -560,7 +560,7 @@
             {
                 if (p_ccb->p_rcb)
                 {
-                    done = FALSE;
+                    done = false;
                     mca_ccb_event (p_ccb, MCA_CCB_API_DISCONNECT_EVT, NULL);
                 }
             }
@@ -586,7 +586,7 @@
 *******************************************************************************/
 tMCA_HANDLE mca_rcb_to_handle(tMCA_RCB *p_rcb)
 {
-    return(UINT8) (p_rcb - mca_cb.rcb + 1);
+    return(uint8_t) (p_rcb - mca_cb.rcb + 1);
 }
 
 /*******************************************************************************
@@ -617,15 +617,15 @@
 **
 ** Description      This function checks if the given dep_id is valid.
 **
-** Returns          TRUE, if this is a valid local dep_id
+** Returns          true, if this is a valid local dep_id
 **
 *******************************************************************************/
-BOOLEAN mca_is_valid_dep_id(tMCA_RCB *p_rcb, tMCA_DEP dep)
+bool    mca_is_valid_dep_id(tMCA_RCB *p_rcb, tMCA_DEP dep)
 {
-    BOOLEAN valid = FALSE;
+    bool    valid = false;
     if (dep < MCA_NUM_DEPS && p_rcb->dep[dep].p_data_cback)
     {
-        valid = TRUE;
+        valid = true;
     }
     return valid;
 }
diff --git a/stack/pan/pan_api.c b/stack/pan/pan_api.c
index eb41159..1a4f740 100644
--- a/stack/pan/pan_api.c
+++ b/stack/pan/pan_api.c
@@ -120,7 +120,7 @@
 **                                      PAN_ROLE_GN_SERVER is for GN role
 **                                      PAN_ROLE_NAP_SERVER is for NAP role
 **                  sec_mask    - Security mask for different roles
-**                                      It is array of UINT8. The byte represent the
+**                                      It is array of uint8_t. The byte represent the
 **                                      security for roles PANU, GN and NAP in order
 **                  p_user_name - Service name for PANU role
 **                  p_gn_name   - Service name for GN role
@@ -131,17 +131,17 @@
 **                  PAN_FAILURE     - if the role is not valid
 **
 *******************************************************************************/
-tPAN_RESULT PAN_SetRole (UINT8 role,
-                         UINT8 *sec_mask,
+tPAN_RESULT PAN_SetRole (uint8_t role,
+                         uint8_t *sec_mask,
                          char *p_user_name,
                          char *p_gn_name,
                          char *p_nap_name)
 {
     char                *p_desc;
-    UINT8               security[3] = {PAN_PANU_SECURITY_LEVEL,
+    uint8_t             security[3] = {PAN_PANU_SECURITY_LEVEL,
                                        PAN_GN_SECURITY_LEVEL,
                                        PAN_NAP_SECURITY_LEVEL};
-    UINT8               *p_sec;
+    uint8_t             *p_sec;
 
     /* If the role is not a valid combination reject it */
     if ((!(role & (PAN_ROLE_CLIENT | PAN_ROLE_GN_SERVER | PAN_ROLE_NAP_SERVER))) &&
@@ -165,7 +165,7 @@
 
     /* Register all the roles with SDP */
     PAN_TRACE_API ("PAN_SetRole() called with role 0x%x", role);
-#if (defined (PAN_SUPPORTS_ROLE_NAP) && PAN_SUPPORTS_ROLE_NAP == TRUE)
+#if (PAN_SUPPORTS_ROLE_NAP == TRUE)
     if (role & PAN_ROLE_NAP_SERVER)
     {
         /* Check the service name */
@@ -193,7 +193,7 @@
     }
 #endif
 
-#if (defined (PAN_SUPPORTS_ROLE_GN) && PAN_SUPPORTS_ROLE_GN == TRUE)
+#if (PAN_SUPPORTS_ROLE_GN == TRUE)
     if (role & PAN_ROLE_GN_SERVER)
     {
         /* Check the service name */
@@ -221,7 +221,7 @@
     }
 #endif
 
-#if (defined (PAN_SUPPORTS_ROLE_PANU) && PAN_SUPPORTS_ROLE_PANU == TRUE)
+#if (PAN_SUPPORTS_ROLE_PANU == TRUE)
     if (role & PAN_ROLE_CLIENT)
     {
         /* Check the service name */
@@ -282,12 +282,12 @@
 **                                           allowed at that point of time
 **
 *******************************************************************************/
-tPAN_RESULT PAN_Connect (BD_ADDR rem_bda, UINT8 src_role, UINT8 dst_role, UINT16 *handle)
+tPAN_RESULT PAN_Connect (BD_ADDR rem_bda, uint8_t src_role, uint8_t dst_role, uint16_t *handle)
 {
     tPAN_CONN       *pcb;
     tBNEP_RESULT    result;
     tBT_UUID        src_uuid, dst_uuid;
-    UINT32 mx_chan_id;
+    uint32_t mx_chan_id;
 
     /*
     ** Initialize the handle so that in case of failure return values
@@ -434,7 +434,7 @@
 **                                           there is an error in disconnecting
 **
 *******************************************************************************/
-tPAN_RESULT PAN_Disconnect (UINT16 handle)
+tPAN_RESULT PAN_Disconnect (uint16_t handle)
 {
     tPAN_CONN       *pcb;
     tBNEP_RESULT    result;
@@ -452,7 +452,7 @@
         pan_cb.num_conns--;
 
     if (pan_cb.pan_bridge_req_cb && pcb->src_uuid == UUID_SERVCLASS_NAP)
-        (*pan_cb.pan_bridge_req_cb) (pcb->rem_bda, FALSE);
+        (*pan_cb.pan_bridge_req_cb) (pcb->rem_bda, false);
 
     pan_release_pcb (pcb);
 
@@ -489,7 +489,7 @@
 **                                           there is an error in sending data
 **
 *******************************************************************************/
-tPAN_RESULT PAN_Write(UINT16 handle, BD_ADDR dst, BD_ADDR src, UINT16 protocol, UINT8 *p_data, UINT16 len, BOOLEAN ext)
+tPAN_RESULT PAN_Write(uint16_t handle, BD_ADDR dst, BD_ADDR src, uint16_t protocol, uint8_t *p_data, uint16_t len, bool    ext)
 {
     if (pan_cb.role == PAN_ROLE_INACTIVE || !pan_cb.num_conns) {
         PAN_TRACE_ERROR("%s PAN is not active, data write failed.", __func__);
@@ -512,7 +512,7 @@
     BT_HDR *buffer = (BT_HDR *)osi_malloc(PAN_BUF_SIZE);
     buffer->len = len;
     buffer->offset = PAN_MINIMUM_OFFSET;
-    memcpy((UINT8 *)buffer + sizeof(BT_HDR) + buffer->offset, p_data, buffer->len);
+    memcpy((uint8_t *)buffer + sizeof(BT_HDR) + buffer->offset, p_data, buffer->len);
 
     return PAN_WriteBuf(handle, dst, src, protocol, buffer, ext);
 }
@@ -541,10 +541,10 @@
 **                                           there is an error in sending data
 **
 *******************************************************************************/
-tPAN_RESULT PAN_WriteBuf (UINT16 handle, BD_ADDR dst, BD_ADDR src, UINT16 protocol, BT_HDR *p_buf, BOOLEAN ext)
+tPAN_RESULT PAN_WriteBuf (uint16_t handle, BD_ADDR dst, BD_ADDR src, uint16_t protocol, BT_HDR *p_buf, bool    ext)
 {
     tPAN_CONN       *pcb;
-    UINT16          i;
+    uint16_t        i;
     tBNEP_RESULT    result;
 
     if (pan_cb.role == PAN_ROLE_INACTIVE || (!(pan_cb.num_conns)))
@@ -557,7 +557,7 @@
     /* Check if it is broadcast or multicast packet */
     if (dst[0] & 0x01)
     {
-        UINT8 *data = (UINT8 *)p_buf + sizeof(BT_HDR) + p_buf->offset;
+        uint8_t *data = (uint8_t *)p_buf + sizeof(BT_HDR) + p_buf->offset;
         for (i = 0; i < MAX_PAN_CONNS; ++i) {
             if (pan_cb.pcb[i].con_state == PAN_STATE_CONNECTED)
                 BNEP_Write(pan_cb.pcb[i].handle, dst, data, p_buf->len, protocol, src, ext);
@@ -649,10 +649,10 @@
 **                  PAN_FAILURE        if connection not found or error in setting
 **
 *******************************************************************************/
-tPAN_RESULT PAN_SetProtocolFilters (UINT16 handle,
-                                    UINT16 num_filters,
-                                    UINT16 *p_start_array,
-                                    UINT16 *p_end_array)
+tPAN_RESULT PAN_SetProtocolFilters (uint16_t handle,
+                                    uint16_t num_filters,
+                                    uint16_t *p_start_array,
+                                    uint16_t *p_end_array)
 {
     tPAN_CONN       *pcb;
     tPAN_RESULT     result;
@@ -694,10 +694,10 @@
 **                  PAN_FAILURE        if connection not found or error in setting
 **
 *******************************************************************************/
-tBNEP_RESULT PAN_SetMulticastFilters (UINT16 handle,
-                                      UINT16 num_mcast_filters,
-                                      UINT8 *p_start_array,
-                                      UINT8 *p_end_array)
+tBNEP_RESULT PAN_SetMulticastFilters (uint16_t handle,
+                                      uint16_t num_mcast_filters,
+                                      uint8_t *p_start_array,
+                                      uint8_t *p_end_array)
 {
     tPAN_CONN       *pcb;
     tPAN_RESULT     result;
@@ -733,7 +733,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-UINT8 PAN_SetTraceLevel (UINT8 new_level)
+uint8_t PAN_SetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         pan_cb.trace_level = new_level;
diff --git a/stack/pan/pan_int.h b/stack/pan/pan_int.h
index dcaa6e1..952ae27 100644
--- a/stack/pan/pan_int.h
+++ b/stack/pan/pan_int.h
@@ -50,21 +50,21 @@
 #define PAN_STATE_IDLE              0
 #define PAN_STATE_CONN_START        1
 #define PAN_STATE_CONNECTED         2
-    UINT8             con_state;
+    uint8_t           con_state;
 
 #define PAN_FLAGS_CONN_COMPLETED    0x01
-    UINT8             con_flags;
+    uint8_t           con_flags;
 
-    UINT16            handle;
+    uint16_t          handle;
     BD_ADDR           rem_bda;
 
-    UINT16            bad_pkts_rcvd;
-    UINT16            src_uuid;
-    UINT16            dst_uuid;
-    UINT16            prv_src_uuid;
-    UINT16            prv_dst_uuid;
-    UINT16            ip_addr_known;
-    UINT32            ip_addr;
+    uint16_t          bad_pkts_rcvd;
+    uint16_t          src_uuid;
+    uint16_t          dst_uuid;
+    uint16_t          prv_src_uuid;
+    uint16_t          prv_dst_uuid;
+    uint16_t          ip_addr_known;
+    uint32_t          ip_addr;
 
 } tPAN_CONN;
 
@@ -73,9 +73,9 @@
 */
 typedef struct
 {
-    UINT8                       role;
-    UINT8                       active_role;
-    UINT8                       prv_active_role;
+    uint8_t                     role;
+    uint8_t                     active_role;
+    uint8_t                     prv_active_role;
     tPAN_CONN                   pcb[MAX_PAN_CONNS];
 
     tPAN_CONN_STATE_CB          *pan_conn_state_cb;     /* Connection state callback */
@@ -89,16 +89,16 @@
     char                        *user_service_name;
     char                        *gn_service_name;
     char                        *nap_service_name;
-    UINT32                      pan_user_sdp_handle;
-    UINT32                      pan_gn_sdp_handle;
-    UINT32                      pan_nap_sdp_handle;
-    UINT8                       num_conns;
-    UINT8                       trace_level;
+    uint32_t                    pan_user_sdp_handle;
+    uint32_t                    pan_gn_sdp_handle;
+    uint32_t                    pan_nap_sdp_handle;
+    uint8_t                     num_conns;
+    uint8_t                     trace_level;
 } tPAN_CB;
 
 /* Global PAN data
 */
-#if PAN_DYNAMIC_MEMORY == FALSE
+#if (PAN_DYNAMIC_MEMORY == FALSE)
 extern tPAN_CB  pan_cb;
 #else
 extern tPAN_CB  *pan_cb_ptr;
@@ -107,40 +107,40 @@
 
 /*******************************************************************************/
 extern void pan_register_with_bnep (void);
-extern void pan_conn_ind_cb (UINT16 handle,
+extern void pan_conn_ind_cb (uint16_t handle,
                              BD_ADDR p_bda,
                              tBT_UUID *remote_uuid,
                              tBT_UUID *local_uuid,
-                             BOOLEAN is_role_change);
-extern void pan_connect_state_cb (UINT16 handle, BD_ADDR rem_bda, tBNEP_RESULT result, BOOLEAN is_role_change);
-extern void pan_data_ind_cb (UINT16 handle,
-                             UINT8 *src,
-                             UINT8 *dst,
-                             UINT16 protocol,
-                             UINT8 *p_data,
-                             UINT16 len,
-                             BOOLEAN fw_ext_present);
-extern void pan_data_buf_ind_cb (UINT16 handle,
-                                 UINT8 *src,
-                                 UINT8 *dst,
-                                 UINT16 protocol,
+                             bool    is_role_change);
+extern void pan_connect_state_cb (uint16_t handle, BD_ADDR rem_bda, tBNEP_RESULT result, bool    is_role_change);
+extern void pan_data_ind_cb (uint16_t handle,
+                             uint8_t *src,
+                             uint8_t *dst,
+                             uint16_t protocol,
+                             uint8_t *p_data,
+                             uint16_t len,
+                             bool    fw_ext_present);
+extern void pan_data_buf_ind_cb (uint16_t handle,
+                                 uint8_t *src,
+                                 uint8_t *dst,
+                                 uint16_t protocol,
                                  BT_HDR *p_buf,
-                                 BOOLEAN ext);
-extern void pan_tx_data_flow_cb (UINT16 handle,
+                                 bool    ext);
+extern void pan_tx_data_flow_cb (uint16_t handle,
                             tBNEP_RESULT  event);
-void pan_proto_filt_ind_cb (UINT16 handle,
-                            BOOLEAN indication,
+void pan_proto_filt_ind_cb (uint16_t handle,
+                            bool    indication,
                             tBNEP_RESULT result,
-                            UINT16 num_filters,
-                            UINT8 *p_filters);
-void pan_mcast_filt_ind_cb (UINT16 handle,
-                            BOOLEAN indication,
+                            uint16_t num_filters,
+                            uint8_t *p_filters);
+void pan_mcast_filt_ind_cb (uint16_t handle,
+                            bool    indication,
                             tBNEP_RESULT result,
-                            UINT16 num_filters,
-                            UINT8 *p_filters);
-extern UINT32 pan_register_with_sdp (UINT16 uuid, UINT8 sec_mask, char *p_name, char *p_desc);
-extern tPAN_CONN *pan_allocate_pcb (BD_ADDR p_bda, UINT16 handle);
-extern tPAN_CONN *pan_get_pcb_by_handle (UINT16 handle);
+                            uint16_t num_filters,
+                            uint8_t *p_filters);
+extern uint32_t pan_register_with_sdp (uint16_t uuid, uint8_t sec_mask, char *p_name, char *p_desc);
+extern tPAN_CONN *pan_allocate_pcb (BD_ADDR p_bda, uint16_t handle);
+extern tPAN_CONN *pan_get_pcb_by_handle (uint16_t handle);
 extern tPAN_CONN *pan_get_pcb_by_addr (BD_ADDR p_bda);
 extern void pan_close_all_connections (void);
 extern void pan_release_pcb (tPAN_CONN *p_pcb);
diff --git a/stack/pan/pan_main.c b/stack/pan/pan_main.c
index 5c3a367..ea5e64a 100644
--- a/stack/pan/pan_main.c
+++ b/stack/pan/pan_main.c
@@ -36,12 +36,12 @@
 #include "hcidefs.h"
 
 
-#if PAN_DYNAMIC_MEMORY == FALSE
+#if (PAN_DYNAMIC_MEMORY == FALSE)
 tPAN_CB  pan_cb;
 #endif
 
 #define UUID_CONSTANT_PART  12
-UINT8 constant_pan_uuid[UUID_CONSTANT_PART] = {0, 0, 0x10, 0, 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb};
+uint8_t constant_pan_uuid[UUID_CONSTANT_PART] = {0, 0, 0x10, 0, 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb};
 
 
 /*******************************************************************************
@@ -91,15 +91,15 @@
 ** Returns          none
 **
 *******************************************************************************/
-void pan_conn_ind_cb (UINT16 handle,
+void pan_conn_ind_cb (uint16_t handle,
                       BD_ADDR p_bda,
                       tBT_UUID *remote_uuid,
                       tBT_UUID *local_uuid,
-                      BOOLEAN is_role_change)
+                      bool    is_role_change)
 {
     tPAN_CONN       *pcb;
-    UINT8           req_role;
-    BOOLEAN         wrong_uuid;
+    uint8_t         req_role;
+    bool            wrong_uuid;
 
     /*
     ** If we are in GN or NAP role and have one or more
@@ -111,7 +111,7 @@
     ** Make bridge request to the host system if connection
     ** is for NAP
     */
-    wrong_uuid = FALSE;
+    wrong_uuid = false;
     if (remote_uuid->len == 16)
     {
         /*
@@ -119,22 +119,22 @@
         ** and last 12 bytes should match the spec defined constant value
         */
         if (memcmp (constant_pan_uuid, remote_uuid->uu.uuid128 + 4, UUID_CONSTANT_PART))
-            wrong_uuid = TRUE;
+            wrong_uuid = true;
 
         if (remote_uuid->uu.uuid128[0] || remote_uuid->uu.uuid128[1])
-            wrong_uuid = TRUE;
+            wrong_uuid = true;
 
         /* Extract the 16 bit equivalent of the UUID */
-        remote_uuid->uu.uuid16 = (UINT16)((remote_uuid->uu.uuid128[2] << 8) | remote_uuid->uu.uuid128[3]);
+        remote_uuid->uu.uuid16 = (uint16_t)((remote_uuid->uu.uuid128[2] << 8) | remote_uuid->uu.uuid128[3]);
         remote_uuid->len = 2;
     }
     if (remote_uuid->len == 4)
     {
         /* First two bytes should be zeros */
         if (remote_uuid->uu.uuid32 & 0xFFFF0000)
-            wrong_uuid = TRUE;
+            wrong_uuid = true;
 
-        remote_uuid->uu.uuid16 = (UINT16)remote_uuid->uu.uuid32;
+        remote_uuid->uu.uuid16 = (uint16_t)remote_uuid->uu.uuid32;
         remote_uuid->len = 2;
     }
 
@@ -145,7 +145,7 @@
         return;
     }
 
-    wrong_uuid = FALSE;
+    wrong_uuid = false;
     if (local_uuid->len == 16)
     {
         /*
@@ -153,22 +153,22 @@
         ** and last 12 bytes should match the spec defined constant value
         */
         if (memcmp (constant_pan_uuid, local_uuid->uu.uuid128 + 4, UUID_CONSTANT_PART))
-            wrong_uuid = TRUE;
+            wrong_uuid = true;
 
         if (local_uuid->uu.uuid128[0] || local_uuid->uu.uuid128[1])
-            wrong_uuid = TRUE;
+            wrong_uuid = true;
 
         /* Extract the 16 bit equivalent of the UUID */
-        local_uuid->uu.uuid16 = (UINT16)((local_uuid->uu.uuid128[2] << 8) | local_uuid->uu.uuid128[3]);
+        local_uuid->uu.uuid16 = (uint16_t)((local_uuid->uu.uuid128[2] << 8) | local_uuid->uu.uuid128[3]);
         local_uuid->len = 2;
     }
     if (local_uuid->len == 4)
     {
         /* First two bytes should be zeros */
         if (local_uuid->uu.uuid32 & 0xFFFF0000)
-            wrong_uuid = TRUE;
+            wrong_uuid = true;
 
-        local_uuid->uu.uuid16 = (UINT16)local_uuid->uu.uuid32;
+        local_uuid->uu.uuid16 = (uint16_t)local_uuid->uu.uuid32;
         local_uuid->len = 2;
     }
 
@@ -260,7 +260,7 @@
             {
                 /* Remove bridging */
                 if (pan_cb.pan_bridge_req_cb)
-                    (*pan_cb.pan_bridge_req_cb) (pcb->rem_bda, FALSE);
+                    (*pan_cb.pan_bridge_req_cb) (pcb->rem_bda, false);
             }
         }
         /* Set the latest active PAN role */
@@ -328,10 +328,10 @@
 ** Returns          none
 **
 *******************************************************************************/
-void pan_connect_state_cb (UINT16 handle, BD_ADDR rem_bda, tBNEP_RESULT result, BOOLEAN is_role_change)
+void pan_connect_state_cb (uint16_t handle, BD_ADDR rem_bda, tBNEP_RESULT result, bool    is_role_change)
 {
     tPAN_CONN       *pcb;
-    UINT8            peer_role;
+    uint8_t          peer_role;
     UNUSED(rem_bda);
 
     PAN_TRACE_EVENT ("pan_connect_state_cb - for handle %d, result %d", handle, result);
@@ -363,7 +363,7 @@
             pan_cb.active_role = pan_cb.prv_active_role;
 
             if ((pcb->src_uuid == UUID_SERVCLASS_NAP) && pan_cb.pan_bridge_req_cb)
-                (*pan_cb.pan_bridge_req_cb) (pcb->rem_bda, TRUE);
+                (*pan_cb.pan_bridge_req_cb) (pcb->rem_bda, true);
 
             return;
         }
@@ -372,7 +372,7 @@
         {
             /* If the connections destination role is NAP remove bridging */
             if ((pcb->src_uuid == UUID_SERVCLASS_NAP) && pan_cb.pan_bridge_req_cb)
-                (*pan_cb.pan_bridge_req_cb) (pcb->rem_bda, FALSE);
+                (*pan_cb.pan_bridge_req_cb) (pcb->rem_bda, false);
         }
 
         pan_cb.num_conns--;
@@ -405,7 +405,7 @@
     if (pan_cb.pan_bridge_req_cb && pcb->src_uuid == UUID_SERVCLASS_NAP)
     {
         PAN_TRACE_EVENT ("PAN requesting for bridge");
-        (*pan_cb.pan_bridge_req_cb) (pcb->rem_bda, TRUE);
+        (*pan_cb.pan_bridge_req_cb) (pcb->rem_bda, true);
     }
 }
 
@@ -430,17 +430,17 @@
 ** Returns          none
 **
 *******************************************************************************/
-void pan_data_ind_cb (UINT16 handle,
-                      UINT8 *src,
-                      UINT8 *dst,
-                      UINT16 protocol,
-                      UINT8 *p_data,
-                      UINT16 len,
-                      BOOLEAN ext)
+void pan_data_ind_cb (uint16_t handle,
+                      uint8_t *src,
+                      uint8_t *dst,
+                      uint16_t protocol,
+                      uint8_t *p_data,
+                      uint16_t len,
+                      bool    ext)
 {
     tPAN_CONN       *pcb;
-    UINT16          i;
-    BOOLEAN         forward;
+    uint16_t        i;
+    bool            forward;
 
     /*
     ** Check the connection status
@@ -484,7 +484,7 @@
         }
 
         if (pan_cb.pan_data_ind_cb)
-            (*pan_cb.pan_data_ind_cb) (pcb->handle, src, dst, protocol, p_data, len, ext, TRUE);
+            (*pan_cb.pan_data_ind_cb) (pcb->handle, src, dst, protocol, p_data, len, ext, true);
 
         return;
     }
@@ -504,9 +504,9 @@
     }
 
    if (pcb->src_uuid == UUID_SERVCLASS_NAP)
-       forward = TRUE;
+       forward = true;
    else
-       forward = FALSE;
+       forward = false;
 
     /* Send it over the LAN or give it to host software */
     if (pan_cb.pan_data_ind_cb)
@@ -535,18 +535,18 @@
 ** Returns          none
 **
 *******************************************************************************/
-void pan_data_buf_ind_cb (UINT16 handle,
-                          UINT8 *src,
-                          UINT8 *dst,
-                          UINT16 protocol,
+void pan_data_buf_ind_cb (uint16_t handle,
+                          uint8_t *src,
+                          uint8_t *dst,
+                          uint16_t protocol,
                           BT_HDR *p_buf,
-                          BOOLEAN ext)
+                          bool    ext)
 {
     tPAN_CONN       *pcb, *dst_pcb;
     tBNEP_RESULT    result;
-    UINT16          i, len;
-    UINT8           *p_data;
-    BOOLEAN         forward = FALSE;
+    uint16_t        i, len;
+    uint8_t         *p_data;
+    bool            forward = false;
 
     /* Check if the connection is in right state */
     pcb = pan_get_pcb_by_handle (handle);
@@ -565,16 +565,16 @@
         return;
     }
 
-    p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
     len    = p_buf->len;
 
     PAN_TRACE_EVENT ("pan_data_buf_ind_cb - for handle %d, protocol 0x%x, length %d, ext %d",
         handle, protocol, len, ext);
 
    if (pcb->src_uuid == UUID_SERVCLASS_NAP)
-       forward = TRUE;
+       forward = true;
    else
-       forward = FALSE;
+       forward = false;
 
     /* Check if it is broadcast or multicast packet */
     if (pcb->src_uuid != UUID_SERVCLASS_PANU)
@@ -646,7 +646,7 @@
 ** Returns          none
 **
 *******************************************************************************/
-void pan_tx_data_flow_cb (UINT16 handle,
+void pan_tx_data_flow_cb (uint16_t handle,
                             tBNEP_RESULT  event)
 {
 
@@ -666,8 +666,8 @@
 **                  protocol filter set by the local device
 **
 ** Parameters:      handle      - handle for the connection
-**                  indication  - TRUE if this is indication
-**                                FALSE if it is called to give the result of local
+**                  indication  - true if this is indication
+**                                false if it is called to give the result of local
 **                                      device protocol filter set
 **                  result      - This gives the result of the filter set operation
 **                  num_filters - number of filters set by the peer device
@@ -676,11 +676,11 @@
 ** Returns          none
 **
 *******************************************************************************/
-void pan_proto_filt_ind_cb (UINT16 handle,
-                            BOOLEAN indication,
+void pan_proto_filt_ind_cb (uint16_t handle,
+                            bool    indication,
                             tBNEP_RESULT result,
-                            UINT16 num_filters,
-                            UINT8 *p_filters)
+                            uint16_t num_filters,
+                            uint8_t *p_filters)
 {
     PAN_TRACE_EVENT ("pan_proto_filt_ind_cb - called for handle %d with ind %d, result %d, num %d",
                             handle, indication, result, num_filters);
@@ -700,8 +700,8 @@
 **                  multicast filter set by the local device
 **
 ** Parameters:      handle      - handle for the connection
-**                  indication  - TRUE if this is indication
-**                                FALSE if it is called to give the result of local
+**                  indication  - true if this is indication
+**                                false if it is called to give the result of local
 **                                      device multicast filter set
 **                  result      - This gives the result of the filter set operation
 **                  num_filters - number of filters set by the peer device
@@ -710,11 +710,11 @@
 ** Returns          none
 **
 *******************************************************************************/
-void pan_mcast_filt_ind_cb (UINT16 handle,
-                            BOOLEAN indication,
+void pan_mcast_filt_ind_cb (uint16_t handle,
+                            bool    indication,
                             tBNEP_RESULT result,
-                            UINT16 num_filters,
-                            UINT8 *p_filters)
+                            uint16_t num_filters,
+                            uint8_t *p_filters)
 {
     PAN_TRACE_EVENT ("pan_mcast_filt_ind_cb - called for handle %d with ind %d, result %d, num %d",
                             handle, indication, result, num_filters);
diff --git a/stack/pan/pan_utils.c b/stack/pan/pan_utils.c
index 0059074..c5555a8 100644
--- a/stack/pan/pan_utils.c
+++ b/stack/pan/pan_utils.c
@@ -36,7 +36,7 @@
 #include "btm_api.h"
 
 
-static const UINT8 pan_proto_elem_data[]   = {
+static const uint8_t pan_proto_elem_data[]   = {
                                    0x35, 0x18,          /* data element sequence of length 0x18 bytes */
                                    0x35, 0x06,          /* data element sequence for L2CAP descriptor */
                                    0x19, 0x01, 0x00,    /* UUID for L2CAP - 0x0100 */
@@ -58,12 +58,12 @@
 ** Returns
 **
 *******************************************************************************/
-UINT32 pan_register_with_sdp (UINT16 uuid, UINT8 sec_mask, char *p_name, char *p_desc)
+uint32_t pan_register_with_sdp (uint16_t uuid, uint8_t sec_mask, char *p_name, char *p_desc)
 {
-    UINT32  sdp_handle;
-    UINT16  browse_list = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
-    UINT16  security = 0;
-    UINT32  proto_len = (UINT32)pan_proto_elem_data[1];
+    uint32_t sdp_handle;
+    uint16_t browse_list = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
+    uint16_t security = 0;
+    uint32_t proto_len = (uint32_t )pan_proto_elem_data[1];
 
     /* Create a record */
     sdp_handle = SDP_CreateRecord ();
@@ -79,7 +79,7 @@
 
     /* Add protocol element sequence from the constant string */
     SDP_AddAttribute (sdp_handle, ATTR_ID_PROTOCOL_DESC_LIST, DATA_ELE_SEQ_DESC_TYPE,
-                      proto_len, (UINT8 *)(pan_proto_elem_data+2));
+                      proto_len, (uint8_t *)(pan_proto_elem_data+2));
 
 #if 0
     availability = 0xFF;
@@ -94,25 +94,25 @@
 
     /* Service Name */
     SDP_AddAttribute (sdp_handle, ATTR_ID_SERVICE_NAME, TEXT_STR_DESC_TYPE,
-                        (UINT8) (strlen(p_name) + 1), (UINT8 *)p_name);
+                        (uint8_t) (strlen(p_name) + 1), (uint8_t *)p_name);
 
     /* Service description */
     SDP_AddAttribute (sdp_handle, ATTR_ID_SERVICE_DESCRIPTION, TEXT_STR_DESC_TYPE,
-                        (UINT8) (strlen(p_desc) + 1), (UINT8 *)p_desc);
+                        (uint8_t) (strlen(p_desc) + 1), (uint8_t *)p_desc);
 
     /* Security description */
     if (sec_mask)
     {
         UINT16_TO_BE_FIELD(&security, 0x0001);
     }
-    SDP_AddAttribute (sdp_handle, ATTR_ID_SECURITY_DESCRIPTION, UINT_DESC_TYPE, 2, (UINT8 *)&security);
+    SDP_AddAttribute (sdp_handle, ATTR_ID_SECURITY_DESCRIPTION, UINT_DESC_TYPE, 2, (uint8_t *)&security);
 
-#if (defined (PAN_SUPPORTS_ROLE_NAP) && PAN_SUPPORTS_ROLE_NAP == TRUE)
+#if (PAN_SUPPORTS_ROLE_NAP == TRUE)
     if (uuid == UUID_SERVCLASS_NAP)
     {
-        UINT16  NetAccessType = 0x0005;      /* Ethernet */
-        UINT32  NetAccessRate = 0x0001312D0; /* 10Mb/sec */
-        UINT8   array[10], *p;
+        uint16_t NetAccessType = 0x0005;      /* Ethernet */
+        uint32_t NetAccessRate = 0x0001312D0; /* 10Mb/sec */
+        uint8_t array[10], *p;
 
         /* Net access type. */
         p = array;
@@ -125,33 +125,33 @@
         SDP_AddAttribute (sdp_handle, ATTR_ID_MAX_NET_ACCESS_RATE, UINT_DESC_TYPE, 4, array);
 
         /* Register with Security Manager for the specific security level */
-        if ((!BTM_SetSecurityLevel (TRUE, p_name, BTM_SEC_SERVICE_BNEP_NAP,
+        if ((!BTM_SetSecurityLevel (true, p_name, BTM_SEC_SERVICE_BNEP_NAP,
                                     sec_mask, BT_PSM_BNEP, BTM_SEC_PROTO_BNEP, UUID_SERVCLASS_NAP))
-         || (!BTM_SetSecurityLevel (FALSE, p_name, BTM_SEC_SERVICE_BNEP_NAP,
+         || (!BTM_SetSecurityLevel (false, p_name, BTM_SEC_SERVICE_BNEP_NAP,
                                     sec_mask, BT_PSM_BNEP, BTM_SEC_PROTO_BNEP, UUID_SERVCLASS_NAP)))
         {
             PAN_TRACE_ERROR ("PAN Security Registration failed for PANU");
         }
     }
 #endif
-#if (defined (PAN_SUPPORTS_ROLE_GN) && PAN_SUPPORTS_ROLE_GN == TRUE)
+#if (PAN_SUPPORTS_ROLE_GN == TRUE)
     if (uuid == UUID_SERVCLASS_GN)
     {
-        if ((!BTM_SetSecurityLevel (TRUE, p_name, BTM_SEC_SERVICE_BNEP_GN,
+        if ((!BTM_SetSecurityLevel (true, p_name, BTM_SEC_SERVICE_BNEP_GN,
                                     sec_mask, BT_PSM_BNEP, BTM_SEC_PROTO_BNEP, UUID_SERVCLASS_GN))
-         || (!BTM_SetSecurityLevel (FALSE, p_name, BTM_SEC_SERVICE_BNEP_GN,
+         || (!BTM_SetSecurityLevel (false, p_name, BTM_SEC_SERVICE_BNEP_GN,
                                     sec_mask, BT_PSM_BNEP, BTM_SEC_PROTO_BNEP, UUID_SERVCLASS_GN)))
         {
             PAN_TRACE_ERROR ("PAN Security Registration failed for GN");
         }
     }
 #endif
-#if (defined (PAN_SUPPORTS_ROLE_PANU) && PAN_SUPPORTS_ROLE_PANU == TRUE)
+#if (PAN_SUPPORTS_ROLE_PANU == TRUE)
     if (uuid == UUID_SERVCLASS_PANU)
     {
-        if ((!BTM_SetSecurityLevel (TRUE, p_name, BTM_SEC_SERVICE_BNEP_PANU,
+        if ((!BTM_SetSecurityLevel (true, p_name, BTM_SEC_SERVICE_BNEP_PANU,
                                     sec_mask, BT_PSM_BNEP, BTM_SEC_PROTO_BNEP, UUID_SERVCLASS_PANU))
-         || (!BTM_SetSecurityLevel (FALSE, p_name, BTM_SEC_SERVICE_BNEP_PANU,
+         || (!BTM_SetSecurityLevel (false, p_name, BTM_SEC_SERVICE_BNEP_PANU,
                                     sec_mask, BT_PSM_BNEP, BTM_SEC_PROTO_BNEP, UUID_SERVCLASS_PANU)))
         {
             PAN_TRACE_ERROR ("PAN Security Registration failed for PANU");
@@ -177,9 +177,9 @@
 ** Returns
 **
 *******************************************************************************/
-tPAN_CONN *pan_allocate_pcb (BD_ADDR p_bda, UINT16 handle)
+tPAN_CONN *pan_allocate_pcb (BD_ADDR p_bda, uint16_t handle)
 {
-    UINT16      i;
+    uint16_t    i;
 
     for (i=0; i<MAX_PAN_CONNS; i++)
     {
@@ -218,9 +218,9 @@
 ** Returns
 **
 *******************************************************************************/
-tPAN_CONN *pan_get_pcb_by_handle (UINT16 handle)
+tPAN_CONN *pan_get_pcb_by_handle (uint16_t handle)
 {
-    UINT16      i;
+    uint16_t    i;
 
     for (i=0; i<MAX_PAN_CONNS; i++)
     {
@@ -244,7 +244,7 @@
 *******************************************************************************/
 tPAN_CONN *pan_get_pcb_by_addr (BD_ADDR p_bda)
 {
-    UINT16      i;
+    uint16_t    i;
 
     for (i=0; i<MAX_PAN_CONNS; i++)
     {
@@ -278,7 +278,7 @@
 *******************************************************************************/
 void pan_close_all_connections (void)
 {
-    UINT16      i;
+    uint16_t    i;
 
     for (i=0; i<MAX_PAN_CONNS; i++)
     {
@@ -324,8 +324,8 @@
 *******************************************************************************/
 void pan_dump_status (void)
 {
-#if (defined (PAN_SUPPORTS_DEBUG_DUMP) && PAN_SUPPORTS_DEBUG_DUMP == TRUE)
-    UINT16          i;
+#if (PAN_SUPPORTS_DEBUG_DUMP == TRUE)
+    uint16_t        i;
     char            buff[200];
     tPAN_CONN      *p_pcb;
 
diff --git a/stack/rfcomm/port_api.c b/stack/rfcomm/port_api.c
index 13457f9..6b0130c 100644
--- a/stack/rfcomm/port_api.c
+++ b/stack/rfcomm/port_api.c
@@ -42,10 +42,10 @@
 /* duration of break in 200ms units */
 #define PORT_BREAK_DURATION     1
 
-#define info(fmt, ...)  LOG_INFO(LOG_TAG, "%s: " fmt,__FUNCTION__,  ## __VA_ARGS__)
-#define debug(fmt, ...) LOG_DEBUG(LOG_TAG, "%s: " fmt,__FUNCTION__,  ## __VA_ARGS__)
-#define error(fmt, ...) LOG_ERROR(LOG_TAG, "## ERROR : %s: " fmt "##",__FUNCTION__,  ## __VA_ARGS__)
-#define asrt(s) if(!(s)) LOG_ERROR(LOG_TAG, "## %s assert %s failed at line:%d ##",__FUNCTION__, #s, __LINE__)
+#define info(fmt, ...)  LOG_INFO(LOG_TAG, "%s: " fmt,__func__,  ## __VA_ARGS__)
+#define debug(fmt, ...) LOG_DEBUG(LOG_TAG, "%s: " fmt,__func__,  ## __VA_ARGS__)
+#define error(fmt, ...) LOG_ERROR(LOG_TAG, "## ERROR : %s: " fmt "##",__func__,  ## __VA_ARGS__)
+#define asrt(s) if(!(s)) LOG_ERROR(LOG_TAG, "## %s assert %s failed at line:%d ##",__func__, #s, __LINE__)
 
 /* Mapping from PORT_* result codes to human readable strings. */
 static const char *result_code_strings[] = {
@@ -90,7 +90,7 @@
 ** Parameters:      scn          - Service Channel Number as registered with
 **                                 the SDP (server) or obtained using SDP from
 **                                 the peer device (client).
-**                  is_server    - TRUE if requesting application is a server
+**                  is_server    - true if requesting application is a server
 **                  mtu          - Maximum frame size the application can accept
 **                  bd_addr      - BD_ADDR of the peer (client)
 **                  mask         - specifies events to be enabled.  A value
@@ -109,15 +109,15 @@
 ** (scn * 2 + 1) dlci.
 **
 *******************************************************************************/
-int RFCOMM_CreateConnection (UINT16 uuid, UINT8 scn, BOOLEAN is_server,
-                             UINT16 mtu, BD_ADDR bd_addr, UINT16 *p_handle,
+int RFCOMM_CreateConnection (uint16_t uuid, uint8_t scn, bool    is_server,
+                             uint16_t mtu, BD_ADDR bd_addr, uint16_t *p_handle,
                              tPORT_CALLBACK *p_mgmt_cb)
 {
     tPORT      *p_port;
     int        i;
-    UINT8      dlci;
+    uint8_t    dlci;
     tRFC_MCB   *p_mcb = port_find_mcb (bd_addr);
-    UINT16     rfcomm_mtu;
+    uint16_t   rfcomm_mtu;
 
 
     RFCOMM_TRACE_API ("RFCOMM_CreateConnection()  BDA: %02x-%02x-%02x-%02x-%02x-%02x",
@@ -146,7 +146,7 @@
     if (!is_server && ((p_port = port_find_port (dlci, bd_addr)) != NULL))
     {
         /* if existing port is also a client port */
-        if (p_port->is_server == FALSE)
+        if (p_port->is_server == false)
         {
             RFCOMM_TRACE_ERROR ("RFCOMM_CreateConnection - already opened state:%d, RFC state:%d, MCB state:%d",
                 p_port->state, p_port->rfc.state, p_port->rfc.p_mcb ? p_port->rfc.p_mcb->state : 0);
@@ -208,14 +208,14 @@
     /* server doesn't need to release port when closing */
     if( is_server )
     {
-        p_port->keep_port_handle = TRUE;
+        p_port->keep_port_handle = true;
 
         /* keep mtu that user asked, p_port->mtu could be updated during param negotiation */
         p_port->keep_mtu         = p_port->mtu;
     }
 
     p_port->local_ctrl.modem_signal = p_port->default_signal_state;
-    p_port->local_ctrl.fc           = FALSE;
+    p_port->local_ctrl.fc           = false;
 
     p_port->p_mgmt_callback = p_mgmt_cb;
 
@@ -241,7 +241,7 @@
 ** Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 **
 *******************************************************************************/
-int RFCOMM_RemoveConnection (UINT16 handle)
+int RFCOMM_RemoveConnection (uint16_t handle)
 {
     tPORT      *p_port;
 
@@ -278,7 +278,7 @@
 ** Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 **
 *******************************************************************************/
-int RFCOMM_RemoveServer (UINT16 handle)
+int RFCOMM_RemoveServer (uint16_t handle)
 {
     tPORT      *p_port;
 
@@ -302,7 +302,7 @@
     }
 
     /* this port will be deallocated after closing */
-    p_port->keep_port_handle = FALSE;
+    p_port->keep_port_handle = false;
     p_port->state = PORT_STATE_CLOSING;
 
     port_start_close (p_port);
@@ -325,7 +325,7 @@
 **
 **
 *******************************************************************************/
-int PORT_SetEventCallback (UINT16 port_handle, tPORT_CALLBACK *p_port_cb)
+int PORT_SetEventCallback (uint16_t port_handle, tPORT_CALLBACK *p_port_cb)
 {
     tPORT  *p_port;
 
@@ -358,7 +358,7 @@
 **
 *******************************************************************************/
 
-int PORT_ClearKeepHandleFlag (UINT16 port_handle)
+int PORT_ClearKeepHandleFlag (uint16_t port_handle)
 {
     tPORT  *p_port;
 
@@ -386,7 +386,7 @@
 **
 **
 *******************************************************************************/
-int PORT_SetDataCallback (UINT16 port_handle, tPORT_DATA_CALLBACK *p_port_cb)
+int PORT_SetDataCallback (uint16_t port_handle, tPORT_DATA_CALLBACK *p_port_cb)
 {
     tPORT  *p_port;
 
@@ -422,7 +422,7 @@
 **
 **
 *******************************************************************************/
-int PORT_SetDataCOCallback (UINT16 port_handle, tPORT_DATA_CO_CALLBACK *p_port_cb)
+int PORT_SetDataCOCallback (uint16_t port_handle, tPORT_DATA_CO_CALLBACK *p_port_cb)
 {
     tPORT  *p_port;
 
@@ -456,7 +456,7 @@
 **                  mask   - Bitmask of the events the host is interested in
 **
 *******************************************************************************/
-int PORT_SetEventMask (UINT16 port_handle, UINT32 mask)
+int PORT_SetEventMask (uint16_t port_handle, uint32_t mask)
 {
     tPORT  *p_port;
 
@@ -492,7 +492,7 @@
 **                  p_lcid     - OUT L2CAP's LCID
 **
 *******************************************************************************/
-int PORT_CheckConnection (UINT16 handle, BD_ADDR bd_addr, UINT16 *p_lcid)
+int PORT_CheckConnection (uint16_t handle, BD_ADDR bd_addr, uint16_t *p_lcid)
 {
     tPORT      *p_port;
 
@@ -529,19 +529,19 @@
 **
 ** Function         PORT_IsOpening
 **
-** Description      This function returns TRUE if there is any RFCOMM connection
+** Description      This function returns true if there is any RFCOMM connection
 **                  opening in process.
 **
-** Parameters:      TRUE if any connection opening is found
+** Parameters:      true if any connection opening is found
 **                  bd_addr    - bd_addr of the peer
 **
 *******************************************************************************/
-BOOLEAN PORT_IsOpening (BD_ADDR bd_addr)
+bool    PORT_IsOpening (BD_ADDR bd_addr)
 {
-    UINT8   xx, yy;
+    uint8_t xx, yy;
     tRFC_MCB *p_mcb = NULL;
     tPORT  *p_port;
-    BOOLEAN found_port;
+    bool    found_port;
 
     /* Check for any rfc_mcb which is in the middle of opening. */
     for (xx = 0; xx < MAX_BD_CONNECTIONS; xx++)
@@ -550,12 +550,12 @@
             (rfc_cb.port.rfc_mcb[xx].state < RFC_MX_STATE_CONNECTED))
         {
             memcpy (bd_addr, rfc_cb.port.rfc_mcb[xx].bd_addr, BD_ADDR_LEN);
-            return TRUE;
+            return true;
         }
 
         if (rfc_cb.port.rfc_mcb[xx].state == RFC_MX_STATE_CONNECTED)
         {
-            found_port = FALSE;
+            found_port = false;
             p_mcb = &rfc_cb.port.rfc_mcb[xx];
             p_port = &rfc_cb.port.port[0];
 
@@ -563,7 +563,7 @@
             {
                 if (p_port->rfc.p_mcb == p_mcb)
                 {
-                    found_port = TRUE;
+                    found_port = true;
                     break;
                 }
             }
@@ -573,12 +573,12 @@
             {
                 /* Port is not established yet. */
                 memcpy (bd_addr, rfc_cb.port.rfc_mcb[xx].bd_addr, BD_ADDR_LEN);
-                return TRUE;
+                return true;
             }
         }
     }
 
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -594,10 +594,10 @@
 **
 **
 *******************************************************************************/
-int PORT_SetState (UINT16 handle, tPORT_STATE *p_settings)
+int PORT_SetState (uint16_t handle, tPORT_STATE *p_settings)
 {
     tPORT      *p_port;
-    UINT8       baud_rate;
+    uint8_t     baud_rate;
 
     RFCOMM_TRACE_API ("PORT_SetState() handle:%d", handle);
 
@@ -643,7 +643,7 @@
 **                  p_rx_queue_count - Pointer to return queue count in.
 **
 *******************************************************************************/
-int PORT_GetRxQueueCnt (UINT16 handle, UINT16 *p_rx_queue_count)
+int PORT_GetRxQueueCnt (uint16_t handle, uint16_t *p_rx_queue_count)
 {
     tPORT      *p_port;
 
@@ -687,7 +687,7 @@
 **                               configuration information is returned.
 **
 *******************************************************************************/
-int PORT_GetState (UINT16 handle, tPORT_STATE *p_settings)
+int PORT_GetState (uint16_t handle, tPORT_STATE *p_settings)
 {
     tPORT      *p_port;
 
@@ -726,10 +726,10 @@
 **                  signal     = specify the function to be passed
 **
 *******************************************************************************/
-int PORT_Control (UINT16 handle, UINT8 signal)
+int PORT_Control (uint16_t handle, uint8_t signal)
 {
     tPORT      *p_port;
-    UINT8      old_modem_signal;
+    uint8_t    old_modem_signal;
 
     RFCOMM_TRACE_API ("PORT_Control() handle:%d signal:0x%x", handle, signal);
 
@@ -812,11 +812,11 @@
 **                  enable     - enables data flow
 **
 *******************************************************************************/
-int PORT_FlowControl (UINT16 handle, BOOLEAN enable)
+int PORT_FlowControl (uint16_t handle, bool    enable)
 {
     tPORT      *p_port;
-    BOOLEAN    old_fc;
-    UINT32     events;
+    bool       old_fc;
+    uint32_t   events;
 
     RFCOMM_TRACE_API ("PORT_FlowControl() handle:%d enable: %d", handle, enable);
 
@@ -844,7 +844,7 @@
     {
         if (!p_port->rx.user_fc)
         {
-            port_flow_control_peer(p_port, TRUE, 0);
+            port_flow_control_peer(p_port, true, 0);
         }
     }
     else
@@ -865,7 +865,7 @@
         events = PORT_EV_RXCHAR;
         if (p_port->rx_flag_ev_pending)
         {
-            p_port->rx_flag_ev_pending = FALSE;
+            p_port->rx_flag_ev_pending = false;
             events |= PORT_EV_RXFLAG;
         }
 
@@ -891,11 +891,11 @@
 **
 *******************************************************************************/
 
-int PORT_FlowControl_MaxCredit (UINT16 handle, BOOLEAN enable)
+int PORT_FlowControl_MaxCredit (uint16_t handle, bool    enable)
 {
     tPORT      *p_port;
-    BOOLEAN    old_fc;
-    UINT32     events;
+    bool       old_fc;
+    uint32_t   events;
 
     RFCOMM_TRACE_API ("PORT_FlowControl() handle:%d enable: %d", handle, enable);
 
@@ -923,7 +923,7 @@
     {
         if (!p_port->rx.user_fc)
         {
-            port_flow_control_peer(p_port, TRUE, p_port->credit_rx);
+            port_flow_control_peer(p_port, true, p_port->credit_rx);
         }
     }
     else
@@ -944,7 +944,7 @@
         events = PORT_EV_RXCHAR;
         if (p_port->rx_flag_ev_pending)
         {
-            p_port->rx_flag_ev_pending = FALSE;
+            p_port->rx_flag_ev_pending = false;
             events |= PORT_EV_RXFLAG;
         }
 
@@ -970,7 +970,7 @@
 **                  p_signal   - specify the pointer to control signals info
 **
 *******************************************************************************/
-int PORT_GetModemStatus (UINT16 handle, UINT8 *p_signal)
+int PORT_GetModemStatus (uint16_t handle, uint8_t *p_signal)
 {
     tPORT      *p_port;
 
@@ -1009,7 +1009,7 @@
 **                               connection status
 **
 *******************************************************************************/
-int PORT_ClearError (UINT16 handle, UINT16 *p_errors, tPORT_STATUS *p_status)
+int PORT_ClearError (uint16_t handle, uint16_t *p_errors, tPORT_STATUS *p_status)
 {
     tPORT  *p_port;
 
@@ -1047,7 +1047,7 @@
 **                  errors     - receive error codes
 **
 *******************************************************************************/
-int PORT_SendError (UINT16 handle, UINT8 errors)
+int PORT_SendError (uint16_t handle, uint8_t errors)
 {
     tPORT      *p_port;
 
@@ -1085,7 +1085,7 @@
 **                               connection status
 **
 *******************************************************************************/
-int PORT_GetQueueStatus (UINT16 handle, tPORT_STATUS *p_status)
+int PORT_GetQueueStatus (uint16_t handle, tPORT_STATUS *p_status)
 {
     tPORT      *p_port;
 
@@ -1103,10 +1103,10 @@
         return (PORT_NOT_OPENED);
     }
 
-    p_status->in_queue_size  = (UINT16) p_port->rx.queue_size;
-    p_status->out_queue_size = (UINT16) p_port->tx.queue_size;
+    p_status->in_queue_size  = (uint16_t) p_port->rx.queue_size;
+    p_status->out_queue_size = (uint16_t) p_port->tx.queue_size;
 
-    p_status->mtu_size = (UINT16) p_port->peer_mtu;
+    p_status->mtu_size = (uint16_t) p_port->peer_mtu;
 
     p_status->flags = 0;
 
@@ -1133,12 +1133,12 @@
 **                  purge_flags - specify the action to take.
 **
 *******************************************************************************/
-int PORT_Purge (UINT16 handle, UINT8 purge_flags)
+int PORT_Purge (uint16_t handle, uint8_t purge_flags)
 {
     tPORT      *p_port;
     BT_HDR     *p_buf;
-    UINT16      count;
-    UINT32     events;
+    uint16_t    count;
+    uint32_t   events;
 
     RFCOMM_TRACE_API ("PORT_Purge() handle:%d flags:0x%x", handle, purge_flags);
 
@@ -1170,7 +1170,7 @@
 
         /* If we flowed controlled peer based on rx_queue size enable data again */
         if (count)
-            port_flow_control_peer (p_port, TRUE, count);
+            port_flow_control_peer (p_port, true, count);
     }
 
     if (purge_flags & PORT_PURGE_TXCLEAR)
@@ -1210,11 +1210,11 @@
 **                  p_len       - Byte count received
 **
 *******************************************************************************/
-int PORT_ReadData (UINT16 handle, char *p_data, UINT16 max_len, UINT16 *p_len)
+int PORT_ReadData (uint16_t handle, char *p_data, uint16_t max_len, uint16_t *p_len)
 {
     tPORT      *p_port;
     BT_HDR     *p_buf;
-    UINT16      count;
+    uint16_t    count;
 
     RFCOMM_TRACE_API ("PORT_ReadData() handle:%d max_len:%d", handle, max_len);
 
@@ -1252,7 +1252,7 @@
 
         if (p_buf->len > max_len)
         {
-            memcpy (p_data, (UINT8 *)(p_buf + 1) + p_buf->offset, max_len);
+            memcpy (p_data, (uint8_t *)(p_buf + 1) + p_buf->offset, max_len);
             p_buf->offset += max_len;
             p_buf->len    -= max_len;
 
@@ -1268,7 +1268,7 @@
         }
         else
         {
-            memcpy (p_data, (UINT8 *)(p_buf + 1) + p_buf->offset, p_buf->len);
+            memcpy (p_data, (uint8_t *)(p_buf + 1) + p_buf->offset, p_buf->len);
 
             *p_len  += p_buf->len;
             max_len -= p_buf->len;
@@ -1301,7 +1301,7 @@
 
     /* If rfcomm suspended traffic from the peer based on the rx_queue_size */
     /* check if it can be resumed now */
-    port_flow_control_peer (p_port, TRUE, count);
+    port_flow_control_peer (p_port, true, count);
 
     return (PORT_SUCCESS);
 }
@@ -1317,7 +1317,7 @@
 **                  pp_buf      - pointer to address of buffer with data,
 **
 *******************************************************************************/
-int PORT_Read (UINT16 handle, BT_HDR **pp_buf)
+int PORT_Read (uint16_t handle, BT_HDR **pp_buf)
 {
     tPORT      *p_port;
     BT_HDR     *p_buf;
@@ -1352,7 +1352,7 @@
 
         /* If rfcomm suspended traffic from the peer based on the rx_queue_size */
         /* check if it can be resumed now */
-        port_flow_control_peer (p_port, TRUE, 1);
+        port_flow_control_peer (p_port, true, 1);
     }
     else
     {
@@ -1438,10 +1438,10 @@
 **                  pp_buf      - pointer to address of buffer with data,
 **
 *******************************************************************************/
-int PORT_Write (UINT16 handle, BT_HDR *p_buf)
+int PORT_Write (uint16_t handle, BT_HDR *p_buf)
 {
     tPORT  *p_port;
-    UINT32 event = 0;
+    uint32_t event = 0;
     int    rc;
 
     RFCOMM_TRACE_API ("PORT_Write() handle:%d", handle);
@@ -1503,14 +1503,14 @@
 **                  p_len      - Byte count returned
 **
 *******************************************************************************/
-int PORT_WriteDataCO (UINT16 handle, int* p_len)
+int PORT_WriteDataCO (uint16_t handle, int* p_len)
 {
 
     tPORT      *p_port;
     BT_HDR     *p_buf;
-    UINT32     event = 0;
+    uint32_t   event = 0;
     int        rc = 0;
-    UINT16     length;
+    uint16_t   length;
 
     RFCOMM_TRACE_API ("PORT_WriteDataCO() handle:%d", handle);
     *p_len = 0;
@@ -1535,8 +1535,8 @@
     }
     int available = 0;
     //if(ioctl(fd, FIONREAD, &available) < 0)
-    if(p_port->p_data_co_callback(handle, (UINT8*)&available, sizeof(available),
-                                DATA_CO_CALLBACK_TYPE_OUTGOING_SIZE) == FALSE)
+    if(p_port->p_data_co_callback(handle, (uint8_t*)&available, sizeof(available),
+                                DATA_CO_CALLBACK_TYPE_OUTGOING_SIZE) == false)
     {
         RFCOMM_TRACE_ERROR("p_data_co_callback DATA_CO_CALLBACK_TYPE_INCOMING_SIZE failed, available:%d", available);
         return (PORT_UNKNOWN_ERROR);
@@ -1545,7 +1545,7 @@
         return PORT_SUCCESS;
     /* Length for each buffer is the smaller of GKI buffer, peer MTU, or max_len */
     length = RFCOMM_DATA_BUF_SIZE -
-            (UINT16)(sizeof(BT_HDR) + L2CAP_MIN_OFFSET + RFCOMM_DATA_OVERHEAD);
+            (uint16_t)(sizeof(BT_HDR) + L2CAP_MIN_OFFSET + RFCOMM_DATA_OVERHEAD);
 
     /* If there are buffers scheduled for transmission check if requested */
     /* data fits into the end of the queue */
@@ -1555,20 +1555,20 @@
      && (((int)p_buf->len + available) <= (int)p_port->peer_mtu)
      && (((int)p_buf->len + available) <= (int)length))
     {
-        //if(recv(fd, (UINT8 *)(p_buf + 1) + p_buf->offset + p_buf->len, available, 0) != available)
-        if(p_port->p_data_co_callback(handle, (UINT8 *)(p_buf + 1) + p_buf->offset + p_buf->len,
-                                    available, DATA_CO_CALLBACK_TYPE_OUTGOING) == FALSE)
+        //if(recv(fd, (uint8_t *)(p_buf + 1) + p_buf->offset + p_buf->len, available, 0) != available)
+        if(p_port->p_data_co_callback(handle, (uint8_t *)(p_buf + 1) + p_buf->offset + p_buf->len,
+                                    available, DATA_CO_CALLBACK_TYPE_OUTGOING) == false)
 
         {
             error("p_data_co_callback DATA_CO_CALLBACK_TYPE_OUTGOING failed, available:%d", available);
             mutex_global_unlock();
             return (PORT_UNKNOWN_ERROR);
         }
-        //memcpy ((UINT8 *)(p_buf + 1) + p_buf->offset + p_buf->len, p_data, max_len);
-        p_port->tx.queue_size += (UINT16)available;
+        //memcpy ((uint8_t *)(p_buf + 1) + p_buf->offset + p_buf->len, p_data, max_len);
+        p_port->tx.queue_size += (uint16_t)available;
 
         *p_len = available;
-        p_buf->len += (UINT16)available;
+        p_buf->len += (uint16_t)available;
 
         mutex_global_unlock();
 
@@ -1602,14 +1602,14 @@
         if (p_port->peer_mtu < length)
             length = p_port->peer_mtu;
         if (available < (int)length)
-            length = (UINT16)available;
+            length = (uint16_t)available;
         p_buf->len = length;
         p_buf->event          = BT_EVT_TO_BTU_SP_DATA;
 
-        //memcpy ((UINT8 *)(p_buf + 1) + p_buf->offset, p_data, length);
-        //if(recv(fd, (UINT8 *)(p_buf + 1) + p_buf->offset, (int)length, 0) != (int)length)
-        if(p_port->p_data_co_callback(handle, (UINT8 *)(p_buf + 1) + p_buf->offset, length,
-                                      DATA_CO_CALLBACK_TYPE_OUTGOING) == FALSE)
+        //memcpy ((uint8_t *)(p_buf + 1) + p_buf->offset, p_data, length);
+        //if(recv(fd, (uint8_t *)(p_buf + 1) + p_buf->offset, (int)length, 0) != (int)length)
+        if(p_port->p_data_co_callback(handle, (uint8_t *)(p_buf + 1) + p_buf->offset, length,
+                                      DATA_CO_CALLBACK_TYPE_OUTGOING) == false)
         {
             error("p_data_co_callback DATA_CO_CALLBACK_TYPE_OUTGOING failed, length:%d", length);
             return (PORT_UNKNOWN_ERROR);
@@ -1657,13 +1657,13 @@
 **                  p_len       - Byte count received
 **
 *******************************************************************************/
-int PORT_WriteData (UINT16 handle, char *p_data, UINT16 max_len, UINT16 *p_len)
+int PORT_WriteData (uint16_t handle, char *p_data, uint16_t max_len, uint16_t *p_len)
 {
     tPORT      *p_port;
     BT_HDR     *p_buf;
-    UINT32     event = 0;
+    uint32_t   event = 0;
     int        rc = 0;
-    UINT16     length;
+    uint16_t   length;
 
     RFCOMM_TRACE_API ("PORT_WriteData() max_len:%d", max_len);
 
@@ -1690,7 +1690,7 @@
 
     /* Length for each buffer is the smaller of GKI buffer, peer MTU, or max_len */
     length = RFCOMM_DATA_BUF_SIZE -
-            (UINT16)(sizeof(BT_HDR) + L2CAP_MIN_OFFSET + RFCOMM_DATA_OVERHEAD);
+            (uint16_t)(sizeof(BT_HDR) + L2CAP_MIN_OFFSET + RFCOMM_DATA_OVERHEAD);
 
     /* If there are buffers scheduled for transmission check if requested */
     /* data fits into the end of the queue */
@@ -1700,7 +1700,7 @@
      && ((p_buf->len + max_len) <= p_port->peer_mtu)
      && ((p_buf->len + max_len) <= length))
     {
-        memcpy ((UINT8 *)(p_buf + 1) + p_buf->offset + p_buf->len, p_data, max_len);
+        memcpy ((uint8_t *)(p_buf + 1) + p_buf->offset + p_buf->len, p_data, max_len);
         p_port->tx.queue_size += max_len;
 
         *p_len = max_len;
@@ -1732,7 +1732,7 @@
         p_buf->len = length;
         p_buf->event          = BT_EVT_TO_BTU_SP_DATA;
 
-        memcpy ((UINT8 *)(p_buf + 1) + p_buf->offset, p_data, length);
+        memcpy ((uint8_t *)(p_buf + 1) + p_buf->offset, p_data, length);
 
         RFCOMM_TRACE_EVENT ("PORT_WriteData %d bytes", length);
 
@@ -1776,7 +1776,7 @@
 **                  max_len     - Byte count requested
 **
 *******************************************************************************/
-int PORT_Test (UINT16 handle, UINT8 *p_data, UINT16 len)
+int PORT_Test (uint16_t handle, uint8_t *p_data, uint16_t len)
 {
     tPORT    *p_port;
 
@@ -1802,9 +1802,9 @@
     p_buf->offset  = L2CAP_MIN_OFFSET + RFCOMM_MIN_OFFSET + 2;
     p_buf->len = len;
 
-    memcpy((UINT8 *)(p_buf + 1) + p_buf->offset, p_data, p_buf->len);
+    memcpy((uint8_t *)(p_buf + 1) + p_buf->offset, p_data, p_buf->len);
 
-    rfc_send_test(p_port->rfc.p_mcb, TRUE, p_buf);
+    rfc_send_test(p_port->rfc.p_mcb, true, p_buf);
 
     return (PORT_SUCCESS);
 }
@@ -1841,7 +1841,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-UINT8 PORT_SetTraceLevel (UINT8 new_level)
+uint8_t PORT_SetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         rfc_cb.trace_level = new_level;
diff --git a/stack/rfcomm/port_int.h b/stack/rfcomm/port_int.h
index 2533311..c20027c 100644
--- a/stack/rfcomm/port_int.h
+++ b/stack/rfcomm/port_int.h
@@ -60,9 +60,9 @@
 typedef struct
 {
     fixed_queue_t *queue;   /* Queue of buffers waiting to be sent */
-    BOOLEAN  peer_fc;       /* TRUE if flow control is set based on peer's request */
-    BOOLEAN  user_fc;       /* TRUE if flow control is set based on user's request  */
-    UINT32   queue_size;    /* Number of data bytes in the queue */
+    bool     peer_fc;       /* true if flow control is set based on peer's request */
+    bool     user_fc;       /* true if flow control is set based on user's request  */
+    uint32_t queue_size;    /* Number of data bytes in the queue */
     tPORT_CALLBACK *p_callback;  /* Address of the callback function */
 } tPORT_DATA;
 
@@ -76,18 +76,18 @@
 #define MODEM_SIGNAL_RI            0x04
 #define MODEM_SIGNAL_DCD           0x08
 
-    UINT8   modem_signal;       /* [DTR/DSR | RTS/CTS | RI | DCD ] */
+    uint8_t modem_signal;       /* [DTR/DSR | RTS/CTS | RI | DCD ] */
 
-    UINT8   break_signal;       /* 0-3 s in steps of 200 ms */
+    uint8_t break_signal;       /* 0-3 s in steps of 200 ms */
 
-    UINT8   discard_buffers;    /* 0 - do not discard, 1 - discard */
+    uint8_t discard_buffers;    /* 0 - do not discard, 1 - discard */
 
 #define RFCOMM_CTRL_BREAK_ASAP      0
 #define RFCOMM_CTRL_BREAK_IN_SEQ    1
 
-    UINT8   break_signal_seq;   /* as soon as possible | in sequence (default) */
+    uint8_t break_signal_seq;   /* as soon as possible | in sequence (default) */
 
-    BOOLEAN fc;                 /* TRUE when the device is unable to accept frames */
+    bool    fc;                 /* true when the device is unable to accept frames */
 } tPORT_CTRL;
 
 
@@ -98,22 +98,22 @@
 {
     alarm_t *mcb_timer;       /* MCB timer */
     fixed_queue_t *cmd_q;     /* Queue for command messages on this mux */
-    UINT8     port_inx[RFCOMM_MAX_DLCI + 1];  /* Array for quick access to  */
+    uint8_t   port_inx[RFCOMM_MAX_DLCI + 1];  /* Array for quick access to  */
                                               /* tPORT based on dlci        */
     BD_ADDR   bd_addr;        /* BD ADDR of the peer if initiator */
-    UINT16    lcid;           /* Local cid used for this channel */
-    UINT16    peer_l2cap_mtu; /* Max frame that can be sent to peer L2CAP */
-    UINT8     state;          /* Current multiplexer channel state */
-    UINT8     is_initiator;   /* TRUE if this side sends SABME (dlci=0) */
-    BOOLEAN   local_cfg_sent;
-    BOOLEAN   peer_cfg_rcvd;
-    BOOLEAN   restart_required; /* TRUE if has to restart channel after disc */
-    BOOLEAN   peer_ready;      /* True if other side can accept frames */
-    UINT8     flow;            /* flow control mechanism for this mux */
-    BOOLEAN   l2cap_congested; /* TRUE if L2CAP is congested */
-    BOOLEAN   is_disc_initiator; /* TRUE if initiated disc of port */
-    UINT16    pending_lcid;    /* store LCID for incoming connection while connecting */
-    UINT8     pending_id;      /* store l2cap ID for incoming connection while connecting */
+    uint16_t  lcid;           /* Local cid used for this channel */
+    uint16_t  peer_l2cap_mtu; /* Max frame that can be sent to peer L2CAP */
+    uint8_t   state;          /* Current multiplexer channel state */
+    uint8_t   is_initiator;   /* true if this side sends SABME (dlci=0) */
+    bool      local_cfg_sent;
+    bool      peer_cfg_rcvd;
+    bool      restart_required; /* true if has to restart channel after disc */
+    bool      peer_ready;      /* True if other side can accept frames */
+    uint8_t   flow;            /* flow control mechanism for this mux */
+    bool      l2cap_congested; /* true if L2CAP is congested */
+    bool      is_disc_initiator; /* true if initiated disc of port */
+    uint16_t  pending_lcid;    /* store LCID for incoming connection while connecting */
+    uint8_t   pending_id;      /* store l2cap ID for incoming connection while connecting */
 } tRFC_MCB;
 
 
@@ -127,7 +127,7 @@
 #define RFC_PORT_STATE_OPENED        3
 #define RFC_PORT_STATE_CLOSING       4
 
-    UINT8     state;          /* Current state of the connection */
+    uint8_t   state;          /* Current state of the connection */
 
 #define RFC_RSP_PN                  0x01
 #define RFC_RSP_RPN_REPLY           0x02
@@ -135,7 +135,7 @@
 #define RFC_RSP_MSC                 0x08
 #define RFC_RSP_RLS                 0x10
 
-    UINT8    expected_rsp;
+    uint8_t  expected_rsp;
 
     tRFC_MCB *p_mcb;
 
@@ -148,31 +148,31 @@
 */
 typedef struct
 {
-    UINT8   inx;            /* Index of this control block in the port_info array */
-    BOOLEAN in_use;         /* True when structure is allocated */
+    uint8_t inx;            /* Index of this control block in the port_info array */
+    bool    in_use;         /* True when structure is allocated */
 
 #define PORT_STATE_CLOSED   0
 #define PORT_STATE_OPENING  1
 #define PORT_STATE_OPENED   2
 #define PORT_STATE_CLOSING  3
 
-    UINT8   state;          /* State of the application */
+    uint8_t state;          /* State of the application */
 
-    UINT8   scn;            /* Service channel number */
-    UINT16  uuid;           /* Service UUID */
+    uint8_t scn;            /* Service channel number */
+    uint16_t uuid;           /* Service UUID */
 
     BD_ADDR bd_addr;        /* BD ADDR of the device for the multiplexer channel */
-    BOOLEAN is_server;      /* TRUE if the server application */
-    UINT8   dlci;           /* DLCI of the connection */
+    bool    is_server;      /* true if the server application */
+    uint8_t dlci;           /* DLCI of the connection */
 
-    UINT8   error;          /* Last error detected */
+    uint8_t error;          /* Last error detected */
 
-    UINT8   line_status;    /* Line status as reported by peer */
+    uint8_t line_status;    /* Line status as reported by peer */
 
-    UINT8   default_signal_state; /* Initial signal state depending on uuid */
+    uint8_t default_signal_state; /* Initial signal state depending on uuid */
 
-    UINT16  mtu;            /* Max MTU that port can receive */
-    UINT16  peer_mtu;       /* Max MTU that port can send */
+    uint16_t mtu;            /* Max MTU that port can receive */
+    uint16_t peer_mtu;       /* Max MTU that port can send */
 
     tPORT_DATA tx;          /* Control block for data from app to peer */
     tPORT_DATA rx;          /* Control block for data from peer to app */
@@ -188,26 +188,26 @@
 #define PORT_CTRL_IND_RECEIVED      0x04
 #define PORT_CTRL_IND_RESPONDED     0x08
 
-    UINT8       port_ctrl;                  /* Modem Status Command  */
+    uint8_t     port_ctrl;                  /* Modem Status Command  */
 
-    BOOLEAN     rx_flag_ev_pending;         /* RXFLAG Character is received */
+    bool        rx_flag_ev_pending;         /* RXFLAG Character is received */
 
     tRFC_PORT   rfc;                        /* RFCOMM port control block */
 
-    UINT32      ev_mask;                    /* Event mask for the callback */
+    uint32_t    ev_mask;                    /* Event mask for the callback */
     tPORT_CALLBACK      *p_callback;        /* Pointer to users callback function */
     tPORT_CALLBACK      *p_mgmt_callback;   /* Callback function to receive connection up/down */
     tPORT_DATA_CALLBACK *p_data_callback;   /* Callback function to receive data indications */
     tPORT_DATA_CO_CALLBACK *p_data_co_callback;   /* Callback function with callouts and flowctrl */
-    UINT16      credit_tx;                  /* Flow control credits for tx path */
-    UINT16      credit_rx;                  /* Flow control credits for rx path, this is */
+    uint16_t    credit_tx;                  /* Flow control credits for tx path */
+    uint16_t    credit_rx;                  /* Flow control credits for rx path, this is */
                                             /* number of buffers peer is allowed to sent */
-    UINT16      credit_rx_max;              /* Max number of credits we will allow this guy to sent */
-    UINT16      credit_rx_low;              /* Number of credits when we send credit update */
-    UINT16      rx_buf_critical;            /* port receive queue critical watermark level */
-    BOOLEAN     keep_port_handle;           /* TRUE if port is not deallocated when closing */
-                                            /* it is set to TRUE for server when allocating port */
-    UINT16      keep_mtu;                   /* Max MTU that port can receive by server */
+    uint16_t    credit_rx_max;              /* Max number of credits we will allow this guy to sent */
+    uint16_t    credit_rx_low;              /* Number of credits when we send credit update */
+    uint16_t    rx_buf_critical;            /* port receive queue critical watermark level */
+    bool        keep_port_handle;           /* true if port is not deallocated when closing */
+                                            /* it is set to true for server when allocating port */
+    uint16_t    keep_mtu;                   /* Max MTU that port can receive by server */
 } tPORT;
 
 
@@ -222,17 +222,17 @@
 /*
 ** Functions provided by the port_utils.c
 */
-extern tPORT    *port_allocate_port (UINT8 dlci, BD_ADDR bd_addr);
+extern tPORT    *port_allocate_port (uint8_t dlci, BD_ADDR bd_addr);
 extern void     port_set_defaults (tPORT *p_port);
 extern void     port_select_mtu (tPORT *p_port);
 extern void     port_release_port (tPORT *p_port);
-extern tPORT    *port_find_mcb_dlci_port (tRFC_MCB *p_mcb, UINT8 dlci);
+extern tPORT    *port_find_mcb_dlci_port (tRFC_MCB *p_mcb, uint8_t dlci);
 extern tRFC_MCB *port_find_mcb (BD_ADDR bd_addr);
-extern tPORT    *port_find_dlci_port (UINT8 dlci);
-extern tPORT    *port_find_port (UINT8 dlci, BD_ADDR bd_addr);
-extern UINT32   port_get_signal_changes (tPORT *p_port, UINT8 old_signals, UINT8 signal);
-extern UINT32   port_flow_control_user (tPORT *p_port);
-extern void     port_flow_control_peer(tPORT *p_port, BOOLEAN enable, UINT16 count);
+extern tPORT    *port_find_dlci_port (uint8_t dlci);
+extern tPORT    *port_find_port (uint8_t dlci, BD_ADDR bd_addr);
+extern uint32_t port_get_signal_changes (tPORT *p_port, uint8_t old_signals, uint8_t signal);
+extern uint32_t port_flow_control_user (tPORT *p_port);
+extern void     port_flow_control_peer(tPORT *p_port, bool    enable, uint16_t count);
 
 /*
 ** Functions provided by the port_rfc.c
@@ -242,7 +242,7 @@
 extern void port_start_par_neg (tPORT *p_port);
 extern void port_start_control (tPORT *p_port);
 extern void port_start_close (tPORT *p_port);
-extern void port_rfc_closed (tPORT *p_port, UINT8 res);
+extern void port_rfc_closed (tPORT *p_port, uint8_t res);
 
 #ifdef __cplusplus
 }
diff --git a/stack/rfcomm/port_rfc.c b/stack/rfcomm/port_rfc.c
index aaad62a..a41d021 100644
--- a/stack/rfcomm/port_rfc.c
+++ b/stack/rfcomm/port_rfc.c
@@ -39,9 +39,9 @@
 /*
 ** Local function definitions
 */
-UINT32 port_rfc_send_tx_data (tPORT *p_port);
-void   port_rfc_closed (tPORT *p_port, UINT8 res);
-void   port_get_credits (tPORT *p_port, UINT8 k);
+uint32_t port_rfc_send_tx_data (tPORT *p_port);
+void   port_rfc_closed (tPORT *p_port, uint8_t res);
+void   port_get_credits (tPORT *p_port, uint8_t k);
 
 
 /*******************************************************************************
@@ -61,7 +61,7 @@
     RFCOMM_TRACE_EVENT ("port_open_continue, p_port:%p", p_port);
 
     /* Check if multiplexer channel has already been established */
-    if ((p_mcb = rfc_alloc_multiplexer_channel (p_port->bd_addr, TRUE)) == NULL)
+    if ((p_mcb = rfc_alloc_multiplexer_channel (p_port->bd_addr, true)) == NULL)
     {
         RFCOMM_TRACE_WARNING ("port_open_continue no mx channel");
         port_release_port (p_port);
@@ -152,8 +152,8 @@
 void port_start_close (tPORT *p_port)
 {
     tRFC_MCB *p_mcb = p_port->rfc.p_mcb;
-    UINT8  old_signals;
-    UINT32 events = 0;
+    uint8_t old_signals;
+    uint32_t events = 0;
 
     /* At first indicate to the user that signals on the connection were dropped */
     p_port->line_status |= LINE_STATUS_FAILED;
@@ -199,11 +199,11 @@
 **                  are in the OPENING state
 **
 *******************************************************************************/
-void PORT_StartCnf (tRFC_MCB *p_mcb, UINT16 result)
+void PORT_StartCnf (tRFC_MCB *p_mcb, uint16_t result)
 {
     tPORT   *p_port;
     int     i;
-    BOOLEAN no_ports_up = TRUE;
+    bool    no_ports_up = true;
 
     RFCOMM_TRACE_EVENT ("PORT_StartCnf result:%d", result);
 
@@ -212,7 +212,7 @@
     {
         if (p_port->rfc.p_mcb == p_mcb)
         {
-            no_ports_up = FALSE;
+            no_ports_up = false;
 
             if (result == RFCOMM_SUCCESS)
                 RFCOMM_ParNegReq (p_mcb, p_port->dlci, p_port->mtu);
@@ -292,11 +292,11 @@
 **                  Otherwise save the MTU size supported by the peer.
 **
 *******************************************************************************/
-void PORT_ParNegInd (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT8 cl, UINT8 k)
+void PORT_ParNegInd (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu, uint8_t cl, uint8_t k)
 {
     tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
-    UINT8 our_cl;
-    UINT8 our_k;
+    uint8_t our_cl;
+    uint8_t our_k;
 
     RFCOMM_TRACE_EVENT ("PORT_ParNegInd dlci:%d mtu:%d", dlci, mtu);
 
@@ -307,7 +307,7 @@
         if (!p_port)
         {
             /* If the port cannot be opened, send a DM.  Per Errata 1205 */
-            rfc_send_dm(p_mcb, dlci, FALSE);
+            rfc_send_dm(p_mcb, dlci, false);
             /* check if this is the last port open, some headsets have
             problem, they don't disconnect if we send DM */
             rfc_check_mcb_active( p_mcb );
@@ -383,7 +383,7 @@
 **                  procedure send EstablishRequest to continue.
 **
 *******************************************************************************/
-void PORT_ParNegCnf (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT8 cl, UINT8 k)
+void PORT_ParNegCnf (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu, uint8_t cl, uint8_t k)
 {
     tPORT   *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
 
@@ -444,7 +444,7 @@
 **                  meaning that application already made open.
 **
 *******************************************************************************/
-void PORT_DlcEstablishInd (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu)
+void PORT_DlcEstablishInd (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu)
 {
     tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
 
@@ -496,7 +496,7 @@
 **                  successfull.
 **
 *******************************************************************************/
-void PORT_DlcEstablishCnf (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT16 result)
+void PORT_DlcEstablishCnf (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu, uint16_t result)
 {
     tPORT  *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
 
@@ -547,8 +547,8 @@
 **                  allocated before meaning that application already made open.
 **
 *******************************************************************************/
-void PORT_PortNegInd (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars,
-                      UINT16 param_mask)
+void PORT_PortNegInd (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_STATE *p_pars,
+                      uint16_t param_mask)
 {
     tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
 
@@ -580,7 +580,7 @@
 **                  state for the port.  Propagate change to the user.
 **
 *******************************************************************************/
-void PORT_PortNegCnf (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars, UINT16 result)
+void PORT_PortNegCnf (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_STATE *p_pars, uint16_t result)
 {
     tPORT  *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
     UNUSED(p_pars);
@@ -622,11 +622,11 @@
 **                  signal change.  Propagate change to the user.
 **
 *******************************************************************************/
-void PORT_ControlInd (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars)
+void PORT_ControlInd (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_CTRL *p_pars)
 {
     tPORT  *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
-    UINT32 event;
-    UINT8  old_signals;
+    uint32_t event;
+    uint8_t old_signals;
 
     RFCOMM_TRACE_EVENT ("PORT_ControlInd");
 
@@ -681,10 +681,10 @@
 **                  peer acknowleges change of the modem signals.
 **
 *******************************************************************************/
-void PORT_ControlCnf (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars)
+void PORT_ControlCnf (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_CTRL *p_pars)
 {
     tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
-    UINT32 event = 0;
+    uint32_t event = 0;
     UNUSED(p_pars);
 
     RFCOMM_TRACE_EVENT ("PORT_ControlCnf");
@@ -719,10 +719,10 @@
 **                  peer indicates change in the line status
 **
 *******************************************************************************/
-void PORT_LineStatusInd (tRFC_MCB *p_mcb, UINT8 dlci, UINT8 line_status)
+void PORT_LineStatusInd (tRFC_MCB *p_mcb, uint8_t dlci, uint8_t line_status)
 {
     tPORT  *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
-    UINT32 event = 0;
+    uint32_t event = 0;
 
     RFCOMM_TRACE_EVENT ("PORT_LineStatusInd");
 
@@ -753,7 +753,7 @@
 **                  DLC connection is released.
 **
 *******************************************************************************/
-void PORT_DlcReleaseInd (tRFC_MCB *p_mcb, UINT8 dlci)
+void PORT_DlcReleaseInd (tRFC_MCB *p_mcb, uint8_t dlci)
 {
     tPORT  *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
 
@@ -826,12 +826,12 @@
 **                  buffer is received from the peer.
 **
 *******************************************************************************/
-void PORT_DataInd (tRFC_MCB *p_mcb, UINT8 dlci, BT_HDR *p_buf)
+void PORT_DataInd (tRFC_MCB *p_mcb, uint8_t dlci, BT_HDR *p_buf)
 {
     tPORT  *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
-    UINT8  rx_char1;
-    UINT32 events = 0;
-    UINT8  *p;
+    uint8_t rx_char1;
+    uint32_t events = 0;
+    uint8_t *p;
     int    i;
 
     RFCOMM_TRACE_EVENT("PORT_DataInd with data length %d, p_mcb:%p,p_port:%p,dlci:%d",
@@ -846,9 +846,9 @@
     {
         /* Another packet is delivered to user.  Send credits to peer if required */
 
-        if(p_port->p_data_co_callback(p_port->inx, (UINT8*)p_buf, -1, DATA_CO_CALLBACK_TYPE_INCOMING))
-            port_flow_control_peer(p_port, TRUE, 1);
-        else port_flow_control_peer(p_port, FALSE, 0);
+        if(p_port->p_data_co_callback(p_port->inx, (uint8_t*)p_buf, -1, DATA_CO_CALLBACK_TYPE_INCOMING))
+            port_flow_control_peer(p_port, true, 1);
+        else port_flow_control_peer(p_port, false, 0);
         //osi_free(p_buf);
         return;
     }
@@ -857,9 +857,9 @@
     if (p_port->p_data_callback)
     {
         /* Another packet is delivered to user.  Send credits to peer if required */
-        port_flow_control_peer(p_port, TRUE, 1);
+        port_flow_control_peer(p_port, true, 1);
 
-        p_port->p_data_callback (p_port->inx, (UINT8 *)(p_buf + 1) + p_buf->offset, p_buf->len);
+        p_port->p_data_callback (p_port->inx, (uint8_t *)(p_buf + 1) + p_buf->offset, p_buf->len);
         osi_free(p_buf);
         return;
     }
@@ -880,7 +880,7 @@
     if (((rx_char1 = p_port->user_port_pars.rx_char1) != 0)
      && (p_port->ev_mask & PORT_EV_RXFLAG))
     {
-        for (i = 0, p = (UINT8 *)(p_buf + 1) + p_buf->offset; i < p_buf->len; i++)
+        for (i = 0, p = (uint8_t *)(p_buf + 1) + p_buf->offset; i < p_buf->len; i++)
         {
             if (*p++ == rx_char1)
             {
@@ -898,13 +898,13 @@
     mutex_global_unlock();
 
     /* perform flow control procedures if necessary */
-    port_flow_control_peer(p_port, FALSE, 0);
+    port_flow_control_peer(p_port, false, 0);
 
     /* If user indicated flow control can not deliver any notifications to him */
     if (p_port->rx.user_fc)
     {
         if (events & PORT_EV_RXFLAG)
-            p_port->rx_flag_ev_pending = TRUE;
+            p_port->rx_flag_ev_pending = true;
 
         return;
     }
@@ -927,10 +927,10 @@
 **                  control signal change.  Propagate change to the user.
 **
 *******************************************************************************/
-void PORT_FlowInd (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN enable_data)
+void PORT_FlowInd (tRFC_MCB *p_mcb, uint8_t dlci, bool    enable_data)
 {
     tPORT  *p_port = (tPORT *)NULL;
-    UINT32 events = 0;
+    uint32_t events = 0;
     int    i;
 
     RFCOMM_TRACE_EVENT ("PORT_FlowInd fc:%d", enable_data);
@@ -987,9 +987,9 @@
 ** Description      This function is when forward data can be sent to the peer
 **
 *******************************************************************************/
-UINT32 port_rfc_send_tx_data (tPORT *p_port)
+uint32_t port_rfc_send_tx_data (tPORT *p_port)
 {
-    UINT32 events = 0;
+    uint32_t events = 0;
     BT_HDR *p_buf;
 
     /* if there is data to be sent */
@@ -1042,10 +1042,10 @@
 ** Description      This function when RFCOMM side of port is closed
 **
 *******************************************************************************/
-void port_rfc_closed (tPORT *p_port, UINT8 res)
+void port_rfc_closed (tPORT *p_port, uint8_t res)
 {
-    UINT8     old_signals;
-    UINT32    events = 0;
+    uint8_t   old_signals;
+    uint32_t  events = 0;
     tRFC_MCB *p_mcb = p_port->rfc.p_mcb;
 
     if ((p_port->state == PORT_STATE_OPENING) && (p_port->is_server))
@@ -1113,9 +1113,9 @@
 **                  should be less then 255
 **
 *******************************************************************************/
-void port_get_credits (tPORT *p_port, UINT8 k)
+void port_get_credits (tPORT *p_port, uint8_t k)
 {
     p_port->credit_tx = k;
     if (p_port->credit_tx == 0)
-        p_port->tx.peer_fc = TRUE;
+        p_port->tx.peer_fc = true;
 }
diff --git a/stack/rfcomm/port_utils.c b/stack/rfcomm/port_utils.c
index 3a8ff6c..706062c 100644
--- a/stack/rfcomm/port_utils.c
+++ b/stack/rfcomm/port_utils.c
@@ -62,10 +62,10 @@
 ** Returns          Pointer to the PORT or NULL if not found
 **
 *******************************************************************************/
-tPORT *port_allocate_port (UINT8 dlci, BD_ADDR bd_addr)
+tPORT *port_allocate_port (uint8_t dlci, BD_ADDR bd_addr)
 {
     tPORT  *p_port = &rfc_cb.port.port[0];
-    UINT8  xx, yy;
+    uint8_t xx, yy;
 
     for (xx = 0, yy = rfc_cb.rfc.last_port + 1; xx < MAX_RFC_PORTS; xx++, yy++)
     {
@@ -77,7 +77,7 @@
         {
             memset(p_port, 0, sizeof (tPORT));
 
-            p_port->in_use = TRUE;
+            p_port->in_use = true;
             p_port->inx    = yy + 1;
 
             /* During the open set default state for the port connection */
@@ -116,7 +116,7 @@
     p_port->port_ctrl      = 0;
     p_port->error          = 0;
     p_port->line_status    = 0;
-    p_port->rx_flag_ev_pending = FALSE;
+    p_port->rx_flag_ev_pending = false;
     p_port->peer_mtu       = RFCOMM_DEFAULT_MTU;
 
     p_port->user_port_pars = default_port_pars;
@@ -147,7 +147,7 @@
 *******************************************************************************/
 void port_select_mtu (tPORT *p_port)
 {
-    UINT16 packet_size;
+    uint16_t packet_size;
 
     /* Will select MTU only if application did not setup something */
     if (p_port->mtu == 0)
@@ -249,7 +249,7 @@
             RFCOMM_TRACE_DEBUG("%s Re-initialize handle: %d", __func__, p_port->inx);
 
             /* save event mask and callback */
-            UINT32 mask = p_port->ev_mask;
+            uint32_t mask = p_port->ev_mask;
             tPORT_CALLBACK *p_port_cb = p_port->p_callback;
             tPORT_STATE user_port_pars = p_port->user_port_pars;
 
@@ -319,9 +319,9 @@
 ** Returns          Pointer to the PORT or NULL if not found
 **
 *******************************************************************************/
-tPORT *port_find_mcb_dlci_port (tRFC_MCB *p_mcb, UINT8 dlci)
+tPORT *port_find_mcb_dlci_port (tRFC_MCB *p_mcb, uint8_t dlci)
 {
-    UINT8 inx;
+    uint8_t inx;
 
     if (!p_mcb)
         return (NULL);
@@ -349,9 +349,9 @@
 ** Returns          Pointer to the PORT or NULL if not found
 **
 *******************************************************************************/
-tPORT *port_find_dlci_port (UINT8 dlci)
+tPORT *port_find_dlci_port (uint8_t dlci)
 {
-    UINT16 i;
+    uint16_t i;
     tPORT  *p_port;
 
     for (i = 0; i < MAX_RFC_PORTS; i++)
@@ -384,9 +384,9 @@
 ** Returns          Pointer to the PORT or NULL if not found
 **
 *******************************************************************************/
-tPORT *port_find_port (UINT8 dlci, BD_ADDR bd_addr)
+tPORT *port_find_port (uint8_t dlci, BD_ADDR bd_addr)
 {
-    UINT16 i;
+    uint16_t i;
     tPORT  *p_port;
 
     for (i = 0; i < MAX_RFC_PORTS; i++)
@@ -414,14 +414,14 @@
 ** Returns          event mask to be returned to the application
 **
 *******************************************************************************/
-UINT32 port_flow_control_user (tPORT *p_port)
+uint32_t port_flow_control_user (tPORT *p_port)
 {
-    UINT32 event = 0;
+    uint32_t event = 0;
 
     /* Flow control to the user can be caused by flow controlling by the peer */
     /* (FlowInd, or flow control by the peer RFCOMM (Fcon) or internally if */
     /* tx_queue is full */
-    BOOLEAN fc = p_port->tx.peer_fc
+    bool    fc = p_port->tx.peer_fc
               || !p_port->rfc.p_mcb
               || !p_port->rfc.p_mcb->peer_ready
               || (p_port->tx.queue_size > PORT_TX_HIGH_WM)
@@ -450,10 +450,10 @@
 ** Returns          event mask to be returned to the application
 **
 *******************************************************************************/
-UINT32 port_get_signal_changes (tPORT *p_port, UINT8 old_signals, UINT8 signal)
+uint32_t port_get_signal_changes (tPORT *p_port, uint8_t old_signals, uint8_t signal)
 {
-    UINT8  changed_signals = (signal ^ old_signals);
-    UINT32 events = 0;
+    uint8_t changed_signals = (signal ^ old_signals);
+    uint32_t events = 0;
 
     if (changed_signals & PORT_DTRDSR_ON)
     {
@@ -496,7 +496,7 @@
 ** Returns          nothing
 **
 *******************************************************************************/
-void port_flow_control_peer(tPORT *p_port, BOOLEAN enable, UINT16 count)
+void port_flow_control_peer(tPORT *p_port, bool    enable, uint16_t count)
 {
     if (!p_port->rfc.p_mcb)
         return;
@@ -525,11 +525,11 @@
              && (p_port->credit_rx_max > p_port->credit_rx))
             {
                 rfc_send_credit(p_port->rfc.p_mcb, p_port->dlci,
-                                (UINT8) (p_port->credit_rx_max - p_port->credit_rx));
+                                (uint8_t) (p_port->credit_rx_max - p_port->credit_rx));
 
                 p_port->credit_rx = p_port->credit_rx_max;
 
-                p_port->rx.peer_fc = FALSE;
+                p_port->rx.peer_fc = false;
             }
         }
         /* else want to disable flow from peer */
@@ -538,12 +538,12 @@
             /* if client registered data callback, just do what they want */
             if (p_port->p_data_callback || p_port->p_data_co_callback)
             {
-                p_port->rx.peer_fc = TRUE;
+                p_port->rx.peer_fc = true;
             }
             /* if queue count reached credit rx max, set peer fc */
             else if (fixed_queue_length(p_port->rx.queue) >= p_port->credit_rx_max)
             {
-                p_port->rx.peer_fc = TRUE;
+                p_port->rx.peer_fc = true;
             }
         }
     }
@@ -559,11 +559,11 @@
              && (p_port->rx.queue_size < PORT_RX_LOW_WM)
              && (fixed_queue_length(p_port->rx.queue) < PORT_RX_BUF_LOW_WM))
             {
-                p_port->rx.peer_fc = FALSE;
+                p_port->rx.peer_fc = false;
 
                 /* If user did not force flow control allow traffic now */
                 if (!p_port->rx.user_fc)
-                    RFCOMM_FlowReq (p_port->rfc.p_mcb, p_port->dlci, TRUE);
+                    RFCOMM_FlowReq (p_port->rfc.p_mcb, p_port->dlci, true);
             }
         }
         /* else want to disable flow from peer */
@@ -572,8 +572,8 @@
             /* if client registered data callback, just do what they want */
             if (p_port->p_data_callback || p_port->p_data_co_callback)
             {
-                p_port->rx.peer_fc = TRUE;
-                RFCOMM_FlowReq (p_port->rfc.p_mcb, p_port->dlci, FALSE);
+                p_port->rx.peer_fc = true;
+                RFCOMM_FlowReq (p_port->rfc.p_mcb, p_port->dlci, false);
             }
             /* Check the size of the rx queue.  If it exceeds certain */
             /* level and flow control has not been sent to the peer do it now */
@@ -583,8 +583,8 @@
             {
                 RFCOMM_TRACE_EVENT ("PORT_DataInd Data reached HW. Sending FC set.");
 
-                p_port->rx.peer_fc = TRUE;
-                RFCOMM_FlowReq (p_port->rfc.p_mcb, p_port->dlci, FALSE);
+                p_port->rx.peer_fc = true;
+                RFCOMM_FlowReq (p_port->rfc.p_mcb, p_port->dlci, false);
             }
         }
     }
diff --git a/stack/rfcomm/rfc_int.h b/stack/rfcomm/rfc_int.h
index b78de81..22ca326 100644
--- a/stack/rfcomm/rfc_int.h
+++ b/stack/rfcomm/rfc_int.h
@@ -50,93 +50,93 @@
 #define RFCOMM_MAX_MTU          32767
 
 extern void RFCOMM_StartReq (tRFC_MCB *p_mcb);
-extern void RFCOMM_StartRsp (tRFC_MCB *p_mcb, UINT16 result);
+extern void RFCOMM_StartRsp (tRFC_MCB *p_mcb, uint16_t result);
 
-extern void RFCOMM_DlcEstablishReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu);
-extern void RFCOMM_DlcEstablishRsp (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT16 result);
+extern void RFCOMM_DlcEstablishReq (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu);
+extern void RFCOMM_DlcEstablishRsp (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu, uint16_t result);
 
-extern void RFCOMM_DataReq (tRFC_MCB *p_mcb, UINT8 dlci, BT_HDR *p_buf);
+extern void RFCOMM_DataReq (tRFC_MCB *p_mcb, uint8_t dlci, BT_HDR *p_buf);
 
-extern void RFCOMM_DlcReleaseReq (tRFC_MCB *p_mcb, UINT8 dlci);
+extern void RFCOMM_DlcReleaseReq (tRFC_MCB *p_mcb, uint8_t dlci);
 
-extern void RFCOMM_ParNegReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu);
-extern void RFCOMM_ParNegRsp (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT8 cl, UINT8 k);
+extern void RFCOMM_ParNegReq (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu);
+extern void RFCOMM_ParNegRsp (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu, uint8_t cl, uint8_t k);
 
-extern void RFCOMM_TestReq (UINT8 *p_data, UINT16 len);
+extern void RFCOMM_TestReq (uint8_t *p_data, uint16_t len);
 
 #define RFCOMM_FLOW_STATE_DISABLE       0
 #define RFCOMM_FLOW_STATE_ENABLE        1
 
-extern void RFCOMM_FlowReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT8 state);
+extern void RFCOMM_FlowReq (tRFC_MCB *p_mcb, uint8_t dlci, uint8_t state);
 
-extern void RFCOMM_PortNegReq (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars);
-extern void RFCOMM_PortNegRsp (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars, UINT16 param_mask);
+extern void RFCOMM_PortNegReq (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_STATE *p_pars);
+extern void RFCOMM_PortNegRsp (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_STATE *p_pars, uint16_t param_mask);
 
-extern void RFCOMM_ControlReq (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars);
-extern void RFCOMM_ControlRsp (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars);
+extern void RFCOMM_ControlReq (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_CTRL *p_pars);
+extern void RFCOMM_ControlRsp (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_CTRL *p_pars);
 
-extern void RFCOMM_LineStatusReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT8 line_status);
+extern void RFCOMM_LineStatusReq (tRFC_MCB *p_mcb, uint8_t dlci, uint8_t line_status);
 /*
 ** Define logical struct used for sending and decoding MX frames
 */
 typedef struct
 {
-    UINT8   dlci;
-    UINT8   type;
-    UINT8   cr;
-    UINT8   ea;
-    UINT8   pf;
-    UINT8   credit;
+    uint8_t dlci;
+    uint8_t type;
+    uint8_t cr;
+    uint8_t ea;
+    uint8_t pf;
+    uint8_t credit;
 
     union
     {
         struct
         {
-            UINT8 dlci;
-            UINT8 frame_type;
-            UINT8 conv_layer;
-            UINT8 priority;
-            UINT8 t1;
-            UINT16 mtu;
-            UINT8 n2;
-            UINT8 k;
+            uint8_t dlci;
+            uint8_t frame_type;
+            uint8_t conv_layer;
+            uint8_t priority;
+            uint8_t t1;
+            uint16_t mtu;
+            uint8_t n2;
+            uint8_t k;
         } pn;
         struct
         {
-            UINT8   *p_data;
-            UINT16  data_len;
+            uint8_t *p_data;
+            uint16_t data_len;
         } test;
         struct
         {
-            UINT8 dlci;
-            UINT8 signals;
-            UINT8 break_present;
-            UINT8 break_duration;
+            uint8_t dlci;
+            uint8_t signals;
+            uint8_t break_present;
+            uint8_t break_duration;
         } msc;
         struct
         {
-            UINT8 ea;
-            UINT8 cr;
-            UINT8 type;
+            uint8_t ea;
+            uint8_t cr;
+            uint8_t type;
         } nsc;
         struct
         {
-            UINT8 dlci;
-            UINT8 is_request;
-            UINT8 baud_rate;
-            UINT8 byte_size;
-            UINT8 stop_bits;
-            UINT8 parity;
-            UINT8 parity_type;
-            UINT8 fc_type;
-            UINT8 xon_char;
-            UINT8 xoff_char;
-            UINT16 param_mask;
+            uint8_t dlci;
+            uint8_t is_request;
+            uint8_t baud_rate;
+            uint8_t byte_size;
+            uint8_t stop_bits;
+            uint8_t parity;
+            uint8_t parity_type;
+            uint8_t fc_type;
+            uint8_t xon_char;
+            uint8_t xoff_char;
+            uint16_t param_mask;
         } rpn;
         struct
         {
-            UINT8 dlci;
-            UINT8 line_status;
+            uint8_t dlci;
+            uint8_t line_status;
         } rls;
     } u;
 } MX_FRAME;
@@ -222,9 +222,9 @@
     MX_FRAME  rx_frame;
     tL2CAP_APPL_INFO  reg_info;              /* L2CAP Registration info */
     tRFC_MCB *p_rfc_lcid_mcb[MAX_L2CAP_CHANNELS];     /* MCB based on the L2CAP's lcid */
-    BOOLEAN   peer_rx_disabled;              /* If TRUE peer sent FCOFF */
-    UINT8     last_mux;                      /* Last mux allocated */
-    UINT8     last_port;                     /* Last port allocated */
+    bool      peer_rx_disabled;              /* If true peer sent FCOFF */
+    uint8_t   last_mux;                      /* Last mux allocated */
+    uint8_t   last_port;                     /* Last port allocated */
 } tRFCOMM_CB;
 
 /* Main Control Block for the RFCOMM Layer (PORT and RFC) */
@@ -232,11 +232,11 @@
 {
     tRFCOMM_CB  rfc;
     tPORT_CB    port;
-    UINT8       trace_level;
+    uint8_t     trace_level;
 } tRFC_CB;
 
 
-#if RFC_DYNAMIC_MEMORY == FALSE
+#if (RFC_DYNAMIC_MEMORY == FALSE)
 extern tRFC_CB  rfc_cb;
 #else
 extern tRFC_CB *rfc_cb_ptr;
@@ -268,7 +268,7 @@
 
 #else
 
-extern  UINT8 rfc_calc_fcs (UINT16 len, UINT8 *p);
+extern  uint8_t rfc_calc_fcs (uint16_t len, uint8_t *p);
 
 #define RFCOMM_SABME_FCS(p_data, cr, dlci) rfc_calc_fcs(3, p_data)
 #define RFCOMM_UA_FCS(p_data, cr, dlci)    rfc_calc_fcs(3, p_data)
@@ -278,66 +278,66 @@
 
 #endif
 
-extern void rfc_mx_sm_execute (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
+extern void rfc_mx_sm_execute (tRFC_MCB *p_mcb, uint16_t event, void *p_data);
 
 /*
 ** Functions provided by the rfc_port_fsm.c
 */
-extern void rfc_port_sm_execute (tPORT *p_port, UINT16 event, void *p_data);
+extern void rfc_port_sm_execute (tPORT *p_port, uint16_t event, void *p_data);
 
 
-extern void rfc_process_pn (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command, MX_FRAME *p_frame);
-extern void rfc_process_msc (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command, MX_FRAME *p_frame);
-extern void rfc_process_rpn (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command, BOOLEAN is_request, MX_FRAME *p_frame);
-extern void rfc_process_rls (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command, MX_FRAME *p_frame);
+extern void rfc_process_pn (tRFC_MCB *p_rfc_mcb, bool    is_command, MX_FRAME *p_frame);
+extern void rfc_process_msc (tRFC_MCB *p_rfc_mcb, bool    is_command, MX_FRAME *p_frame);
+extern void rfc_process_rpn (tRFC_MCB *p_rfc_mcb, bool    is_command, bool    is_request, MX_FRAME *p_frame);
+extern void rfc_process_rls (tRFC_MCB *p_rfc_mcb, bool    is_command, MX_FRAME *p_frame);
 extern void rfc_process_nsc (tRFC_MCB *p_rfc_mcb, MX_FRAME *p_frame);
 extern void rfc_process_test_rsp (tRFC_MCB *p_rfc_mcb, BT_HDR *p_buf);
-extern void rfc_process_fcon (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command);
-extern void rfc_process_fcoff (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command);
-extern void rfc_process_l2cap_congestion (tRFC_MCB *p_mcb, BOOLEAN is_congested);
+extern void rfc_process_fcon (tRFC_MCB *p_rfc_mcb, bool    is_command);
+extern void rfc_process_fcoff (tRFC_MCB *p_rfc_mcb, bool    is_command);
+extern void rfc_process_l2cap_congestion (tRFC_MCB *p_mcb, bool    is_congested);
 
 /*
 ** Functions provided by the rfc_utils.c
 */
-tRFC_MCB  *rfc_alloc_multiplexer_channel (BD_ADDR bd_addr, BOOLEAN is_initiator);
+tRFC_MCB  *rfc_alloc_multiplexer_channel (BD_ADDR bd_addr, bool    is_initiator);
 extern void      rfc_release_multiplexer_channel (tRFC_MCB *p_rfc_mcb);
-extern void      rfc_timer_start (tRFC_MCB *p_rfc_mcb, UINT16 timeout);
+extern void      rfc_timer_start (tRFC_MCB *p_rfc_mcb, uint16_t timeout);
 extern void      rfc_timer_stop (tRFC_MCB *p_rfc_mcb);
-extern void      rfc_port_timer_start (tPORT *p_port, UINT16 tout);
+extern void      rfc_port_timer_start (tPORT *p_port, uint16_t tout);
 extern void      rfc_port_timer_stop (tPORT *p_port);
 
-BOOLEAN   rfc_check_uih_fcs (UINT8 dlci, UINT8 received_fcs);
-BOOLEAN   rfc_check_fcs (UINT16 len, UINT8 *p, UINT8 received_fcs);
-tRFC_MCB  *rfc_find_lcid_mcb (UINT16 lcid);
-extern void      rfc_save_lcid_mcb (tRFC_MCB *p_rfc_mcb, UINT16 lcid);
+bool      rfc_check_uih_fcs (uint8_t dlci, uint8_t received_fcs);
+bool      rfc_check_fcs (uint16_t len, uint8_t *p, uint8_t received_fcs);
+tRFC_MCB  *rfc_find_lcid_mcb (uint16_t lcid);
+extern void      rfc_save_lcid_mcb (tRFC_MCB *p_rfc_mcb, uint16_t lcid);
 extern void      rfc_check_mcb_active (tRFC_MCB *p_mcb);
 extern void      rfc_port_closed (tPORT *p_port);
-extern void      rfc_sec_check_complete (BD_ADDR bd_addr, tBT_TRANSPORT transport,void *p_ref_data, UINT8 res);
-extern void      rfc_inc_credit (tPORT *p_port, UINT8 credit);
+extern void      rfc_sec_check_complete (BD_ADDR bd_addr, tBT_TRANSPORT transport,void *p_ref_data, uint8_t res);
+extern void      rfc_inc_credit (tPORT *p_port, uint8_t credit);
 extern void      rfc_dec_credit (tPORT *p_port);
 extern void      rfc_check_send_cmd(tRFC_MCB *p_mcb, BT_HDR *p_buf);
 
 /*
 ** Functions provided by the rfc_ts_frames.c
 */
-extern void     rfc_send_sabme (tRFC_MCB *p_rfc_mcb, UINT8 dlci);
-extern void     rfc_send_ua (tRFC_MCB *p_rfc_mcb, UINT8 dlci);
-extern void     rfc_send_dm (tRFC_MCB *p_rfc_mcb, UINT8 dlci, BOOLEAN pf);
-extern void     rfc_send_disc (tRFC_MCB *p_rfc_mcb, UINT8 dlci);
-extern void     rfc_send_pn (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command, UINT16 mtu,
-                             UINT8 cl, UINT8 k);
-extern void     rfc_send_test (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command, BT_HDR *p_buf);
-extern void     rfc_send_msc (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command,
+extern void     rfc_send_sabme (tRFC_MCB *p_rfc_mcb, uint8_t dlci);
+extern void     rfc_send_ua (tRFC_MCB *p_rfc_mcb, uint8_t dlci);
+extern void     rfc_send_dm (tRFC_MCB *p_rfc_mcb, uint8_t dlci, bool    pf);
+extern void     rfc_send_disc (tRFC_MCB *p_rfc_mcb, uint8_t dlci);
+extern void     rfc_send_pn (tRFC_MCB *p_mcb, uint8_t dlci, bool    is_command, uint16_t mtu,
+                             uint8_t cl, uint8_t k);
+extern void     rfc_send_test (tRFC_MCB *p_rfc_mcb, bool    is_command, BT_HDR *p_buf);
+extern void     rfc_send_msc (tRFC_MCB *p_mcb, uint8_t dlci, bool    is_command,
                               tPORT_CTRL *p_pars);
-extern void     rfc_send_rls (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command, UINT8 status);
-extern void     rfc_send_rpn (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command,
-                              tPORT_STATE *p_pars, UINT16 mask);
-extern void     rfc_send_fcon (tRFC_MCB *p_mcb, BOOLEAN is_command);
-extern void     rfc_send_fcoff (tRFC_MCB *p_mcb, BOOLEAN is_command);
-extern void     rfc_send_buf_uih (tRFC_MCB *p_rfc_mcb, UINT8 dlci, BT_HDR *p_buf);
-extern void     rfc_send_credit(tRFC_MCB *p_mcb, UINT8 dlci, UINT8 credit);
+extern void     rfc_send_rls (tRFC_MCB *p_mcb, uint8_t dlci, bool    is_command, uint8_t status);
+extern void     rfc_send_rpn (tRFC_MCB *p_mcb, uint8_t dlci, bool    is_command,
+                              tPORT_STATE *p_pars, uint16_t mask);
+extern void     rfc_send_fcon (tRFC_MCB *p_mcb, bool    is_command);
+extern void     rfc_send_fcoff (tRFC_MCB *p_mcb, bool    is_command);
+extern void     rfc_send_buf_uih (tRFC_MCB *p_rfc_mcb, uint8_t dlci, BT_HDR *p_buf);
+extern void     rfc_send_credit(tRFC_MCB *p_mcb, uint8_t dlci, uint8_t credit);
 extern void     rfc_process_mx_message (tRFC_MCB *p_rfc_mcb, BT_HDR *p_buf);
-extern UINT8    rfc_parse_data (tRFC_MCB *p_rfc_mcb, MX_FRAME *p_frame, BT_HDR *p_buf);
+extern uint8_t  rfc_parse_data (tRFC_MCB *p_rfc_mcb, MX_FRAME *p_frame, BT_HDR *p_buf);
 
 /*
 ** Functions provided by the rfc_disp.c
@@ -349,32 +349,32 @@
 extern void rfcomm_l2cap_if_init (void);
 
 extern void PORT_StartInd (tRFC_MCB *p_mcb);
-extern void PORT_StartCnf (tRFC_MCB *p_mcb, UINT16 result);
+extern void PORT_StartCnf (tRFC_MCB *p_mcb, uint16_t result);
 
 extern void PORT_CloseInd (tRFC_MCB *p_mcb);
 extern void Port_TimeOutCloseMux (tRFC_MCB *p_mcb);
 
-extern void PORT_DlcEstablishInd (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu);
-extern void PORT_DlcEstablishCnf (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT16 result);
+extern void PORT_DlcEstablishInd (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu);
+extern void PORT_DlcEstablishCnf (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu, uint16_t result);
 
-extern void PORT_DataInd (tRFC_MCB *p_mcb, UINT8 dlci, BT_HDR *p_buf);
+extern void PORT_DataInd (tRFC_MCB *p_mcb, uint8_t dlci, BT_HDR *p_buf);
 
-extern void PORT_DlcReleaseInd (tRFC_MCB *p_mcb, UINT8 dlci);
+extern void PORT_DlcReleaseInd (tRFC_MCB *p_mcb, uint8_t dlci);
 
-extern void PORT_ParNegInd (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT8 cl, UINT8 k);
-extern void PORT_ParNegCnf (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT8 cl, UINT8 k);
+extern void PORT_ParNegInd (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu, uint8_t cl, uint8_t k);
+extern void PORT_ParNegCnf (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu, uint8_t cl, uint8_t k);
 
-extern void PORT_TestCnf (tRFC_MCB *p_mcb, UINT8 *p_data, UINT16 len);
+extern void PORT_TestCnf (tRFC_MCB *p_mcb, uint8_t *p_data, uint16_t len);
 
-extern void PORT_FlowInd (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN fc);
+extern void PORT_FlowInd (tRFC_MCB *p_mcb, uint8_t dlci, bool    fc);
 
-extern void PORT_PortNegInd (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars, UINT16 param_mask);
-extern void PORT_PortNegCnf (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars, UINT16 result);
+extern void PORT_PortNegInd (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_STATE *p_pars, uint16_t param_mask);
+extern void PORT_PortNegCnf (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_STATE *p_pars, uint16_t result);
 
-extern void PORT_ControlInd (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars);
-extern void PORT_ControlCnf (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars);
+extern void PORT_ControlInd (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_CTRL *p_pars);
+extern void PORT_ControlCnf (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_CTRL *p_pars);
 
-extern void PORT_LineStatusInd (tRFC_MCB *p_mcb, UINT8 dlci, UINT8 line_status);
+extern void PORT_LineStatusInd (tRFC_MCB *p_mcb, uint8_t dlci, uint8_t line_status);
 
 #ifdef __cplusplus
 }
diff --git a/stack/rfcomm/rfc_l2cap_if.c b/stack/rfcomm/rfc_l2cap_if.c
index 05f4994..2e65468 100644
--- a/stack/rfcomm/rfc_l2cap_if.c
+++ b/stack/rfcomm/rfc_l2cap_if.c
@@ -40,14 +40,14 @@
 /*
 ** Define Callback functions to be called by L2CAP
 */
-static void RFCOMM_ConnectInd (BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id);
-static void RFCOMM_ConnectCnf (UINT16  lcid, UINT16 err);
-static void RFCOMM_ConfigInd (UINT16 lcid, tL2CAP_CFG_INFO *p_cfg);
-static void RFCOMM_ConfigCnf (UINT16 lcid, tL2CAP_CFG_INFO *p_cfg);
-static void RFCOMM_DisconnectInd (UINT16 lcid, BOOLEAN is_clear);
+static void RFCOMM_ConnectInd (BD_ADDR bd_addr, uint16_t lcid, uint16_t psm, uint8_t id);
+static void RFCOMM_ConnectCnf (uint16_t lcid, uint16_t err);
+static void RFCOMM_ConfigInd (uint16_t lcid, tL2CAP_CFG_INFO *p_cfg);
+static void RFCOMM_ConfigCnf (uint16_t lcid, tL2CAP_CFG_INFO *p_cfg);
+static void RFCOMM_DisconnectInd (uint16_t lcid, bool    is_clear);
 static void RFCOMM_QoSViolationInd (BD_ADDR bd_addr);
-static void RFCOMM_BufDataInd (UINT16 lcid, BT_HDR *p_buf);
-static void RFCOMM_CongestionStatusInd (UINT16 lcid, BOOLEAN is_congested);
+static void RFCOMM_BufDataInd (uint16_t lcid, BT_HDR *p_buf);
+static void RFCOMM_CongestionStatusInd (uint16_t lcid, bool    is_congested);
 
 
 /*******************************************************************************
@@ -88,9 +88,9 @@
 **                  and dispatch the event to it.
 **
 *******************************************************************************/
-void RFCOMM_ConnectInd (BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
+void RFCOMM_ConnectInd (BD_ADDR bd_addr, uint16_t lcid, uint16_t psm, uint8_t id)
 {
-    tRFC_MCB *p_mcb = rfc_alloc_multiplexer_channel(bd_addr, FALSE);
+    tRFC_MCB *p_mcb = rfc_alloc_multiplexer_channel(bd_addr, false);
     UNUSED(psm);
 
     if ((p_mcb)&&(p_mcb->state != RFC_MX_STATE_IDLE))
@@ -107,7 +107,7 @@
             RFCOMM_TRACE_DEBUG ("RFCOMM_ConnectInd start timer for collision, initiator's LCID(0x%x), acceptor's LCID(0x%x)",
                                   p_mcb->lcid, p_mcb->pending_lcid);
 
-            rfc_timer_start(p_mcb, (UINT16)(time_get_os_boottime_ms() % 10 + 2));
+            rfc_timer_start(p_mcb, (uint16_t)(time_get_os_boottime_ms() % 10 + 2));
             return;
         }
         else
@@ -143,7 +143,7 @@
 **                  event to the FSM.
 **
 *******************************************************************************/
-void RFCOMM_ConnectCnf (UINT16 lcid, UINT16 result)
+void RFCOMM_ConnectCnf (uint16_t lcid, uint16_t result)
 {
     tRFC_MCB *p_mcb = rfc_find_lcid_mcb (lcid);
 
@@ -158,8 +158,8 @@
         /* if peer rejects our connect request but peer's connect request is pending */
         if (result != L2CAP_CONN_OK )
         {
-            UINT16 i;
-            UINT8  idx;
+            uint16_t i;
+            uint8_t idx;
 
             RFCOMM_TRACE_DEBUG ("RFCOMM_ConnectCnf retry as acceptor on pending LCID(0x%x)", p_mcb->pending_lcid);
 
@@ -167,7 +167,7 @@
             rfc_save_lcid_mcb (NULL, p_mcb->lcid);
 
             p_mcb->lcid         = p_mcb->pending_lcid;
-            p_mcb->is_initiator = FALSE;
+            p_mcb->is_initiator = false;
             p_mcb->state        = RFC_MX_STATE_IDLE;
 
             /* store mcb into mapping table */
@@ -215,7 +215,7 @@
 **                  block and dispatch event to the FSM.
 **
 *******************************************************************************/
-void RFCOMM_ConfigInd (UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
+void RFCOMM_ConfigInd (uint16_t lcid, tL2CAP_CFG_INFO *p_cfg)
 {
     tRFC_MCB *p_mcb = rfc_find_lcid_mcb (lcid);
 
@@ -238,7 +238,7 @@
 **                  event to the FSM.
 **
 *******************************************************************************/
-void RFCOMM_ConfigCnf (UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
+void RFCOMM_ConfigCnf (uint16_t lcid, tL2CAP_CFG_INFO *p_cfg)
 {
     tRFC_MCB *p_mcb = rfc_find_lcid_mcb (lcid);
 
@@ -274,7 +274,7 @@
 **                  L2CA_DisconnectInd received.  Dispatch event to the FSM.
 **
 *******************************************************************************/
-void RFCOMM_DisconnectInd (UINT16 lcid, BOOLEAN is_conf_needed)
+void RFCOMM_DisconnectInd (uint16_t lcid, bool    is_conf_needed)
 {
     tRFC_MCB *p_mcb = rfc_find_lcid_mcb (lcid);
 
@@ -303,11 +303,11 @@
 **                  state machine depending on the frame destination.
 **
 *******************************************************************************/
-void RFCOMM_BufDataInd (UINT16 lcid, BT_HDR *p_buf)
+void RFCOMM_BufDataInd (uint16_t lcid, BT_HDR *p_buf)
 {
     tRFC_MCB *p_mcb = rfc_find_lcid_mcb (lcid);
     tPORT    *p_port;
-    UINT8    event;
+    uint8_t  event;
 
 
     if (!p_mcb)
@@ -357,7 +357,7 @@
 
         if ((p_port = port_find_dlci_port (rfc_cb.rfc.rx_frame.dlci)) == NULL)
         {
-            rfc_send_dm (p_mcb, rfc_cb.rfc.rx_frame.dlci, TRUE);
+            rfc_send_dm (p_mcb, rfc_cb.rfc.rx_frame.dlci, true);
             osi_free(p_buf);
             return;
         }
@@ -390,7 +390,7 @@
 **                  data RFCOMM L2CAP congestion status changes
 **
 *******************************************************************************/
-void RFCOMM_CongestionStatusInd (UINT16 lcid, BOOLEAN is_congested)
+void RFCOMM_CongestionStatusInd (uint16_t lcid, bool    is_congested)
 {
     tRFC_MCB *p_mcb = rfc_find_lcid_mcb (lcid);
 
@@ -413,7 +413,7 @@
 ** Description      This function returns MCB block supporting local cid
 **
 *******************************************************************************/
-tRFC_MCB *rfc_find_lcid_mcb (UINT16 lcid)
+tRFC_MCB *rfc_find_lcid_mcb (uint16_t lcid)
 {
     tRFC_MCB *p_mcb;
 
@@ -444,7 +444,7 @@
 ** Description      This function returns MCB block supporting local cid
 **
 *******************************************************************************/
-void rfc_save_lcid_mcb(tRFC_MCB *p_mcb, UINT16 lcid)
+void rfc_save_lcid_mcb(tRFC_MCB *p_mcb, uint16_t lcid)
 {
     if (lcid < L2CAP_BASE_APPL_CID)
         return;
diff --git a/stack/rfcomm/rfc_mx_fsm.c b/stack/rfcomm/rfc_mx_fsm.c
index a12ae96..26bd8b7 100644
--- a/stack/rfcomm/rfc_mx_fsm.c
+++ b/stack/rfcomm/rfc_mx_fsm.c
@@ -40,13 +40,13 @@
 /********************************************************************************/
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
-static void rfc_mx_sm_state_idle (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
-static void rfc_mx_sm_state_wait_conn_cnf (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
-static void rfc_mx_sm_state_configure (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
-static void rfc_mx_sm_sabme_wait_ua (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
-static void rfc_mx_sm_state_wait_sabme (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
-static void rfc_mx_sm_state_connected (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
-static void rfc_mx_sm_state_disc_wait_ua (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
+static void rfc_mx_sm_state_idle (tRFC_MCB *p_mcb, uint16_t event, void *p_data);
+static void rfc_mx_sm_state_wait_conn_cnf (tRFC_MCB *p_mcb, uint16_t event, void *p_data);
+static void rfc_mx_sm_state_configure (tRFC_MCB *p_mcb, uint16_t event, void *p_data);
+static void rfc_mx_sm_sabme_wait_ua (tRFC_MCB *p_mcb, uint16_t event, void *p_data);
+static void rfc_mx_sm_state_wait_sabme (tRFC_MCB *p_mcb, uint16_t event, void *p_data);
+static void rfc_mx_sm_state_connected (tRFC_MCB *p_mcb, uint16_t event, void *p_data);
+static void rfc_mx_sm_state_disc_wait_ua (tRFC_MCB *p_mcb, uint16_t event, void *p_data);
 
 static void rfc_mx_send_config_req (tRFC_MCB *p_mcb);
 static void rfc_mx_conf_ind (tRFC_MCB *p_mcb, tL2CAP_CFG_INFO *p_cfg);
@@ -64,7 +64,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_mx_sm_execute (tRFC_MCB *p_mcb, UINT16 event, void *p_data)
+void rfc_mx_sm_execute (tRFC_MCB *p_mcb, uint16_t event, void *p_data)
 {
     switch (p_mcb->state)
     {
@@ -111,7 +111,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_mx_sm_state_idle (tRFC_MCB *p_mcb, UINT16 event, void *p_data)
+void rfc_mx_sm_state_idle (tRFC_MCB *p_mcb, uint16_t event, void *p_data)
 {
     RFCOMM_TRACE_EVENT ("rfc_mx_sm_state_idle - evt:%d", event);
     switch (event)
@@ -121,7 +121,7 @@
         /* Initialize L2CAP MTU */
         p_mcb->peer_l2cap_mtu = L2CAP_DEFAULT_MTU - RFCOMM_MIN_OFFSET - 1;
 
-        UINT16 lcid = L2CA_ConnectReq(BT_PSM_RFCOMM, p_mcb->bd_addr);
+        uint16_t lcid = L2CA_ConnectReq(BT_PSM_RFCOMM, p_mcb->bd_addr);
         if (lcid == 0) {
             rfc_save_lcid_mcb(NULL, p_mcb->lcid);
             p_mcb->lcid = 0;
@@ -145,7 +145,7 @@
     case RFC_MX_EVENT_CONN_IND:
 
         rfc_timer_start (p_mcb, RFCOMM_CONN_TIMEOUT);
-        L2CA_ConnectRsp (p_mcb->bd_addr, *((UINT8 *)p_data), p_mcb->lcid, L2CAP_CONN_OK, 0);
+        L2CA_ConnectRsp (p_mcb->bd_addr, *((uint8_t *)p_data), p_mcb->lcid, L2CAP_CONN_OK, 0);
 
         rfc_mx_send_config_req (p_mcb);
 
@@ -160,11 +160,11 @@
         return;
 
     case RFC_EVENT_DISC:
-        rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, TRUE);
+        rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, true);
         return;
 
     case RFC_EVENT_UIH:
-        rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, FALSE);
+        rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, false);
         return;
     }
     RFCOMM_TRACE_EVENT ("RFCOMM MX ignored - evt:%d in state:%d", event, p_mcb->state);
@@ -181,7 +181,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_mx_sm_state_wait_conn_cnf (tRFC_MCB *p_mcb, UINT16 event, void *p_data)
+void rfc_mx_sm_state_wait_conn_cnf (tRFC_MCB *p_mcb, uint16_t event, void *p_data)
 {
     RFCOMM_TRACE_EVENT ("rfc_mx_sm_state_wait_conn_cnf - evt:%d", event);
     switch (event)
@@ -197,11 +197,11 @@
         return;
 
     case RFC_MX_EVENT_CONN_CNF:
-        if (*((UINT16 *)p_data) != L2CAP_SUCCESS)
+        if (*((uint16_t *)p_data) != L2CAP_SUCCESS)
         {
             p_mcb->state = RFC_MX_STATE_IDLE;
 
-            PORT_StartCnf (p_mcb, *((UINT16 *)p_data));
+            PORT_StartCnf (p_mcb, *((uint16_t *)p_data));
             return;
         }
         p_mcb->state = RFC_MX_STATE_CONFIGURE;
@@ -220,8 +220,8 @@
         /* we gave up outgoing connection request then try peer's request */
         if (p_mcb->pending_lcid)
         {
-            UINT16 i;
-            UINT8  idx;
+            uint16_t i;
+            uint8_t idx;
 
             RFCOMM_TRACE_DEBUG ("RFCOMM MX retry as acceptor in collision case - evt:%d in state:%d", event, p_mcb->state);
 
@@ -229,7 +229,7 @@
             p_mcb->lcid = p_mcb->pending_lcid;
             rfc_save_lcid_mcb (p_mcb, p_mcb->lcid);
 
-            p_mcb->is_initiator = FALSE;
+            p_mcb->is_initiator = false;
 
             /* update direction bit */
             for (i = 0; i < RFCOMM_MAX_DLCI; i += 2)
@@ -265,7 +265,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_mx_sm_state_configure (tRFC_MCB *p_mcb, UINT16 event, void *p_data)
+void rfc_mx_sm_state_configure (tRFC_MCB *p_mcb, uint16_t event, void *p_data)
 {
     RFCOMM_TRACE_EVENT ("rfc_mx_sm_state_configure - evt:%d", event);
     switch (event)
@@ -310,7 +310,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_mx_sm_sabme_wait_ua (tRFC_MCB *p_mcb, UINT16 event, void *p_data)
+void rfc_mx_sm_sabme_wait_ua (tRFC_MCB *p_mcb, uint16_t event, void *p_data)
 {
     UNUSED(p_data);
 
@@ -342,7 +342,7 @@
         rfc_timer_stop (p_mcb);
 
         p_mcb->state      = RFC_MX_STATE_CONNECTED;
-        p_mcb->peer_ready = TRUE;
+        p_mcb->peer_ready = true;
 
         PORT_StartCnf (p_mcb, RFCOMM_SUCCESS);
         return;
@@ -373,7 +373,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_mx_sm_state_wait_sabme (tRFC_MCB *p_mcb, UINT16 event, void *p_data)
+void rfc_mx_sm_state_wait_sabme (tRFC_MCB *p_mcb, uint16_t event, void *p_data)
 {
     RFCOMM_TRACE_EVENT ("rfc_mx_sm_state_wait_sabme - evt:%d", event);
     switch (event)
@@ -393,7 +393,7 @@
 
             rfc_timer_stop (p_mcb);
             p_mcb->state      = RFC_MX_STATE_CONNECTED;
-            p_mcb->peer_ready = TRUE;
+            p_mcb->peer_ready = true;
 
             /* MX channel collision has been resolved, continue to open ports */
             PORT_StartCnf (p_mcb, RFCOMM_SUCCESS);
@@ -406,14 +406,14 @@
         return;
 
     case RFC_MX_EVENT_START_RSP:
-        if (*((UINT16 *)p_data) != RFCOMM_SUCCESS)
-            rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, TRUE);
+        if (*((uint16_t *)p_data) != RFCOMM_SUCCESS)
+            rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, true);
         else
         {
             rfc_send_ua (p_mcb, RFCOMM_MX_DLCI);
 
             p_mcb->state      = RFC_MX_STATE_CONNECTED;
-            p_mcb->peer_ready = TRUE;
+            p_mcb->peer_ready = true;
             PORT_StartCnf (p_mcb, RFCOMM_SUCCESS);
         }
         return;
@@ -441,7 +441,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_mx_sm_state_connected (tRFC_MCB *p_mcb, UINT16 event, void *p_data)
+void rfc_mx_sm_state_connected (tRFC_MCB *p_mcb, uint16_t event, void *p_data)
 {
     UNUSED(p_data);
 
@@ -487,7 +487,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_mx_sm_state_disc_wait_ua (tRFC_MCB *p_mcb, UINT16 event, void *p_data)
+void rfc_mx_sm_state_disc_wait_ua (tRFC_MCB *p_mcb, uint16_t event, void *p_data)
 {
     BT_HDR *p_buf;
 
@@ -502,7 +502,7 @@
         if (p_mcb->restart_required)
         {
             /* Start Request was received while disconnecting.  Execute it again */
-            UINT16 lcid = L2CA_ConnectReq(BT_PSM_RFCOMM, p_mcb->bd_addr);
+            uint16_t lcid = L2CA_ConnectReq(BT_PSM_RFCOMM, p_mcb->bd_addr);
             if (lcid == 0) {
                 rfc_save_lcid_mcb(NULL, p_mcb->lcid);
                 p_mcb->lcid = 0;
@@ -519,10 +519,10 @@
 
             rfc_timer_start (p_mcb, RFC_MCB_INIT_INACT_TIMER);
 
-            p_mcb->is_initiator     = TRUE;
-            p_mcb->restart_required = FALSE;
-            p_mcb->local_cfg_sent   = FALSE;
-            p_mcb->peer_cfg_rcvd    = FALSE;
+            p_mcb->is_initiator     = true;
+            p_mcb->restart_required = false;
+            p_mcb->local_cfg_sent   = false;
+            p_mcb->peer_cfg_rcvd    = false;
 
             p_mcb->state = RFC_MX_STATE_WAIT_CONN_CNF;
             return;
@@ -536,11 +536,11 @@
 
     case RFC_EVENT_UIH:
         osi_free(p_data);
-        rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, FALSE);
+        rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, false);
         return;
 
     case RFC_MX_EVENT_START_REQ:
-        p_mcb->restart_required = TRUE;
+        p_mcb->restart_required = true;
         return;
 
     case RFC_MX_EVENT_DISC_IND:
@@ -574,16 +574,16 @@
 
     memset (&cfg, 0, sizeof (tL2CAP_CFG_INFO));
 
-    cfg.mtu_present      = TRUE;
+    cfg.mtu_present      = true;
     cfg.mtu              = L2CAP_MTU_SIZE;
 
 /* Defaults set by memset
-    cfg.flush_to_present = FALSE;
-    cfg.qos_present      = FALSE;
-    cfg.fcr_present      = FALSE;
+    cfg.flush_to_present = false;
+    cfg.qos_present      = false;
+    cfg.fcr_present      = false;
     cfg.fcr.mode         = L2CAP_FCR_BASIC_MODE;
-    cfg.fcs_present      = FALSE;
-    cfg.fcs              = N/A when fcs_present is FALSE;
+    cfg.fcs_present      = false;
+    cfg.fcs              = N/A when fcs_present is false;
 */
     L2CA_ConfigReq (p_mcb->lcid, &cfg);
 }
@@ -614,7 +614,7 @@
         return;
     }
 
-    p_mcb->local_cfg_sent = TRUE;
+    p_mcb->local_cfg_sent = true;
     if ((p_mcb->state == RFC_MX_STATE_CONFIGURE) && p_mcb->peer_cfg_rcvd)
     {
         if (p_mcb->is_initiator)
@@ -651,15 +651,15 @@
     else
         p_mcb->peer_l2cap_mtu = L2CAP_DEFAULT_MTU - RFCOMM_MIN_OFFSET - 1;
 
-    p_cfg->mtu_present      = FALSE;
-    p_cfg->flush_to_present = FALSE;
-    p_cfg->qos_present      = FALSE;
+    p_cfg->mtu_present      = false;
+    p_cfg->flush_to_present = false;
+    p_cfg->qos_present      = false;
 
     p_cfg->result = L2CAP_CFG_OK;
 
     L2CA_ConfigRsp (p_mcb->lcid, p_cfg);
 
-    p_mcb->peer_cfg_rcvd = TRUE;
+    p_mcb->peer_cfg_rcvd = true;
     if ((p_mcb->state == RFC_MX_STATE_CONFIGURE) && p_mcb->local_cfg_sent)
     {
         if (p_mcb->is_initiator)
diff --git a/stack/rfcomm/rfc_port_fsm.c b/stack/rfcomm/rfc_port_fsm.c
index 5f9e48c..89b56be 100644
--- a/stack/rfcomm/rfc_port_fsm.c
+++ b/stack/rfcomm/rfc_port_fsm.c
@@ -36,12 +36,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 rfc_port_sm_state_closed (tPORT *p_port, UINT16 event, void *p_data);
-static void rfc_port_sm_sabme_wait_ua (tPORT *p_port, UINT16 event, void *p_data);
-static void rfc_port_sm_opened (tPORT *p_port, UINT16 event, void *p_data);
-static void rfc_port_sm_orig_wait_sec_check (tPORT *p_port, UINT16 event, void *p_data);
-static void rfc_port_sm_term_wait_sec_check (tPORT *p_port, UINT16 event, void *p_data);
-static void rfc_port_sm_disc_wait_ua (tPORT *p_port, UINT16 event, void *p_data);
+static void rfc_port_sm_state_closed (tPORT *p_port, uint16_t event, void *p_data);
+static void rfc_port_sm_sabme_wait_ua (tPORT *p_port, uint16_t event, void *p_data);
+static void rfc_port_sm_opened (tPORT *p_port, uint16_t event, void *p_data);
+static void rfc_port_sm_orig_wait_sec_check (tPORT *p_port, uint16_t event, void *p_data);
+static void rfc_port_sm_term_wait_sec_check (tPORT *p_port, uint16_t event, void *p_data);
+static void rfc_port_sm_disc_wait_ua (tPORT *p_port, uint16_t event, void *p_data);
 
 static void rfc_port_uplink_data (tPORT *p_port, BT_HDR *p_buf);
 
@@ -58,7 +58,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_port_sm_execute (tPORT *p_port, UINT16 event, void *p_data)
+void rfc_port_sm_execute (tPORT *p_port, uint16_t event, void *p_data)
 {
     if (!p_port)
     {
@@ -106,14 +106,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_port_sm_state_closed (tPORT *p_port, UINT16 event, void *p_data)
+void rfc_port_sm_state_closed (tPORT *p_port, uint16_t event, void *p_data)
 {
     switch (event)
     {
     case RFC_EVENT_OPEN:
         p_port->rfc.state = RFC_STATE_ORIG_WAIT_SEC_CHECK;
-        btm_sec_mx_access_request (p_port->rfc.p_mcb->bd_addr, BT_PSM_RFCOMM, TRUE,
-                                   BTM_SEC_PROTO_RFCOMM, (UINT32)(p_port->dlci / 2),
+        btm_sec_mx_access_request (p_port->rfc.p_mcb->bd_addr, BT_PSM_RFCOMM, true,
+                                   BTM_SEC_PROTO_RFCOMM, (uint32_t)(p_port->dlci / 2),
                                    &rfc_sec_check_complete, p_port);
         return;
 
@@ -133,8 +133,8 @@
 
         /* Open will be continued after security checks are passed */
         p_port->rfc.state = RFC_STATE_TERM_WAIT_SEC_CHECK;
-        btm_sec_mx_access_request (p_port->rfc.p_mcb->bd_addr, BT_PSM_RFCOMM, FALSE,
-                                   BTM_SEC_PROTO_RFCOMM, (UINT32)(p_port->dlci / 2),
+        btm_sec_mx_access_request (p_port->rfc.p_mcb->bd_addr, BT_PSM_RFCOMM, false,
+                                   BTM_SEC_PROTO_RFCOMM, (uint32_t)(p_port->dlci / 2),
                                    &rfc_sec_check_complete, p_port);
         return;
 
@@ -147,11 +147,11 @@
 
     case RFC_EVENT_UIH:
         osi_free(p_data);
-        rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, FALSE);
+        rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, false);
         return;
 
     case RFC_EVENT_DISC:
-        rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, FALSE);
+        rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, false);
         return;
 
     case RFC_EVENT_TIMEOUT:
@@ -174,7 +174,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_port_sm_sabme_wait_ua (tPORT *p_port, UINT16 event, void *p_data)
+void rfc_port_sm_sabme_wait_ua (tPORT *p_port, uint16_t event, void *p_data)
 {
     switch (event)
     {
@@ -205,7 +205,7 @@
         return;
 
     case RFC_EVENT_DM:
-        p_port->rfc.p_mcb->is_disc_initiator = TRUE;
+        p_port->rfc.p_mcb->is_disc_initiator = true;
         PORT_DlcEstablishCnf (p_port->rfc.p_mcb, p_port->dlci, p_port->rfc.p_mcb->peer_l2cap_mtu, RFCOMM_ERROR);
         rfc_port_closed (p_port);
         return;
@@ -246,19 +246,19 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_port_sm_term_wait_sec_check (tPORT *p_port, UINT16 event, void *p_data)
+void rfc_port_sm_term_wait_sec_check (tPORT *p_port, uint16_t event, void *p_data)
 {
     switch (event)
     {
     case RFC_EVENT_SEC_COMPLETE:
-        if (*((UINT8 *)p_data) != BTM_SUCCESS)
+        if (*((uint8_t *)p_data) != BTM_SUCCESS)
         {
             /* Authentication/authorization failed.  If link is still  */
             /* up send DM and check if we need to start inactive timer */
             if (p_port->rfc.p_mcb)
             {
-                rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, TRUE);
-                p_port->rfc.p_mcb->is_disc_initiator = TRUE;
+                rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, true);
+                p_port->rfc.p_mcb->is_disc_initiator = true;
                 port_rfc_closed (p_port, PORT_SEC_FAILED);
             }
         }
@@ -300,10 +300,10 @@
         return;
 
     case RFC_EVENT_ESTABLISH_RSP:
-        if (*((UINT8 *)p_data) != RFCOMM_SUCCESS)
+        if (*((uint8_t *)p_data) != RFCOMM_SUCCESS)
         {
             if (p_port->rfc.p_mcb)
-                rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, TRUE);
+                rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, true);
         }
         else
         {
@@ -327,14 +327,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_port_sm_orig_wait_sec_check (tPORT *p_port, UINT16 event, void *p_data)
+void rfc_port_sm_orig_wait_sec_check (tPORT *p_port, uint16_t event, void *p_data)
 {
     switch (event)
     {
     case RFC_EVENT_SEC_COMPLETE:
-        if (*((UINT8 *)p_data) != BTM_SUCCESS)
+        if (*((uint8_t *)p_data) != BTM_SUCCESS)
         {
-            p_port->rfc.p_mcb->is_disc_initiator = TRUE;
+            p_port->rfc.p_mcb->is_disc_initiator = true;
             PORT_DlcEstablishCnf (p_port->rfc.p_mcb, p_port->dlci, 0, RFCOMM_SECURITY_ERR);
             rfc_port_closed (p_port);
             return;
@@ -377,7 +377,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_port_sm_opened (tPORT *p_port, UINT16 event, void *p_data)
+void rfc_port_sm_opened (tPORT *p_port, uint16_t event, void *p_data)
 {
     switch (event)
     {
@@ -405,7 +405,7 @@
          && (!p_port->rx.user_fc)
          && (p_port->credit_rx_max > p_port->credit_rx))
         {
-            ((BT_HDR *)p_data)->layer_specific = (UINT8) (p_port->credit_rx_max - p_port->credit_rx);
+            ((BT_HDR *)p_data)->layer_specific = (uint8_t) (p_port->credit_rx_max - p_port->credit_rx);
             p_port->credit_rx = p_port->credit_rx_max;
         }
         else
@@ -464,7 +464,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_port_sm_disc_wait_ua (tPORT *p_port, UINT16 event, void *p_data)
+void rfc_port_sm_disc_wait_ua (tPORT *p_port, uint16_t event, void *p_data)
 {
     switch (event)
     {
@@ -482,7 +482,7 @@
         return;
 
     case RFC_EVENT_UA:
-        p_port->rfc.p_mcb->is_disc_initiator = TRUE;
+        p_port->rfc.p_mcb->is_disc_initiator = true;
         /* Case falls through */
 
    case RFC_EVENT_DM:
@@ -490,16 +490,16 @@
         return;
 
     case RFC_EVENT_SABME:
-        rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, TRUE);
+        rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, true);
         return;
 
     case RFC_EVENT_DISC:
-        rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, TRUE);
+        rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, true);
         return;
 
     case RFC_EVENT_UIH:
         osi_free(p_data);
-        rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, FALSE);
+        rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, false);
         return;
 
     case RFC_EVENT_TIMEOUT:
@@ -532,10 +532,10 @@
 **                  Record MTU and pass indication to the upper layer.
 **
 *******************************************************************************/
-void rfc_process_pn (tRFC_MCB *p_mcb, BOOLEAN is_command, MX_FRAME *p_frame)
+void rfc_process_pn (tRFC_MCB *p_mcb, bool    is_command, MX_FRAME *p_frame)
 {
     tPORT *p_port;
-    UINT8 dlci = p_frame->dlci;
+    uint8_t dlci = p_frame->dlci;
 
     if (is_command)
     {
@@ -547,7 +547,7 @@
         }
         else
         {
-            rfc_send_dm(p_mcb, dlci, FALSE);
+            rfc_send_dm(p_mcb, dlci, false);
             RFCOMM_TRACE_WARNING("***** MX PN while disconnecting *****");
         }
 
@@ -575,8 +575,8 @@
 **                  command/response.  Pass command to the user.
 **
 *******************************************************************************/
-void rfc_process_rpn (tRFC_MCB *p_mcb, BOOLEAN is_command,
-                      BOOLEAN is_request, MX_FRAME *p_frame)
+void rfc_process_rpn (tRFC_MCB *p_mcb, bool    is_command,
+                      bool    is_request, MX_FRAME *p_frame)
 {
     tPORT_STATE port_pars;
     tPORT       *p_port;
@@ -599,7 +599,7 @@
     {
         /* This is the special situation when peer just request local pars */
         port_pars = p_port->peer_port_pars;
-        rfc_send_rpn (p_mcb, p_frame->dlci, FALSE, &p_port->peer_port_pars, 0);
+        rfc_send_rpn (p_mcb, p_frame->dlci, false, &p_port->peer_port_pars, 0);
         return;
     }
 
@@ -640,7 +640,7 @@
             p_port->peer_port_pars.fc_type = (RFCOMM_FC_RTR_ON_INPUT | RFCOMM_FC_RTR_ON_OUTPUT);
 
             p_port->rfc.expected_rsp |= RFC_RSP_RPN;
-            rfc_send_rpn (p_mcb, p_frame->dlci, TRUE, &p_port->peer_port_pars,
+            rfc_send_rpn (p_mcb, p_frame->dlci, true, &p_port->peer_port_pars,
                           RFCOMM_RPN_PM_RTR_ON_INPUT | RFCOMM_RPN_PM_RTR_ON_OUTPUT);
             rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;
             return;
@@ -669,7 +669,7 @@
 
         p_port->rfc.expected_rsp |= RFC_RSP_RPN;
 
-        rfc_send_rpn (p_mcb, p_frame->dlci, TRUE, &p_port->peer_port_pars,
+        rfc_send_rpn (p_mcb, p_frame->dlci, true, &p_port->peer_port_pars,
                       RFCOMM_RPN_PM_RTC_ON_INPUT | RFCOMM_RPN_PM_RTC_ON_OUTPUT);
         rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;
         return;
@@ -692,12 +692,12 @@
 **                  Pass command to the user.
 **
 *******************************************************************************/
-void rfc_process_msc (tRFC_MCB *p_mcb, BOOLEAN is_command, MX_FRAME *p_frame)
+void rfc_process_msc (tRFC_MCB *p_mcb, bool    is_command, MX_FRAME *p_frame)
 {
     tPORT_CTRL pars;
     tPORT      *p_port;
-    UINT8      modem_signals = p_frame->u.msc.signals;
-    BOOLEAN    new_peer_fc = FALSE;
+    uint8_t    modem_signals = p_frame->u.msc.signals;
+    bool       new_peer_fc = false;
 
     p_port = port_find_mcb_dlci_port (p_mcb, p_frame->dlci);
     if (p_port == NULL)
@@ -727,7 +727,7 @@
     /* Check if this command is passed only to indicate flow control */
     if (is_command)
     {
-        rfc_send_msc (p_mcb, p_frame->dlci, FALSE, &pars);
+        rfc_send_msc (p_mcb, p_frame->dlci, false, &pars);
 
         if (p_port->rfc.p_mcb->flow != PORT_FC_CREDIT)
         {
@@ -735,7 +735,7 @@
             p_port->peer_ctrl.fc = new_peer_fc = pars.fc;
 
             if (new_peer_fc != p_port->tx.peer_fc)
-                PORT_FlowInd (p_mcb, p_frame->dlci, (BOOLEAN)!new_peer_fc);
+                PORT_FlowInd (p_mcb, p_frame->dlci, (bool   )!new_peer_fc);
         }
 
         PORT_ControlInd (p_mcb, p_frame->dlci, &pars);
@@ -763,14 +763,14 @@
 **                  Pass command to the user.
 **
 *******************************************************************************/
-void rfc_process_rls (tRFC_MCB *p_mcb, BOOLEAN is_command, MX_FRAME *p_frame)
+void rfc_process_rls (tRFC_MCB *p_mcb, bool    is_command, MX_FRAME *p_frame)
 {
     tPORT *p_port;
 
     if (is_command)
     {
         PORT_LineStatusInd (p_mcb, p_frame->dlci, p_frame->u.rls.line_status);
-        rfc_send_rls (p_mcb, p_frame->dlci, FALSE, p_frame->u.rls.line_status);
+        rfc_send_rls (p_mcb, p_frame->dlci, false, p_frame->u.rls.line_status);
     }
     else
     {
@@ -823,16 +823,16 @@
 **                  to receive new information
 **
 *******************************************************************************/
-void rfc_process_fcon (tRFC_MCB *p_mcb, BOOLEAN is_command)
+void rfc_process_fcon (tRFC_MCB *p_mcb, bool    is_command)
 {
     if (is_command)
     {
-        rfc_cb.rfc.peer_rx_disabled = FALSE;
+        rfc_cb.rfc.peer_rx_disabled = false;
 
-        rfc_send_fcon (p_mcb, FALSE);
+        rfc_send_fcon (p_mcb, false);
 
         if (!p_mcb->l2cap_congested)
-            PORT_FlowInd (p_mcb, 0, TRUE);
+            PORT_FlowInd (p_mcb, 0, true);
     }
 }
 
@@ -844,16 +844,16 @@
 **                  to receive new information
 **
 *******************************************************************************/
-void rfc_process_fcoff (tRFC_MCB *p_mcb, BOOLEAN is_command)
+void rfc_process_fcoff (tRFC_MCB *p_mcb, bool    is_command)
 {
     if (is_command)
     {
-        rfc_cb.rfc.peer_rx_disabled = TRUE;
+        rfc_cb.rfc.peer_rx_disabled = true;
 
         if (!p_mcb->l2cap_congested)
-            PORT_FlowInd (p_mcb, 0, FALSE);
+            PORT_FlowInd (p_mcb, 0, false);
 
-        rfc_send_fcoff (p_mcb, FALSE);
+        rfc_send_fcoff (p_mcb, false);
     }
 }
 
@@ -865,7 +865,7 @@
 ** Description      This function handles L2CAP congestion messages
 **
 *******************************************************************************/
-void rfc_process_l2cap_congestion (tRFC_MCB *p_mcb, BOOLEAN is_congested)
+void rfc_process_l2cap_congestion (tRFC_MCB *p_mcb, bool    is_congested)
 {
     p_mcb->l2cap_congested = is_congested;
 
@@ -877,9 +877,9 @@
     if (!rfc_cb.rfc.peer_rx_disabled)
     {
         if (!is_congested)
-            PORT_FlowInd (p_mcb, 0, TRUE);
+            PORT_FlowInd (p_mcb, 0, true);
         else
-            PORT_FlowInd (p_mcb, 0, FALSE);
+            PORT_FlowInd (p_mcb, 0, false);
     }
 }
 
diff --git a/stack/rfcomm/rfc_port_if.c b/stack/rfcomm/rfc_port_if.c
index d2ef9b2..1056c2b 100644
--- a/stack/rfcomm/rfc_port_if.c
+++ b/stack/rfcomm/rfc_port_if.c
@@ -33,7 +33,7 @@
 #include "rfc_int.h"
 #include "bt_utils.h"
 
-#if RFC_DYNAMIC_MEMORY == FALSE
+#if (RFC_DYNAMIC_MEMORY == FALSE)
 tRFC_CB rfc_cb;
 #endif
 
@@ -62,7 +62,7 @@
 **                  in the control block and dispatch event to the FSM.
 **
 *******************************************************************************/
-void RFCOMM_StartRsp (tRFC_MCB *p_mcb, UINT16 result)
+void RFCOMM_StartRsp (tRFC_MCB *p_mcb, uint16_t result)
 {
     rfc_mx_sm_execute (p_mcb, RFC_MX_EVENT_START_RSP, &result);
 }
@@ -79,7 +79,7 @@
 **                  machine.
 **
 *******************************************************************************/
-void RFCOMM_DlcEstablishReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu)
+void RFCOMM_DlcEstablishReq (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu)
 {
     UNUSED(mtu);
     if (p_mcb->state != RFC_MX_STATE_CONNECTED)
@@ -107,7 +107,7 @@
 **                  acks Establish Indication.
 **
 *******************************************************************************/
-void RFCOMM_DlcEstablishRsp (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT16 result)
+void RFCOMM_DlcEstablishRsp (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu, uint16_t result)
 {
     UNUSED(mtu);
     if ((p_mcb->state != RFC_MX_STATE_CONNECTED) && (result == RFCOMM_SUCCESS))
@@ -137,11 +137,11 @@
 **                  block.
 **
 *******************************************************************************/
-void RFCOMM_ParNegReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu)
+void RFCOMM_ParNegReq (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu)
 {
-    UINT8 flow;
-    UINT8 cl;
-    UINT8 k;
+    uint8_t flow;
+    uint8_t cl;
+    uint8_t k;
 
     tPORT *p_port = port_find_mcb_dlci_port(p_mcb, dlci);
     if (p_port == NULL) {
@@ -177,7 +177,7 @@
     /* Send Parameter Negotiation Command UIH frame */
     p_port->rfc.expected_rsp |= RFC_RSP_PN;
 
-    rfc_send_pn (p_mcb, dlci, TRUE, mtu, cl, k);
+    rfc_send_pn (p_mcb, dlci, true, mtu, cl, k);
 
     rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;
 }
@@ -191,13 +191,13 @@
 **                  DLC parameter negotiation.
 **
 *******************************************************************************/
-void RFCOMM_ParNegRsp (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT8 cl, UINT8 k)
+void RFCOMM_ParNegRsp (tRFC_MCB *p_mcb, uint8_t dlci, uint16_t mtu, uint8_t cl, uint8_t k)
 {
     if (p_mcb->state != RFC_MX_STATE_CONNECTED)
         return;
 
     /* Send Parameter Negotiation Response UIH frame */
-    rfc_send_pn (p_mcb, dlci, FALSE, mtu, cl, k);
+    rfc_send_pn (p_mcb, dlci, false, mtu, cl, k);
 }
 
 
@@ -212,7 +212,7 @@
 **                  control block.
 **
 *******************************************************************************/
-void RFCOMM_PortNegReq (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars)
+void RFCOMM_PortNegReq (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_STATE *p_pars)
 {
     if (p_mcb->state != RFC_MX_STATE_CONNECTED)
     {
@@ -233,7 +233,7 @@
     else
         p_port->rfc.expected_rsp |= RFC_RSP_RPN;
 
-    rfc_send_rpn (p_mcb, dlci, TRUE, p_pars, RFCOMM_RPN_PM_MASK);
+    rfc_send_rpn (p_mcb, dlci, true, p_pars, RFCOMM_RPN_PM_MASK);
     rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;
 
 }
@@ -247,13 +247,13 @@
 **                  Port parameters negotiation.
 **
 *******************************************************************************/
-void RFCOMM_PortNegRsp (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars,
-                        UINT16 param_mask)
+void RFCOMM_PortNegRsp (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_STATE *p_pars,
+                        uint16_t param_mask)
 {
     if (p_mcb->state != RFC_MX_STATE_CONNECTED)
         return;
 
-   rfc_send_rpn (p_mcb, dlci, FALSE, p_pars, param_mask);
+   rfc_send_rpn (p_mcb, dlci, false, p_pars, param_mask);
 }
 
 
@@ -265,7 +265,7 @@
 **                  parameters to remote port emulation entity.
 **
 *******************************************************************************/
-void RFCOMM_ControlReq (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars)
+void RFCOMM_ControlReq (tRFC_MCB *p_mcb, uint8_t dlci, tPORT_CTRL *p_pars)
 {
     tPORT *p_port = port_find_mcb_dlci_port(p_mcb, dlci);
     if (p_port == NULL) {
@@ -282,7 +282,7 @@
 
     p_port->rfc.expected_rsp |= RFC_RSP_MSC;
 
-    rfc_send_msc (p_mcb, dlci, TRUE, p_pars);
+    rfc_send_msc (p_mcb, dlci, true, p_pars);
     rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;
 
 }
@@ -297,7 +297,7 @@
 **                  port can accept more data.
 **
 *******************************************************************************/
-void RFCOMM_FlowReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT8 enable)
+void RFCOMM_FlowReq (tRFC_MCB *p_mcb, uint8_t dlci, uint8_t enable)
 {
     tPORT *p_port = port_find_mcb_dlci_port(p_mcb, dlci);
     if (p_port == NULL) {
@@ -314,7 +314,7 @@
 
     p_port->rfc.expected_rsp |= RFC_RSP_MSC;
 
-    rfc_send_msc (p_mcb, dlci, TRUE, &p_port->local_ctrl);
+    rfc_send_msc (p_mcb, dlci, true, &p_port->local_ctrl);
     rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;
 
 }
@@ -328,7 +328,7 @@
 **                  status should be delivered to the peer.
 **
 *******************************************************************************/
-void RFCOMM_LineStatusReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT8 status)
+void RFCOMM_LineStatusReq (tRFC_MCB *p_mcb, uint8_t dlci, uint8_t status)
 {
     tPORT *p_port = port_find_mcb_dlci_port(p_mcb, dlci);
     if (p_port == NULL) {
@@ -343,7 +343,7 @@
 
     p_port->rfc.expected_rsp |= RFC_RSP_RLS;
 
-    rfc_send_rls (p_mcb, dlci, TRUE, status);
+    rfc_send_rls (p_mcb, dlci, true, status);
     rfc_port_timer_start (p_port, RFC_T2_TIMEOUT);
 }
 
@@ -355,7 +355,7 @@
 ** Description      This function is called by the PORT unit to close DLC
 **
 *******************************************************************************/
-void RFCOMM_DlcReleaseReq (tRFC_MCB *p_mcb, UINT8 dlci)
+void RFCOMM_DlcReleaseReq (tRFC_MCB *p_mcb, uint8_t dlci)
 {
     rfc_port_sm_execute(port_find_mcb_dlci_port (p_mcb, dlci), RFC_EVENT_CLOSE, 0);
 }
@@ -368,7 +368,7 @@
 ** Description      This function is called by the user app to send data buffer
 **
 *******************************************************************************/
-void RFCOMM_DataReq (tRFC_MCB *p_mcb, UINT8 dlci, BT_HDR *p_buf)
+void RFCOMM_DataReq (tRFC_MCB *p_mcb, uint8_t dlci, BT_HDR *p_buf)
 {
     rfc_port_sm_execute(port_find_mcb_dlci_port (p_mcb, dlci), RFC_EVENT_DATA, p_buf);
 }
diff --git a/stack/rfcomm/rfc_ts_frames.c b/stack/rfcomm/rfc_ts_frames.c
index 739469f..9e07936 100644
--- a/stack/rfcomm/rfc_ts_frames.c
+++ b/stack/rfcomm/rfc_ts_frames.c
@@ -38,21 +38,21 @@
 ** Description      This function sends SABME frame.
 **
 *******************************************************************************/
-void rfc_send_sabme (tRFC_MCB *p_mcb, UINT8 dlci)
+void rfc_send_sabme (tRFC_MCB *p_mcb, uint8_t dlci)
 {
-    UINT8   *p_data;
-    UINT8   cr = RFCOMM_CR(p_mcb->is_initiator, TRUE);
+    uint8_t *p_data;
+    uint8_t cr = RFCOMM_CR(p_mcb->is_initiator, true);
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p_data = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p_data = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* SABME frame, command, PF = 1, dlci */
     *p_data++ = RFCOMM_EA | cr | (dlci << RFCOMM_SHIFT_DLCI);
     *p_data++ = RFCOMM_SABME | RFCOMM_PF;
     *p_data++ = RFCOMM_EA | 0;
 
-    *p_data   = RFCOMM_SABME_FCS ((UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET, cr, dlci);
+    *p_data   = RFCOMM_SABME_FCS ((uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET, cr, dlci);
 
     p_buf->len = 4;
 
@@ -67,21 +67,21 @@
 ** Description      This function sends UA frame.
 **
 *******************************************************************************/
-void rfc_send_ua (tRFC_MCB *p_mcb, UINT8 dlci)
+void rfc_send_ua (tRFC_MCB *p_mcb, uint8_t dlci)
 {
-    UINT8   *p_data;
-    UINT8   cr = RFCOMM_CR(p_mcb->is_initiator, FALSE);
+    uint8_t *p_data;
+    uint8_t cr = RFCOMM_CR(p_mcb->is_initiator, false);
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p_data = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p_data = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* ua frame, response, PF = 1, dlci */
     *p_data++ = RFCOMM_EA | cr | (dlci << RFCOMM_SHIFT_DLCI);
     *p_data++ = RFCOMM_UA | RFCOMM_PF;
     *p_data++ = RFCOMM_EA | 0;
 
-    *p_data   = RFCOMM_UA_FCS ((UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET, cr, dlci);
+    *p_data   = RFCOMM_UA_FCS ((uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET, cr, dlci);
 
     p_buf->len = 4;
 
@@ -96,21 +96,21 @@
 ** Description      This function sends DM frame.
 **
 *******************************************************************************/
-void rfc_send_dm (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN pf)
+void rfc_send_dm (tRFC_MCB *p_mcb, uint8_t dlci, bool    pf)
 {
-    UINT8   *p_data;
-    UINT8   cr = RFCOMM_CR(p_mcb->is_initiator, FALSE);
+    uint8_t *p_data;
+    uint8_t cr = RFCOMM_CR(p_mcb->is_initiator, false);
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p_data = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p_data = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* DM frame, response, PF = 1, dlci */
     *p_data++ = RFCOMM_EA | cr | (dlci << RFCOMM_SHIFT_DLCI);
     *p_data++ = RFCOMM_DM | ((pf) ? RFCOMM_PF : 0);
     *p_data++ = RFCOMM_EA | 0;
 
-    *p_data   = RFCOMM_DM_FCS ((UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET, cr, dlci);
+    *p_data   = RFCOMM_DM_FCS ((uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET, cr, dlci);
 
     p_buf->len = 4;
 
@@ -125,21 +125,21 @@
 ** Description      This function sends DISC frame.
 **
 *******************************************************************************/
-void rfc_send_disc (tRFC_MCB *p_mcb, UINT8 dlci)
+void rfc_send_disc (tRFC_MCB *p_mcb, uint8_t dlci)
 {
-    UINT8   *p_data;
-    UINT8   cr = RFCOMM_CR(p_mcb->is_initiator, TRUE);
+    uint8_t *p_data;
+    uint8_t cr = RFCOMM_CR(p_mcb->is_initiator, true);
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p_data = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p_data = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* DISC frame, command, PF = 1, dlci */
     *p_data++ = RFCOMM_EA | cr | (dlci << RFCOMM_SHIFT_DLCI);
     *p_data++ = RFCOMM_DISC | RFCOMM_PF;
     *p_data++ = RFCOMM_EA | 0;
 
-    *p_data   = RFCOMM_DISC_FCS ((UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET, cr, dlci);
+    *p_data   = RFCOMM_DISC_FCS ((uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET, cr, dlci);
 
     p_buf->len = 4;
 
@@ -154,25 +154,25 @@
 ** Description      This function sends UIH frame.
 **
 *******************************************************************************/
-void rfc_send_buf_uih (tRFC_MCB *p_mcb, UINT8 dlci, BT_HDR *p_buf)
+void rfc_send_buf_uih (tRFC_MCB *p_mcb, uint8_t dlci, BT_HDR *p_buf)
 {
-    UINT8   *p_data;
-    UINT8   cr = RFCOMM_CR(p_mcb->is_initiator, TRUE);
-    UINT8   credits;
+    uint8_t *p_data;
+    uint8_t cr = RFCOMM_CR(p_mcb->is_initiator, true);
+    uint8_t credits;
 
     p_buf->offset -= RFCOMM_CTRL_FRAME_LEN;
     if (p_buf->len > 127)
         p_buf->offset--;
 
     if (dlci)
-        credits = (UINT8)p_buf->layer_specific;
+        credits = (uint8_t)p_buf->layer_specific;
     else
         credits = 0;
 
     if (credits)
         p_buf->offset--;
 
-    p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     /* UIH frame, command, PF = 0, dlci */
     *p_data++ = RFCOMM_EA | cr | (dlci << RFCOMM_SHIFT_DLCI);
@@ -195,9 +195,9 @@
         p_buf->len++;
     }
 
-    p_data  = (UINT8 *)(p_buf + 1) + p_buf->offset + p_buf->len++;
+    p_data  = (uint8_t *)(p_buf + 1) + p_buf->offset + p_buf->len++;
 
-    *p_data = RFCOMM_UIH_FCS ((UINT8 *)(p_buf + 1) + p_buf->offset, dlci);
+    *p_data = RFCOMM_UIH_FCS ((uint8_t *)(p_buf + 1) + p_buf->offset, dlci);
 
     if (dlci == RFCOMM_MX_DLCI)
     {
@@ -217,13 +217,13 @@
 ** Description      This function sends DLC Parameters Negotiation Frame.
 **
 *******************************************************************************/
-void rfc_send_pn (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command, UINT16 mtu, UINT8 cl, UINT8 k)
+void rfc_send_pn (tRFC_MCB *p_mcb, uint8_t dlci, bool    is_command, uint16_t mtu, uint8_t cl, uint8_t k)
 {
-    UINT8    *p_data;
+    uint8_t  *p_data;
     BT_HDR   *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     p_buf->offset = L2CAP_MIN_OFFSET + RFCOMM_CTRL_FRAME_LEN;
-    p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     *p_data++ = RFCOMM_EA | RFCOMM_I_CR(is_command) | RFCOMM_MX_PN;
     *p_data++ = RFCOMM_EA | (RFCOMM_MX_PN_LEN << 1);
@@ -259,13 +259,13 @@
 ** Description      This function sends Flow Control On Command.
 **
 *******************************************************************************/
-void rfc_send_fcon (tRFC_MCB *p_mcb, BOOLEAN is_command)
+void rfc_send_fcon (tRFC_MCB *p_mcb, bool    is_command)
 {
-    UINT8   *p_data;
+    uint8_t *p_data;
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     p_buf->offset = L2CAP_MIN_OFFSET + RFCOMM_CTRL_FRAME_LEN;
-    p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     *p_data++ = RFCOMM_EA | RFCOMM_I_CR(is_command) | RFCOMM_MX_FCON;
     *p_data++ = RFCOMM_EA | (RFCOMM_MX_FCON_LEN << 1);
@@ -284,13 +284,13 @@
 ** Description      This function sends Flow Control Off Command.
 **
 *******************************************************************************/
-void rfc_send_fcoff (tRFC_MCB *p_mcb, BOOLEAN is_command)
+void rfc_send_fcoff (tRFC_MCB *p_mcb, bool    is_command)
 {
-    UINT8   *p_data;
+    uint8_t *p_data;
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     p_buf->offset = L2CAP_MIN_OFFSET + RFCOMM_CTRL_FRAME_LEN;
-    p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     *p_data++ = RFCOMM_EA | RFCOMM_I_CR(is_command) | RFCOMM_MX_FCOFF;
     *p_data++ = RFCOMM_EA | (RFCOMM_MX_FCOFF_LEN << 1);
@@ -309,20 +309,20 @@
 ** Description      This function sends Modem Status Command Frame.
 **
 *******************************************************************************/
-void rfc_send_msc (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command,
+void rfc_send_msc (tRFC_MCB *p_mcb, uint8_t dlci, bool    is_command,
                    tPORT_CTRL *p_pars)
 {
-    UINT8   *p_data;
-    UINT8   signals;
-    UINT8   break_duration;
-    UINT8   len;
+    uint8_t *p_data;
+    uint8_t signals;
+    uint8_t break_duration;
+    uint8_t len;
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     signals        = p_pars->modem_signal;
     break_duration = p_pars->break_signal;
 
     p_buf->offset = L2CAP_MIN_OFFSET + RFCOMM_CTRL_FRAME_LEN;
-    p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     if (break_duration)
         len = RFCOMM_MX_MSC_LEN_WITH_BREAK;
@@ -360,13 +360,13 @@
 ** Description      This function sends Remote Line Status Command Frame.
 **
 *******************************************************************************/
-void rfc_send_rls (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command, UINT8 status)
+void rfc_send_rls (tRFC_MCB *p_mcb, uint8_t dlci, bool    is_command, uint8_t status)
 {
-    UINT8   *p_data;
+    uint8_t *p_data;
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     p_buf->offset = L2CAP_MIN_OFFSET + RFCOMM_CTRL_FRAME_LEN;
-    p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     *p_data++ = RFCOMM_EA | RFCOMM_I_CR(is_command) | RFCOMM_MX_RLS;
     *p_data++ = RFCOMM_EA | (RFCOMM_MX_RLS_LEN << 1);
@@ -390,13 +390,13 @@
 *******************************************************************************/
 void rfc_send_nsc (tRFC_MCB *p_mcb)
 {
-    UINT8   *p_data;
+    uint8_t *p_data;
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     p_buf->offset = L2CAP_MIN_OFFSET + RFCOMM_CTRL_FRAME_LEN;
-    p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
-    *p_data++ = RFCOMM_EA | RFCOMM_I_CR(FALSE) | RFCOMM_MX_NSC;
+    *p_data++ = RFCOMM_EA | RFCOMM_I_CR(false) | RFCOMM_MX_NSC;
     *p_data++ = RFCOMM_EA | (RFCOMM_MX_NSC_LEN << 1);
 
     *p_data++ =  rfc_cb.rfc.rx_frame.ea |
@@ -417,14 +417,14 @@
 ** Description      This function sends Remote Port Negotiation Command
 **
 *******************************************************************************/
-void rfc_send_rpn (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command,
-                   tPORT_STATE *p_pars, UINT16 mask)
+void rfc_send_rpn (tRFC_MCB *p_mcb, uint8_t dlci, bool    is_command,
+                   tPORT_STATE *p_pars, uint16_t mask)
 {
-    UINT8    *p_data;
+    uint8_t  *p_data;
     BT_HDR   *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     p_buf->offset = L2CAP_MIN_OFFSET + RFCOMM_CTRL_FRAME_LEN;
-    p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     *p_data++ = RFCOMM_EA | RFCOMM_I_CR(is_command) | RFCOMM_MX_RPN;
 
@@ -467,21 +467,21 @@
 ** Description      This function sends Test frame.
 **
 *******************************************************************************/
-void rfc_send_test (tRFC_MCB *p_mcb, BOOLEAN is_command, BT_HDR *p_buf)
+void rfc_send_test (tRFC_MCB *p_mcb, bool    is_command, BT_HDR *p_buf)
 {
     /* Shift buffer to give space for header */
     if (p_buf->offset < (L2CAP_MIN_OFFSET + RFCOMM_MIN_OFFSET + 2))
     {
-        UINT8 *p_src  = (UINT8 *) (p_buf + 1) + p_buf->offset + p_buf->len - 1;
+        uint8_t *p_src  = (uint8_t *) (p_buf + 1) + p_buf->offset + p_buf->len - 1;
         BT_HDR *p_new_buf = (BT_HDR *) osi_malloc(p_buf->len + (L2CAP_MIN_OFFSET +
                             RFCOMM_MIN_OFFSET + 2 + sizeof(BT_HDR) + 1));
 
         p_new_buf->offset = L2CAP_MIN_OFFSET + RFCOMM_MIN_OFFSET + 2;
         p_new_buf->len = p_buf->len;
 
-        UINT8 *p_dest = (UINT8 *) (p_new_buf + 1) + p_new_buf->offset + p_new_buf->len - 1;
+        uint8_t *p_dest = (uint8_t *) (p_new_buf + 1) + p_new_buf->offset + p_new_buf->len - 1;
 
-        for (UINT16 xx = 0; xx < p_buf->len; xx++)
+        for (uint16_t xx = 0; xx < p_buf->len; xx++)
             *p_dest-- = *p_src--;
 
         osi_free(p_buf);
@@ -490,7 +490,7 @@
 
     /* Adjust offset by number of bytes we are going to fill */
     p_buf->offset -= 2;
-    UINT8 *p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    uint8_t *p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     *p_data++ = RFCOMM_EA | RFCOMM_I_CR(is_command) | RFCOMM_MX_TEST;
     *p_data++ = RFCOMM_EA | (p_buf->len << 1);
@@ -507,20 +507,20 @@
 ** Description      This function sends a flow control credit in UIH frame.
 **
 *******************************************************************************/
-void rfc_send_credit(tRFC_MCB *p_mcb, UINT8 dlci, UINT8 credit)
+void rfc_send_credit(tRFC_MCB *p_mcb, uint8_t dlci, uint8_t credit)
 {
-    UINT8    *p_data;
-    UINT8    cr = RFCOMM_CR(p_mcb->is_initiator, TRUE);
+    uint8_t  *p_data;
+    uint8_t  cr = RFCOMM_CR(p_mcb->is_initiator, true);
     BT_HDR   *p_buf = (BT_HDR *)osi_malloc(RFCOMM_CMD_BUF_SIZE);
 
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     *p_data++ = RFCOMM_EA | cr | (dlci << RFCOMM_SHIFT_DLCI);
     *p_data++ = RFCOMM_UIH | RFCOMM_PF;
     *p_data++ = RFCOMM_EA | 0;
     *p_data++ = credit;
-    *p_data   = RFCOMM_UIH_FCS ((UINT8 *)(p_buf + 1) + p_buf->offset, dlci);
+    *p_data   = RFCOMM_UIH_FCS ((uint8_t *)(p_buf + 1) + p_buf->offset, dlci);
 
     p_buf->len = 5;
 
@@ -535,12 +535,12 @@
 ** Description      This function processes data packet received from L2CAP
 **
 *******************************************************************************/
-UINT8 rfc_parse_data (tRFC_MCB *p_mcb, MX_FRAME *p_frame, BT_HDR *p_buf)
+uint8_t rfc_parse_data (tRFC_MCB *p_mcb, MX_FRAME *p_frame, BT_HDR *p_buf)
 {
-    UINT8     ead, eal, fcs;
-    UINT8     *p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
-    UINT8     *p_start = p_data;
-    UINT16    len;
+    uint8_t   ead, eal, fcs;
+    uint8_t   *p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
+    uint8_t   *p_start = p_data;
+    uint16_t  len;
 
     if (p_buf->len < RFCOMM_CTRL_FRAME_LEN)
     {
@@ -664,11 +664,11 @@
 *******************************************************************************/
 void rfc_process_mx_message (tRFC_MCB *p_mcb, BT_HDR *p_buf)
 {
-    UINT8       *p_data = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    uint8_t     *p_data = (uint8_t *)(p_buf + 1) + p_buf->offset;
     MX_FRAME    *p_rx_frame = &rfc_cb.rfc.rx_frame;
-    UINT16       length  = p_buf->len;
-    UINT8        ea, cr, mx_len;
-    BOOLEAN      is_command;
+    uint16_t     length  = p_buf->len;
+    uint8_t      ea, cr, mx_len;
+    bool         is_command;
 
     p_rx_frame->ea   = *p_data & RFCOMM_EA;
     p_rx_frame->cr   = (*p_data & RFCOMM_CR_MASK) >> RFCOMM_SHIFT_CR;
@@ -744,7 +744,7 @@
         p_buf->len    -= 2;
 
         if (is_command)
-            rfc_send_test (p_mcb, FALSE, p_buf);
+            rfc_send_test (p_mcb, false, p_buf);
         else
             rfc_process_test_rsp (p_mcb, p_buf);
         return;
@@ -789,7 +789,7 @@
         }
         else
         {
-            p_rx_frame->u.msc.break_present  = FALSE;
+            p_rx_frame->u.msc.break_present  = false;
             p_rx_frame->u.msc.break_duration = 0;
         }
         osi_free(p_buf);
diff --git a/stack/rfcomm/rfc_utils.c b/stack/rfcomm/rfc_utils.c
index 2fa7ca8..3135e4d 100644
--- a/stack/rfcomm/rfc_utils.c
+++ b/stack/rfcomm/rfc_utils.c
@@ -46,7 +46,7 @@
 ** Description      Reversed CRC Table , 8-bit, poly=0x07
 **                  (GSM 07.10 TS 101 369 V6.3.0)
 *******************************************************************************/
-static const UINT8 rfc_crctable[] =
+static const uint8_t rfc_crctable[] =
 {
     0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75,  0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA, 0x7B,
     0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69,  0x12, 0x83, 0xF1, 0x60, 0x15, 0x84, 0xF6, 0x67,
@@ -81,9 +81,9 @@
 **                  p   - points to message
 **
 *******************************************************************************/
-UINT8 rfc_calc_fcs (UINT16 len, UINT8 *p)
+uint8_t rfc_calc_fcs (uint16_t len, uint8_t *p)
 {
-    UINT8  fcs = 0xFF;
+    uint8_t fcs = 0xFF;
 
     while (len--)
     {
@@ -107,9 +107,9 @@
 **                  received_fcs - received FCS
 **
 *******************************************************************************/
-BOOLEAN rfc_check_fcs (UINT16 len, UINT8 *p, UINT8 received_fcs)
+bool    rfc_check_fcs (uint16_t len, uint8_t *p, uint8_t received_fcs)
 {
-    UINT8  fcs = 0xFF;
+    uint8_t fcs = 0xFF;
 
     while (len--)
     {
@@ -132,7 +132,7 @@
 **                  the BD_ADDR.
 **
 *******************************************************************************/
-tRFC_MCB *rfc_alloc_multiplexer_channel (BD_ADDR bd_addr, BOOLEAN is_initiator)
+tRFC_MCB *rfc_alloc_multiplexer_channel (BD_ADDR bd_addr, bool    is_initiator)
 {
     int i, j;
     tRFC_MCB *p_mcb = NULL;
@@ -186,7 +186,7 @@
 
             rfc_timer_start (p_mcb, RFC_MCB_INIT_INACT_TIMER);
 
-            rfc_cb.rfc.last_mux = (UINT8) j;
+            rfc_cb.rfc.last_mux = (uint8_t) j;
             return (p_mcb);
         }
     }
@@ -229,7 +229,7 @@
 ** Description      Start RFC Timer
 **
 *******************************************************************************/
-void rfc_timer_start(tRFC_MCB *p_mcb, UINT16 timeout)
+void rfc_timer_start(tRFC_MCB *p_mcb, uint16_t timeout)
 {
     RFCOMM_TRACE_EVENT ("%s - timeout:%d seconds", __func__, timeout);
 
@@ -262,7 +262,7 @@
 ** Description      Start RFC Timer
 **
 *******************************************************************************/
-void rfc_port_timer_start(tPORT *p_port, UINT16 timeout)
+void rfc_port_timer_start(tPORT *p_port, uint16_t timeout)
 {
     RFCOMM_TRACE_EVENT("%s - timeout:%d seconds", __func__, timeout);
 
@@ -299,13 +299,13 @@
 *******************************************************************************/
 void rfc_check_mcb_active (tRFC_MCB *p_mcb)
 {
-    UINT16 i;
+    uint16_t i;
 
     for (i = 0; i < RFCOMM_MAX_DLCI; i++)
     {
         if (p_mcb->port_inx[i] != 0)
         {
-            p_mcb->is_disc_initiator = FALSE;
+            p_mcb->is_disc_initiator = false;
             return;
         }
     }
@@ -313,7 +313,7 @@
     /* On the server side start inactivity timer */
     if (p_mcb->is_disc_initiator)
     {
-        p_mcb->is_disc_initiator = FALSE;
+        p_mcb->is_disc_initiator = false;
         rfc_mx_sm_execute (p_mcb, RFC_MX_EVENT_CLOSE_REQ, NULL);
     }
     else
@@ -344,7 +344,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_sec_check_complete (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, UINT8 res)
+void rfc_sec_check_complete (BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_data, uint8_t res)
 {
     tPORT *p_port = (tPORT *)p_ref_data;
     UNUSED(bd_addr);
@@ -405,7 +405,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void rfc_inc_credit (tPORT *p_port, UINT8 credit)
+void rfc_inc_credit (tPORT *p_port, uint8_t credit)
 {
     if (p_port->rfc.p_mcb->flow == PORT_FC_CREDIT)
     {
@@ -413,8 +413,8 @@
 
         RFCOMM_TRACE_EVENT ("rfc_inc_credit:%d", p_port->credit_tx);
 
-        if (p_port->tx.peer_fc == TRUE)
-            PORT_FlowInd(p_port->rfc.p_mcb, p_port->dlci, TRUE);
+        if (p_port->tx.peer_fc == true)
+            PORT_FlowInd(p_port->rfc.p_mcb, p_port->dlci, true);
     }
 }
 
@@ -437,7 +437,7 @@
             p_port->credit_tx--;
 
         if (p_port->credit_tx == 0)
-            p_port->tx.peer_fc = TRUE;
+            p_port->tx.peer_fc = true;
     }
 }
 
@@ -465,7 +465,7 @@
     }
 
     /* handle queue if L2CAP not congested */
-    while (p_mcb->l2cap_congested == FALSE) {
+    while (p_mcb->l2cap_congested == false) {
         BT_HDR *p = (BT_HDR *)fixed_queue_try_dequeue(p_mcb->cmd_q);
         if (p == NULL)
             break;
diff --git a/stack/sdp/sdp_api.c b/stack/sdp/sdp_api.c
index f5033cf..f350b9d 100644
--- a/stack/sdp/sdp_api.c
+++ b/stack/sdp/sdp_api.c
@@ -59,16 +59,16 @@
 **                  p_attr_list - (input) list of attribute filters
 **
 **
-** Returns          BOOLEAN
-**                          TRUE if successful
-**                          FALSE if one or more parameters are bad
+** Returns          bool
+**                          true if successful
+**                          false if one or more parameters are bad
 **
 *******************************************************************************/
-BOOLEAN SDP_InitDiscoveryDb (tSDP_DISCOVERY_DB *p_db, UINT32 len, UINT16 num_uuid,
-                             tSDP_UUID *p_uuid_list, UINT16 num_attr, UINT16 *p_attr_list)
+bool    SDP_InitDiscoveryDb (tSDP_DISCOVERY_DB *p_db, uint32_t len, uint16_t num_uuid,
+                             tSDP_UUID *p_uuid_list, uint16_t num_attr, uint16_t *p_attr_list)
 {
-#if SDP_CLIENT_ENABLED == TRUE
-    UINT16  xx;
+#if (SDP_CLIENT_ENABLED == TRUE)
+    uint16_t xx;
 
     /* verify the parameters */
     if (p_db == NULL || (sizeof (tSDP_DISCOVERY_DB) > len) ||
@@ -77,7 +77,7 @@
         SDP_TRACE_ERROR("SDP_InitDiscoveryDb Illegal param: p_db 0x%x, len %d, num_uuid %d, num_attr %d",
                         PTR_TO_UINT(p_db), len, num_uuid, num_attr);
 
-        return(FALSE);
+        return(false);
     }
 
     memset (p_db, 0, (size_t)len);
@@ -85,7 +85,7 @@
     p_db->mem_size = len - sizeof (tSDP_DISCOVERY_DB);
     p_db->mem_free = p_db->mem_size;
     p_db->p_first_rec = NULL;
-    p_db->p_free_mem = (UINT8 *)(p_db + 1);
+    p_db->p_free_mem = (uint8_t *)(p_db + 1);
 
     for (xx = 0; xx < num_uuid; xx++)
         p_db->uuid_filters[xx] = *p_uuid_list++;
@@ -100,7 +100,7 @@
 
     p_db->num_attr_filters = num_attr;
 #endif
-    return(TRUE);
+    return(true);
 }
 
 
@@ -111,20 +111,20 @@
 **
 ** Description      This function cancels an active query to an SDP server.
 **
-** Returns          TRUE if discovery cancelled, FALSE if a matching activity is not found.
+** Returns          true if discovery cancelled, false if a matching activity is not found.
 **
 *******************************************************************************/
-BOOLEAN SDP_CancelServiceSearch (tSDP_DISCOVERY_DB *p_db)
+bool    SDP_CancelServiceSearch (tSDP_DISCOVERY_DB *p_db)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tCONN_CB     *p_ccb = sdpu_find_ccb_by_db (p_db);
     if (!p_ccb)
-        return(FALSE);
+        return(false);
 
     sdp_disconnect (p_ccb, SDP_CANCEL);
     p_ccb->disc_state = SDP_DISC_WAIT_CANCEL;
 #endif
-    return(TRUE);
+    return(true);
 }
 
 
@@ -135,28 +135,28 @@
 **
 ** Description      This function queries an SDP server for information.
 **
-** Returns          TRUE if discovery started, FALSE if failed.
+** Returns          true if discovery started, false if failed.
 **
 *******************************************************************************/
-BOOLEAN SDP_ServiceSearchRequest (UINT8 *p_bd_addr, tSDP_DISCOVERY_DB *p_db,
+bool    SDP_ServiceSearchRequest (uint8_t *p_bd_addr, tSDP_DISCOVERY_DB *p_db,
                                   tSDP_DISC_CMPL_CB *p_cb)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tCONN_CB     *p_ccb;
 
     /* Specific BD address */
     p_ccb = sdp_conn_originate (p_bd_addr);
 
     if (!p_ccb)
-        return(FALSE);
+        return(false);
 
     p_ccb->disc_state = SDP_DISC_WAIT_CONN;
     p_ccb->p_db       = p_db;
     p_ccb->p_cb       = p_cb;
 
-    return(TRUE);
+    return(true);
 #else
-    return(FALSE);
+    return(false);
 #endif
 }
 
@@ -172,30 +172,30 @@
 **                  combined ServiceSearchAttributeRequest SDP function.
 **                  (This is for Unplug Testing)
 **
-** Returns          TRUE if discovery started, FALSE if failed.
+** Returns          true if discovery started, false if failed.
 **
 *******************************************************************************/
-BOOLEAN SDP_ServiceSearchAttributeRequest (UINT8 *p_bd_addr, tSDP_DISCOVERY_DB *p_db,
+bool    SDP_ServiceSearchAttributeRequest (uint8_t *p_bd_addr, tSDP_DISCOVERY_DB *p_db,
                                            tSDP_DISC_CMPL_CB *p_cb)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tCONN_CB     *p_ccb;
 
     /* Specific BD address */
     p_ccb = sdp_conn_originate (p_bd_addr);
 
     if (!p_ccb)
-        return(FALSE);
+        return(false);
 
     p_ccb->disc_state = SDP_DISC_WAIT_CONN;
     p_ccb->p_db       = p_db;
     p_ccb->p_cb       = p_cb;
 
-    p_ccb->is_attr_search = TRUE;
+    p_ccb->is_attr_search = true;
 
-    return(TRUE);
+    return(true);
 #else
-    return(FALSE);
+    return(false);
 #endif
 }
 /*******************************************************************************
@@ -209,36 +209,36 @@
 **                  combined ServiceSearchAttributeRequest SDP function.
 **                  (This is for Unplug Testing)
 **
-** Returns          TRUE if discovery started, FALSE if failed.
+** Returns          true if discovery started, false if failed.
 **
 *******************************************************************************/
-BOOLEAN SDP_ServiceSearchAttributeRequest2 (UINT8 *p_bd_addr, tSDP_DISCOVERY_DB *p_db,
+bool    SDP_ServiceSearchAttributeRequest2 (uint8_t *p_bd_addr, tSDP_DISCOVERY_DB *p_db,
                                             tSDP_DISC_CMPL_CB2 *p_cb2, void * user_data)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tCONN_CB     *p_ccb;
 
     /* Specific BD address */
     p_ccb = sdp_conn_originate (p_bd_addr);
 
     if (!p_ccb)
-        return(FALSE);
+        return(false);
 
     p_ccb->disc_state = SDP_DISC_WAIT_CONN;
     p_ccb->p_db       = p_db;
     p_ccb->p_cb2       = p_cb2;
 
-    p_ccb->is_attr_search = TRUE;
+    p_ccb->is_attr_search = true;
     p_ccb->user_data = user_data;
 
-    return(TRUE);
+    return(true);
 #else
-    return(FALSE);
+    return(false);
 #endif
 }
 
-#if SDP_CLIENT_ENABLED == TRUE
-void SDP_SetIdleTimeout (BD_ADDR addr, UINT16 timeout)
+#if (SDP_CLIENT_ENABLED == TRUE)
+void SDP_SetIdleTimeout (BD_ADDR addr, uint16_t timeout)
 {
     UNUSED(addr);
     UNUSED(timeout);
@@ -257,10 +257,10 @@
 ** Returns          Pointer to matching record, or NULL
 **
 *******************************************************************************/
-tSDP_DISC_REC *SDP_FindAttributeInDb (tSDP_DISCOVERY_DB *p_db, UINT16 attr_id,
+tSDP_DISC_REC *SDP_FindAttributeInDb (tSDP_DISCOVERY_DB *p_db, uint16_t attr_id,
                                       tSDP_DISC_REC *p_start_rec)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tSDP_DISC_REC   *p_rec;
     tSDP_DISC_ATTR  *p_attr;
 
@@ -302,9 +302,9 @@
 ** Returns          Pointer to matching attribute entry, or NULL
 **
 *******************************************************************************/
-tSDP_DISC_ATTR *SDP_FindAttributeInRec (tSDP_DISC_REC *p_rec, UINT16 attr_id)
+tSDP_DISC_ATTR *SDP_FindAttributeInRec (tSDP_DISC_REC *p_rec, uint16_t attr_id)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tSDP_DISC_ATTR  *p_attr;
 
     p_attr = p_rec->p_first_attr;
@@ -330,12 +330,12 @@
 ** Parameters:      p_rec      - pointer to a SDP record.
 **                  p_uuid     - output parameter to save the UUID found.
 **
-** Returns          TRUE if found, otherwise FALSE.
+** Returns          true if found, otherwise false.
 **
 *******************************************************************************/
-BOOLEAN SDP_FindServiceUUIDInRec(tSDP_DISC_REC *p_rec, tBT_UUID * p_uuid)
+bool    SDP_FindServiceUUIDInRec(tSDP_DISC_REC *p_rec, tBT_UUID * p_uuid)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tSDP_DISC_ATTR  *p_attr, *p_sattr, *p_extra_sattr;
 
     p_attr = p_rec->p_first_attr;
@@ -366,7 +366,7 @@
                         p_uuid->uu.uuid32 = p_sattr->attr_value.v.u32;
                     }
 
-                    return(TRUE);
+                    return(true);
                 }
 
                 /* Checking for Toyota G Block Car Kit:
@@ -387,7 +387,7 @@
                             {
                                 p_uuid->len = 2;
                                 p_uuid->uu.uuid16 = p_extra_sattr->attr_value.v.u16;
-                                return(TRUE);
+                                return(true);
                             }
                         }
                     }
@@ -403,12 +403,12 @@
             {
                 p_uuid->len = 2;
                 p_uuid->uu.uuid16 = p_attr->attr_value.v.u16;
-                return(TRUE);
+                return(true);
             }
         }
         p_attr = p_attr->p_next_attr;
     }
-    return FALSE;
+    return false;
 #endif
 }
 
@@ -422,12 +422,12 @@
 ** Parameters:      p_rec      - pointer to a SDP record.
 **                  p_uuid     - output parameter to save the UUID found.
 **
-** Returns          TRUE if found, otherwise FALSE.
+** Returns          true if found, otherwise false.
 **
 *******************************************************************************/
-BOOLEAN SDP_FindServiceUUIDInRec_128bit(tSDP_DISC_REC *p_rec, tBT_UUID * p_uuid)
+bool    SDP_FindServiceUUIDInRec_128bit(tSDP_DISC_REC *p_rec, tBT_UUID * p_uuid)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tSDP_DISC_ATTR  *p_attr = p_rec->p_first_attr;
     while (p_attr)
     {
@@ -446,7 +446,7 @@
                         for (uint8_t i = 0; i != LEN_UUID_128; ++i)
                             p_uuid->uu.uuid128[i] = p_sattr->attr_value.v.array[LEN_UUID_128-i-1];
                     }
-                    return(TRUE);
+                    return(true);
                 }
 
                 p_sattr = p_sattr->p_next_attr;
@@ -462,12 +462,12 @@
                 p_uuid->len = LEN_UUID_128;
                 for (uint8_t i = 0; i != LEN_UUID_128; ++i)
                     p_uuid->uu.uuid128[i] = p_attr->attr_value.v.array[LEN_UUID_128-i-1];
-                return(TRUE);
+                return(true);
             }
         }
         p_attr = p_attr->p_next_attr;
     }
-    return FALSE;
+    return false;
 #endif
 }
 
@@ -483,9 +483,9 @@
 ** Returns          Pointer to record containing service class, or NULL
 **
 *******************************************************************************/
-tSDP_DISC_REC *SDP_FindServiceInDb (tSDP_DISCOVERY_DB *p_db, UINT16 service_uuid, tSDP_DISC_REC *p_start_rec)
+tSDP_DISC_REC *SDP_FindServiceInDb (tSDP_DISCOVERY_DB *p_db, uint16_t service_uuid, tSDP_DISC_REC *p_start_rec)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tSDP_DISC_REC   *p_rec;
     tSDP_DISC_ATTR  *p_attr, *p_sattr, *p_extra_sattr;
 
@@ -593,7 +593,7 @@
 *******************************************************************************/
 tSDP_DISC_REC *SDP_FindServiceInDb_128bit(tSDP_DISCOVERY_DB *p_db, tSDP_DISC_REC *p_start_rec)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tSDP_DISC_REC   *p_rec;
     tSDP_DISC_ATTR  *p_attr, *p_sattr;
 
@@ -659,7 +659,7 @@
 *******************************************************************************/
 tSDP_DISC_REC *SDP_FindServiceUUIDInDb (tSDP_DISCOVERY_DB *p_db, tBT_UUID *p_uuid, tSDP_DISC_REC *p_start_rec)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tSDP_DISC_REC   *p_rec;
     tSDP_DISC_ATTR  *p_attr, *p_sattr;
 
@@ -709,18 +709,18 @@
     return(NULL);
 }
 
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
 /*******************************************************************************
 **
 ** Function         sdp_fill_proto_elem
 **
 ** Description      This function retrieves the protocol element.
 **
-** Returns          TRUE if found, FALSE if not
+** Returns          true if found, false if not
 **                  If found, the passed protocol list element is filled in.
 **
 *******************************************************************************/
-static BOOLEAN sdp_fill_proto_elem( tSDP_DISC_ATTR  *p_attr, UINT16 layer_uuid,
+static bool    sdp_fill_proto_elem( tSDP_DISC_ATTR  *p_attr, uint16_t layer_uuid,
                                     tSDP_PROTOCOL_ELEM *p_elem)
 {
     tSDP_DISC_ATTR  *p_sattr;
@@ -730,7 +730,7 @@
     {
         /* Safety check - each entry should itself be a sequence */
         if (SDP_DISC_ATTR_TYPE(p_attr->attr_len_type) != DATA_ELE_SEQ_DESC_TYPE)
-            return(FALSE);
+            return(false);
 
         /* Now, see if the entry contains the layer we are interested in */
         for (p_sattr = p_attr->attr_value.v.p_sub_attr; p_sattr; p_sattr = p_sattr->p_next_attr)
@@ -760,12 +760,12 @@
                     if (p_elem->num_params >= SDP_MAX_PROTOCOL_PARAMS)
                         break;
                 }
-                return(TRUE);
+                return(true);
             }
         }
     }
 
-    return(FALSE);
+    return(false);
 }
 #endif  /* CLIENT_ENABLED == TRUE */
 
@@ -776,13 +776,13 @@
 ** Description      This function looks at a specific discovery record for a protocol
 **                  list element.
 **
-** Returns          TRUE if found, FALSE if not
+** Returns          true if found, false if not
 **                  If found, the passed protocol list element is filled in.
 **
 *******************************************************************************/
-BOOLEAN SDP_FindProtocolListElemInRec (tSDP_DISC_REC *p_rec, UINT16 layer_uuid, tSDP_PROTOCOL_ELEM *p_elem)
+bool    SDP_FindProtocolListElemInRec (tSDP_DISC_REC *p_rec, uint16_t layer_uuid, tSDP_PROTOCOL_ELEM *p_elem)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tSDP_DISC_ATTR  *p_attr;
 
     p_attr = p_rec->p_first_attr;
@@ -798,7 +798,7 @@
     }
 #endif
     /* If here, no match found */
-    return(FALSE);
+    return(false);
 }
 
 
@@ -809,15 +809,15 @@
 ** Description      This function looks at a specific discovery record for a protocol
 **                  list element.
 **
-** Returns          TRUE if found, FALSE if not
+** Returns          true if found, false if not
 **                  If found, the passed protocol list element is filled in.
 **
 *******************************************************************************/
-BOOLEAN SDP_FindAddProtoListsElemInRec (tSDP_DISC_REC *p_rec, UINT16 layer_uuid, tSDP_PROTOCOL_ELEM *p_elem)
+bool    SDP_FindAddProtoListsElemInRec (tSDP_DISC_REC *p_rec, uint16_t layer_uuid, tSDP_PROTOCOL_ELEM *p_elem)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tSDP_DISC_ATTR  *p_attr, *p_sattr;
-    BOOLEAN         ret = FALSE;
+    bool            ret = false;
 
     p_attr = p_rec->p_first_attr;
     while (p_attr)
@@ -831,7 +831,7 @@
                 /* Safety check - each entry should itself be a sequence */
                 if (SDP_DISC_ATTR_TYPE(p_sattr->attr_len_type) == DATA_ELE_SEQ_DESC_TYPE)
                 {
-                    if ( (ret = sdp_fill_proto_elem(p_sattr, layer_uuid, p_elem)) == TRUE)
+                    if ( (ret = sdp_fill_proto_elem(p_sattr, layer_uuid, p_elem)) == true)
                         break;
                 }
             }
@@ -841,7 +841,7 @@
     }
 #endif
     /* If here, no match found */
-    return(FALSE);
+    return(false);
 }
 
 
@@ -854,14 +854,14 @@
 **                  The version number consists of an 8-bit major version and
 **                  an 8-bit minor version.
 **
-** Returns          TRUE if found, FALSE if not
+** Returns          true if found, false if not
 **                  If found, the major and minor version numbers that were passed
 **                  in are filled in.
 **
 *******************************************************************************/
-BOOLEAN SDP_FindProfileVersionInRec (tSDP_DISC_REC *p_rec, UINT16 profile_uuid, UINT16 *p_version)
+bool    SDP_FindProfileVersionInRec (tSDP_DISC_REC *p_rec, uint16_t profile_uuid, uint16_t *p_version)
 {
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tSDP_DISC_ATTR  *p_attr, *p_sattr;
 
     p_attr = p_rec->p_first_attr;
@@ -876,7 +876,7 @@
             {
                 /* Safety check - each entry should itself be a sequence */
                 if (SDP_DISC_ATTR_TYPE(p_attr->attr_len_type) != DATA_ELE_SEQ_DESC_TYPE)
-                    return(FALSE);
+                    return(false);
 
                 /* Now, see if the entry contains the profile UUID we are interested in */
                 for (p_sattr = p_attr->attr_value.v.p_sub_attr; p_sattr; p_sattr = p_sattr->p_next_attr)
@@ -895,22 +895,22 @@
                             /* The high order 8 bits is the major number, low order is the minor number (big endian) */
                             *p_version = p_sattr->attr_value.v.u16;
 
-                            return(TRUE);
+                            return(true);
                         }
                         else
-                            return(FALSE);  /* The type and/or size was not valid for the profile list version */
+                            return(false);  /* The type and/or size was not valid for the profile list version */
                     }
                 }
             }
 
-            return(FALSE);
+            return(false);
         }
         p_attr = p_attr->p_next_attr;
     }
 #endif  /* CLIENT_ENABLED == TRUE */
 
     /* If here, no match found */
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -926,13 +926,13 @@
 ** Returns          SDP_SUCCESS if query started successfully, else error
 **
 *******************************************************************************/
-UINT16 SDP_DiDiscover( BD_ADDR remote_device, tSDP_DISCOVERY_DB *p_db,
-                       UINT32 len, tSDP_DISC_CMPL_CB *p_cb )
+uint16_t SDP_DiDiscover( BD_ADDR remote_device, tSDP_DISCOVERY_DB *p_db,
+                       uint32_t len, tSDP_DISC_CMPL_CB *p_cb )
 {
-#if SDP_CLIENT_ENABLED == TRUE
-    UINT16  result   = SDP_DI_DISC_FAILED;
-    UINT16  num_uuids = 1;
-    UINT16  di_uuid   = UUID_SERVCLASS_PNP_INFORMATION;
+#if (SDP_CLIENT_ENABLED == TRUE)
+    uint16_t result   = SDP_DI_DISC_FAILED;
+    uint16_t num_uuids = 1;
+    uint16_t di_uuid   = UUID_SERVCLASS_PNP_INFORMATION;
 
     /* build uuid for db init */
     tSDP_UUID init_uuid;
@@ -958,10 +958,10 @@
 ** Returns          number of DI records found
 **
 *******************************************************************************/
-UINT8 SDP_GetNumDiRecords( tSDP_DISCOVERY_DB *p_db )
+uint8_t SDP_GetNumDiRecords( tSDP_DISCOVERY_DB *p_db )
 {
-#if SDP_CLIENT_ENABLED == TRUE
-    UINT8   num_records = 0;
+#if (SDP_CLIENT_ENABLED == TRUE)
+    uint8_t num_records = 0;
     tSDP_DISC_REC *p_curr_record = NULL;
 
     do
@@ -987,12 +987,12 @@
 ** Returns          none
 **
 *******************************************************************************/
-static void SDP_AttrStringCopy(char *dst, tSDP_DISC_ATTR *p_attr, UINT16 dst_size)
+static void SDP_AttrStringCopy(char *dst, tSDP_DISC_ATTR *p_attr, uint16_t dst_size)
 {
     if ( dst == NULL ) return;
     if ( p_attr )
     {
-        UINT16 len = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
+        uint16_t len = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
         if ( len > dst_size - 1 )
         {
             len = dst_size - 1;
@@ -1016,12 +1016,12 @@
 ** Returns          SDP_SUCCESS if record retrieved, else error
 **
 *******************************************************************************/
-UINT16 SDP_GetDiRecord( UINT8 get_record_index, tSDP_DI_GET_RECORD *p_device_info,
+uint16_t SDP_GetDiRecord( uint8_t get_record_index, tSDP_DI_GET_RECORD *p_device_info,
                         tSDP_DISCOVERY_DB *p_db )
 {
-#if SDP_CLIENT_ENABLED == TRUE
-    UINT16  result = SDP_NO_DI_RECORD_FOUND;
-    UINT8  curr_record_index = 1;
+#if (SDP_CLIENT_ENABLED == TRUE)
+    uint16_t result = SDP_NO_DI_RECORD_FOUND;
+    uint8_t curr_record_index = 1;
 
     tSDP_DISC_REC *p_curr_record = NULL;
 
@@ -1090,7 +1090,7 @@
 
         p_curr_attr = SDP_FindAttributeInRec( p_curr_record, ATTR_ID_PRIMARY_RECORD );
         if ( p_curr_attr )
-            p_device_info->rec.primary_record = (BOOLEAN)p_curr_attr->attr_value.v.u8;
+            p_device_info->rec.primary_record = (bool   )p_curr_attr->attr_value.v.u8;
         else
             result = SDP_ERR_ATTR_NOT_PRESENT;
     }
@@ -1116,23 +1116,23 @@
 ** Returns          Returns SDP_SUCCESS if record added successfully, else error
 **
 *******************************************************************************/
-UINT16 SDP_SetLocalDiRecord( tSDP_DI_RECORD *p_device_info, UINT32 *p_handle )
+uint16_t SDP_SetLocalDiRecord( tSDP_DI_RECORD *p_device_info, uint32_t *p_handle )
 {
-#if SDP_SERVER_ENABLED == TRUE
-    UINT16  result = SDP_SUCCESS;
-    UINT32  handle;
-    UINT16  di_uuid = UUID_SERVCLASS_PNP_INFORMATION;
-    UINT16  di_specid = BLUETOOTH_DI_SPECIFICATION;
-    UINT8   temp_u16[2];
-    UINT8   *p_temp;
-    UINT8   u8;
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint16_t result = SDP_SUCCESS;
+    uint32_t handle;
+    uint16_t di_uuid = UUID_SERVCLASS_PNP_INFORMATION;
+    uint16_t di_specid = BLUETOOTH_DI_SPECIFICATION;
+    uint8_t temp_u16[2];
+    uint8_t *p_temp;
+    uint8_t u8;
 
     *p_handle = 0;
     if ( p_device_info == NULL )
         return SDP_ILLEGAL_PARAMETER;
 
     /* if record is to be primary record, get handle to replace old primary */
-    if ( p_device_info->primary_record == TRUE && sdp_cb.server_db.di_primary_handle )
+    if ( p_device_info->primary_record == true && sdp_cb.server_db.di_primary_handle )
         handle = sdp_cb.server_db.di_primary_handle;
     else
     {
@@ -1144,7 +1144,7 @@
 
     /* build the SDP entry */
     /* Add the UUID to the Service Class ID List */
-    if ((SDP_AddServiceClassIdList(handle, 1, &di_uuid)) == FALSE)
+    if ((SDP_AddServiceClassIdList(handle, 1, &di_uuid)) == false)
         result = SDP_DI_REG_FAILED;
 
     /* mandatory */
@@ -1165,8 +1165,8 @@
         {
             if ( !((strlen(p_device_info->client_executable_url)+1 <= SDP_MAX_ATTR_LEN) &&
                    SDP_AddAttribute(handle, ATTR_ID_CLIENT_EXE_URL, URL_DESC_TYPE,
-                                    (UINT32)(strlen(p_device_info->client_executable_url)+1),
-                                    (UINT8 *)p_device_info->client_executable_url)) )
+                                    (uint32_t)(strlen(p_device_info->client_executable_url)+1),
+                                    (uint8_t *)p_device_info->client_executable_url)) )
                 result = SDP_DI_REG_FAILED;
         }
     }
@@ -1179,8 +1179,8 @@
             if ( !((strlen(p_device_info->service_description)+1 <= SDP_MAX_ATTR_LEN) &&
                    SDP_AddAttribute(handle, ATTR_ID_SERVICE_DESCRIPTION,
                                     TEXT_STR_DESC_TYPE,
-                                    (UINT32)(strlen(p_device_info->service_description)+1),
-                                    (UINT8 *)p_device_info->service_description)) )
+                                    (uint32_t)(strlen(p_device_info->service_description)+1),
+                                    (uint8_t *)p_device_info->service_description)) )
                 result = SDP_DI_REG_FAILED;
         }
     }
@@ -1192,8 +1192,8 @@
         {
             if ( !((strlen(p_device_info->documentation_url)+1 <= SDP_MAX_ATTR_LEN) &&
                    SDP_AddAttribute(handle, ATTR_ID_DOCUMENTATION_URL, URL_DESC_TYPE,
-                                    (UINT32)(strlen(p_device_info->documentation_url)+1),
-                                    (UINT8 *)p_device_info->documentation_url)) )
+                                    (uint32_t)(strlen(p_device_info->documentation_url)+1),
+                                    (uint8_t *)p_device_info->documentation_url)) )
                 result = SDP_DI_REG_FAILED;
         }
     }
@@ -1231,7 +1231,7 @@
     /* mandatory */
     if ( result == SDP_SUCCESS)
     {
-        u8 = (UINT8)p_device_info->primary_record;
+        u8 = (uint8_t)p_device_info->primary_record;
         if ( !(SDP_AddAttribute(handle, ATTR_ID_PRIMARY_RECORD,
                                 BOOLEAN_DESC_TYPE, 1, &u8)) )
             result = SDP_DI_REG_FAILED;
@@ -1249,7 +1249,7 @@
 
     if ( result != SDP_SUCCESS )
         SDP_DeleteRecord( handle );
-    else if (p_device_info->primary_record == TRUE)
+    else if (p_device_info->primary_record == true)
         sdp_cb.server_db.di_primary_handle = handle;
 
     return result;
@@ -1268,7 +1268,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-UINT8 SDP_SetTraceLevel (UINT8 new_level)
+uint8_t SDP_SetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         sdp_cb.trace_level = new_level;
diff --git a/stack/sdp/sdp_db.c b/stack/sdp/sdp_db.c
index 8546536..03b3497 100644
--- a/stack/sdp/sdp_db.c
+++ b/stack/sdp/sdp_db.c
@@ -37,12 +37,12 @@
 #include "sdp_api.h"
 #include "sdpint.h"
 
-#if SDP_SERVER_ENABLED == TRUE
+#if (SDP_SERVER_ENABLED == TRUE)
 /********************************************************************************/
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
-static BOOLEAN find_uuid_in_seq (UINT8 *p , UINT32 seq_len, UINT8 *p_his_uuid,
-                                 UINT16 his_len, int nest_level);
+static bool    find_uuid_in_seq (uint8_t *p , uint32_t seq_len, uint8_t *p_his_uuid,
+                                 uint16_t his_len, int nest_level);
 
 
 /*******************************************************************************
@@ -58,7 +58,7 @@
 *******************************************************************************/
 tSDP_RECORD *sdp_db_service_search (tSDP_RECORD *p_rec, tSDP_UUID_SEQ *p_seq)
 {
-    UINT16          xx, yy;
+    uint16_t        xx, yy;
     tSDP_ATTRIBUTE *p_attr;
     tSDP_RECORD     *p_end = &sdp_cb.server_db.record[sdp_cb.server_db.num_records];
 
@@ -112,19 +112,19 @@
 **
 ** Description      This function searches a data element sequenct for a UUID.
 **
-** Returns          TRUE if found, else FALSE
+** Returns          true if found, else false
 **
 *******************************************************************************/
-static BOOLEAN find_uuid_in_seq (UINT8 *p , UINT32 seq_len, UINT8 *p_uuid,
-                                 UINT16 uuid_len, int nest_level)
+static bool    find_uuid_in_seq (uint8_t *p , uint32_t seq_len, uint8_t *p_uuid,
+                                 uint16_t uuid_len, int nest_level)
 {
-    UINT8   *p_end = p + seq_len;
-    UINT8   type;
-    UINT32  len;
+    uint8_t *p_end = p + seq_len;
+    uint8_t type;
+    uint32_t len;
 
     /* A little safety check to avoid excessive recursion */
     if (nest_level > 3)
-        return (FALSE);
+        return (false);
 
     while (p < p_end)
     {
@@ -134,18 +134,18 @@
         if (type == UUID_DESC_TYPE)
         {
             if (sdpu_compare_uuid_arrays (p, len, p_uuid, uuid_len))
-                return (TRUE);
+                return (true);
         }
         else if (type == DATA_ELE_SEQ_DESC_TYPE)
         {
             if (find_uuid_in_seq (p, len, p_uuid, uuid_len, nest_level + 1))
-                return (TRUE);
+                return (true);
         }
         p = p + len;
     }
 
     /* If here, failed to match */
-    return (FALSE);
+    return (false);
 }
 
 /*******************************************************************************
@@ -158,7 +158,7 @@
 ** Returns          Pointer to the record, or NULL if not found.
 **
 *******************************************************************************/
-tSDP_RECORD *sdp_db_find_record (UINT32 handle)
+tSDP_RECORD *sdp_db_find_record (uint32_t handle)
 {
     tSDP_RECORD     *p_rec;
     tSDP_RECORD     *p_end = &sdp_cb.server_db.record[sdp_cb.server_db.num_records];
@@ -186,11 +186,11 @@
 ** Returns          Pointer to the attribute, or NULL if not found.
 **
 *******************************************************************************/
-tSDP_ATTRIBUTE *sdp_db_find_attr_in_rec (tSDP_RECORD *p_rec, UINT16 start_attr,
-                                         UINT16 end_attr)
+tSDP_ATTRIBUTE *sdp_db_find_attr_in_rec (tSDP_RECORD *p_rec, uint16_t start_attr,
+                                         uint16_t end_attr)
 {
     tSDP_ATTRIBUTE  *p_at;
-    UINT16          xx;
+    uint16_t        xx;
 
     /* Note that the attributes in a record are assumed to be in sorted order */
     for (xx = 0, p_at = &p_rec->attribute[0]; xx < p_rec->num_attributes;
@@ -215,13 +215,13 @@
 ** Returns          the length of the data sequence
 **
 *******************************************************************************/
-static int sdp_compose_proto_list( UINT8 *p, UINT16 num_elem,
+static int sdp_compose_proto_list( uint8_t *p, uint16_t num_elem,
                                   tSDP_PROTOCOL_ELEM *p_elem_list)
 {
-    UINT16          xx, yy, len;
-    BOOLEAN            is_rfcomm_scn;
-    UINT8           *p_head = p;
-    UINT8            *p_len;
+    uint16_t        xx, yy, len;
+    bool               is_rfcomm_scn;
+    uint8_t         *p_head = p;
+    uint8_t          *p_len;
 
     /* First, build the protocol list. This consists of a set of data element
     ** sequences, one for each layer. Each layer sequence consists of layer's
@@ -233,15 +233,15 @@
         UINT8_TO_BE_STREAM  (p, (DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE);
 
         p_len = p;
-        *p++ = (UINT8) len;
+        *p++ = (uint8_t) len;
 
         UINT8_TO_BE_STREAM  (p, (UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES);
         UINT16_TO_BE_STREAM (p, p_elem_list->protocol_uuid);
 
         if (p_elem_list->protocol_uuid == UUID_PROTOCOL_RFCOMM)
-            is_rfcomm_scn = TRUE;
+            is_rfcomm_scn = true;
         else
-            is_rfcomm_scn = FALSE;
+            is_rfcomm_scn = false;
 
         for (yy = 0; yy < p_elem_list->num_params; yy++)
         {
@@ -276,11 +276,11 @@
 ** Returns          Record handle if OK, else 0.
 **
 *******************************************************************************/
-UINT32 SDP_CreateRecord (void)
+uint32_t SDP_CreateRecord (void)
 {
-#if SDP_SERVER_ENABLED == TRUE
-    UINT32    handle;
-    UINT8     buf[4];
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint32_t  handle;
+    uint8_t   buf[4];
     tSDP_DB  *p_db = &sdp_cb.server_db;
 
     /* First, check if there is a free record */
@@ -323,13 +323,13 @@
 **
 **                  If a record handle of 0 is passed, all records are deleted.
 **
-** Returns          TRUE if succeeded, else FALSE
+** Returns          true if succeeded, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_DeleteRecord (UINT32 handle)
+bool    SDP_DeleteRecord (uint32_t handle)
 {
-#if SDP_SERVER_ENABLED == TRUE
-    UINT16          xx, yy, zz;
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint16_t        xx, yy, zz;
     tSDP_RECORD     *p_rec = &sdp_cb.server_db.record[0];
 
     if (handle == 0 || sdp_cb.server_db.num_records == 0)
@@ -340,7 +340,7 @@
         /* require new DI record to be created in SDP_SetLocalDiRecord */
         sdp_cb.server_db.di_primary_handle = 0;
 
-        return (TRUE);
+        return (true);
     }
     else
     {
@@ -369,12 +369,12 @@
                     sdp_cb.server_db.di_primary_handle = 0;
                 }
 
-                return (TRUE);
+                return (true);
             }
         }
     }
 #endif
-    return (FALSE);
+    return (false);
 }
 
 
@@ -389,14 +389,14 @@
 **
 ** NOTE             Attribute values must be passed as a Big Endian stream.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddAttribute (UINT32 handle, UINT16 attr_id, UINT8 attr_type,
-                          UINT32 attr_len, UINT8 *p_val)
+bool    SDP_AddAttribute (uint32_t handle, uint16_t attr_id, uint8_t attr_type,
+                          uint32_t attr_len, uint8_t *p_val)
 {
-#if SDP_SERVER_ENABLED == TRUE
-    UINT16          xx, yy, zz;
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint16_t        xx, yy, zz;
     tSDP_RECORD     *p_rec = &sdp_cb.server_db.record[0];
 
 #if (BT_TRACE_VERBOSE == TRUE)
@@ -408,19 +408,19 @@
             (attr_type == DATA_ELE_SEQ_DESC_TYPE) ||
             (attr_type == DATA_ELE_ALT_DESC_TYPE))
         {
-            UINT8 num_array[400];
-            UINT32 i;
-            UINT32 len = (attr_len > 200) ? 200 : attr_len;
+            uint8_t num_array[400];
+            uint32_t i;
+            uint32_t len = (attr_len > 200) ? 200 : attr_len;
 
             num_array[0] ='\0';
             for (i = 0; i < len; i++)
             {
-                sprintf((char *)&num_array[i*2],"%02X",(UINT8)(p_val[i]));
+                sprintf((char *)&num_array[i*2],"%02X",(uint8_t)(p_val[i]));
             }
             SDP_TRACE_DEBUG("SDP_AddAttribute: handle:%X, id:%04X, type:%d, len:%d, p_val:%p, *p_val:%s",
                             handle,attr_id,attr_type,attr_len,p_val,num_array);
         }
-        else if (attr_type == BOOLEAN_DESC_TYPE)
+        else if (attr_type == bool   _DESC_TYPE)
         {
             SDP_TRACE_DEBUG("SDP_AddAttribute: handle:%X, id:%04X, type:%d, len:%d, p_val:%p, *p_val:%d",
                              handle,attr_id,attr_type,attr_len,p_val,*p_val);
@@ -454,7 +454,7 @@
             }
 
             if (p_rec->num_attributes == SDP_MAX_REC_ATTR)
-                return (FALSE);
+                return (false);
 
             /* If not found, see if we can allocate a new entry */
             if (xx == p_rec->num_attributes)
@@ -499,14 +499,14 @@
                 SDP_TRACE_ERROR("SDP_AddAttribute fail, length exceed maximum: ID %d: attr_len:%d ",
                     attr_id, attr_len );
                 p_attr->id   = p_attr->type = p_attr->len  = 0;
-                return (FALSE);
+                return (false);
             }
             p_rec->num_attributes++;
-            return (TRUE);
+            return (true);
         }
     }
 #endif
-    return (FALSE);
+    return (false);
 }
 
 
@@ -521,18 +521,18 @@
 **
 ** NOTE             Element values must be passed as a Big Endian stream.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddSequence (UINT32 handle,  UINT16 attr_id, UINT16 num_elem,
-                         UINT8 type[], UINT8 len[], UINT8 *p_val[])
+bool    SDP_AddSequence (uint32_t handle,  uint16_t attr_id, uint16_t num_elem,
+                         uint8_t type[], uint8_t len[], uint8_t *p_val[])
 {
-#if SDP_SERVER_ENABLED == TRUE
-    UINT16 xx;
-    UINT8 *p;
-    UINT8 *p_head;
-    BOOLEAN result;
-    UINT8 *p_buff = (UINT8 *)osi_malloc(sizeof(UINT8) * SDP_MAX_ATTR_LEN * 2);
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint16_t xx;
+    uint8_t *p;
+    uint8_t *p_head;
+    bool    result;
+    uint8_t *p_buff = (uint8_t *)osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN * 2);
 
     p = p_buff;
 
@@ -574,18 +574,18 @@
                 /* the first element exceed the max length */
                 SDP_TRACE_ERROR ("SDP_AddSequence - too long(attribute is not added)!!");
                 osi_free(p_buff);
-                return FALSE;
+                return false;
             }
             else
                 SDP_TRACE_ERROR ("SDP_AddSequence - too long, add %d elements of %d", xx, num_elem);
             break;
         }
     }
-    result = SDP_AddAttribute (handle, attr_id, DATA_ELE_SEQ_DESC_TYPE,(UINT32) (p - p_buff), p_buff);
+    result = SDP_AddAttribute (handle, attr_id, DATA_ELE_SEQ_DESC_TYPE,(uint32_t) (p - p_buff), p_buff);
     osi_free(p_buff);
     return result;
 #else   /* SDP_SERVER_ENABLED == FALSE */
-    return (FALSE);
+    return (false);
 #endif
 }
 
@@ -599,18 +599,18 @@
 **                  If the sequence already exists in the record, it is replaced
 **                  with the new sequence.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddUuidSequence (UINT32 handle,  UINT16 attr_id, UINT16 num_uuids,
-                             UINT16 *p_uuids)
+bool    SDP_AddUuidSequence (uint32_t handle,  uint16_t attr_id, uint16_t num_uuids,
+                             uint16_t *p_uuids)
 {
-#if SDP_SERVER_ENABLED == TRUE
-    UINT16 xx;
-    UINT8 *p;
-    INT32 max_len = SDP_MAX_ATTR_LEN -3;
-    BOOLEAN result;
-    UINT8 *p_buff = (UINT8 *)osi_malloc(sizeof(UINT8) * SDP_MAX_ATTR_LEN * 2);
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint16_t xx;
+    uint8_t *p;
+    int32_t max_len = SDP_MAX_ATTR_LEN -3;
+    bool    result;
+    uint8_t *p_buff = (uint8_t *)osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN * 2);
 
     p = p_buff;
 
@@ -627,11 +627,11 @@
         }
     }
 
-    result = SDP_AddAttribute (handle, attr_id, DATA_ELE_SEQ_DESC_TYPE,(UINT32) (p - p_buff), p_buff);
+    result = SDP_AddAttribute (handle, attr_id, DATA_ELE_SEQ_DESC_TYPE,(uint32_t) (p - p_buff), p_buff);
     osi_free(p_buff);
     return result;
 #else   /* SDP_SERVER_ENABLED == FALSE */
-    return (FALSE);
+    return (false);
 #endif
 }
 
@@ -644,23 +644,23 @@
 **                  If the protocol list already exists in the record, it is replaced
 **                  with the new list.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddProtocolList (UINT32 handle, UINT16 num_elem,
+bool    SDP_AddProtocolList (uint32_t handle, uint16_t num_elem,
                              tSDP_PROTOCOL_ELEM *p_elem_list)
 {
-#if SDP_SERVER_ENABLED == TRUE
+#if (SDP_SERVER_ENABLED == TRUE)
     int offset;
-    BOOLEAN result;
-    UINT8 *p_buff = (UINT8 *)osi_malloc(sizeof(UINT8) * SDP_MAX_ATTR_LEN * 2);
+    bool    result;
+    uint8_t *p_buff = (uint8_t *)osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN * 2);
 
     offset = sdp_compose_proto_list(p_buff, num_elem, p_elem_list);
-    result = SDP_AddAttribute (handle, ATTR_ID_PROTOCOL_DESC_LIST,DATA_ELE_SEQ_DESC_TYPE, (UINT32) offset, p_buff);
+    result = SDP_AddAttribute (handle, ATTR_ID_PROTOCOL_DESC_LIST,DATA_ELE_SEQ_DESC_TYPE, (uint32_t) offset, p_buff);
     osi_free(p_buff);
     return result;
 #else   /* SDP_SERVER_ENABLED == FALSE */
-    return (FALSE);
+    return (false);
 #endif
 }
 
@@ -674,19 +674,19 @@
 **                  If the protocol list already exists in the record, it is replaced
 **                  with the new list.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddAdditionProtoLists (UINT32 handle, UINT16 num_elem,
+bool    SDP_AddAdditionProtoLists (uint32_t handle, uint16_t num_elem,
                                    tSDP_PROTO_LIST_ELEM *p_proto_list)
 {
-#if SDP_SERVER_ENABLED == TRUE
-    UINT16 xx;
-    UINT8 *p;
-    UINT8 *p_len;
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint16_t xx;
+    uint8_t *p;
+    uint8_t *p_len;
     int offset;
-    BOOLEAN result;
-    UINT8 *p_buff = (UINT8 *)osi_malloc(sizeof(UINT8) * SDP_MAX_ATTR_LEN * 2);
+    bool    result;
+    uint8_t *p_buff = (uint8_t *)osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN * 2);
 
     p = p_buff;
 
@@ -700,15 +700,15 @@
                                         p_proto_list->list_elem);
         p += offset;
 
-        *p_len  = (UINT8)(p - p_len - 1);
+        *p_len  = (uint8_t)(p - p_len - 1);
     }
     result = SDP_AddAttribute (handle, ATTR_ID_ADDITION_PROTO_DESC_LISTS,DATA_ELE_SEQ_DESC_TYPE,
-	                           (UINT32) (p - p_buff), p_buff);
+	                           (uint32_t) (p - p_buff), p_buff);
     osi_free(p_buff);
     return result;
 
 #else   /* SDP_SERVER_ENABLED == FALSE */
-    return (FALSE);
+    return (false);
 #endif
 }
 
@@ -721,16 +721,16 @@
 **                  If the version already exists in the record, it is replaced
 **                  with the new one.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddProfileDescriptorList (UINT32 handle, UINT16 profile_uuid,
-                                      UINT16 version)
+bool    SDP_AddProfileDescriptorList (uint32_t handle, uint16_t profile_uuid,
+                                      uint16_t version)
 {
-#if SDP_SERVER_ENABLED == TRUE
-    UINT8 *p;
-    BOOLEAN result;
-    UINT8 *p_buff = (UINT8 *)osi_malloc(sizeof(UINT8) * SDP_MAX_ATTR_LEN);
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint8_t *p;
+    bool    result;
+    uint8_t *p_buff = (uint8_t *)osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN);
 
     p = p_buff + 2;
 
@@ -743,15 +743,15 @@
     UINT16_TO_BE_STREAM (p, version);
 
     /* Add in type and length fields */
-    *p_buff = (UINT8) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE);
-    *(p_buff+1) = (UINT8) (p - (p_buff+2));
+    *p_buff = (uint8_t) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE);
+    *(p_buff+1) = (uint8_t) (p - (p_buff+2));
 
-    result = SDP_AddAttribute (handle, ATTR_ID_BT_PROFILE_DESC_LIST,DATA_ELE_SEQ_DESC_TYPE, (UINT32) (p - p_buff), p_buff);
+    result = SDP_AddAttribute (handle, ATTR_ID_BT_PROFILE_DESC_LIST,DATA_ELE_SEQ_DESC_TYPE, (uint32_t) (p - p_buff), p_buff);
     osi_free(p_buff);
     return result;
 
 #else   /* SDP_SERVER_ENABLED == FALSE */
-    return (FALSE);
+    return (false);
 #endif
 }
 
@@ -765,16 +765,16 @@
 **                  If the version already exists in the record, it is replaced
 **                  with the new one.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddLanguageBaseAttrIDList (UINT32 handle, UINT16 lang,
-                                       UINT16 char_enc, UINT16 base_id)
+bool    SDP_AddLanguageBaseAttrIDList (uint32_t handle, uint16_t lang,
+                                       uint16_t char_enc, uint16_t base_id)
 {
-#if SDP_SERVER_ENABLED == TRUE
-    UINT8 *p;
-    BOOLEAN result;
-    UINT8 *p_buff = (UINT8 *) osi_malloc(sizeof(UINT8) * SDP_MAX_ATTR_LEN);
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint8_t *p;
+    bool    result;
+    uint8_t *p_buff = (uint8_t *) osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN);
 
     p = p_buff;
 
@@ -790,11 +790,11 @@
     UINT16_TO_BE_STREAM (p, base_id);
 
     result = SDP_AddAttribute (handle, ATTR_ID_LANGUAGE_BASE_ATTR_ID_LIST,DATA_ELE_SEQ_DESC_TYPE,
-	                           (UINT32) (p - p_buff), p_buff);
+	                           (uint32_t) (p - p_buff), p_buff);
     osi_free(p_buff);
     return result;
 #else   /* SDP_SERVER_ENABLED == FALSE */
-    return (FALSE);
+    return (false);
 #endif
 }
 
@@ -808,17 +808,17 @@
 **                  If the service list already exists in the record, it is replaced
 **                  with the new list.
 **
-** Returns          TRUE if added OK, else FALSE
+** Returns          true if added OK, else false
 **
 *******************************************************************************/
-BOOLEAN SDP_AddServiceClassIdList (UINT32 handle, UINT16 num_services,
-                                   UINT16 *p_service_uuids)
+bool    SDP_AddServiceClassIdList (uint32_t handle, uint16_t num_services,
+                                   uint16_t *p_service_uuids)
 {
-#if SDP_SERVER_ENABLED == TRUE
-    UINT16 xx;
-    UINT8 *p;
-    BOOLEAN result;
-    UINT8 *p_buff = (UINT8 *) osi_malloc(sizeof(UINT8) * SDP_MAX_ATTR_LEN * 2);
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint16_t xx;
+    uint8_t *p;
+    bool    result;
+    uint8_t *p_buff = (uint8_t *) osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN * 2);
 
     p = p_buff;
 
@@ -829,11 +829,11 @@
     }
 
     result = SDP_AddAttribute (handle, ATTR_ID_SERVICE_CLASS_ID_LIST,DATA_ELE_SEQ_DESC_TYPE,
-	                           (UINT32) (p - p_buff), p_buff);
+	                           (uint32_t) (p - p_buff), p_buff);
     osi_free(p_buff);
     return result;
 #else   /* SDP_SERVER_ENABLED == FALSE */
-    return (FALSE);
+    return (false);
 #endif
 }
 
@@ -845,16 +845,16 @@
 ** Description      This function is called to delete an attribute from a record.
 **                  This would be through the SDP database maintenance API.
 **
-** Returns          TRUE if deleted OK, else FALSE if not found
+** Returns          true if deleted OK, else false if not found
 **
 *******************************************************************************/
-BOOLEAN SDP_DeleteAttribute (UINT32 handle, UINT16 attr_id)
+bool    SDP_DeleteAttribute (uint32_t handle, uint16_t attr_id)
 {
-#if SDP_SERVER_ENABLED == TRUE
-    UINT16          xx, yy;
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint16_t        xx, yy;
     tSDP_RECORD     *p_rec = &sdp_cb.server_db.record[0];
-    UINT8           *pad_ptr;
-    UINT32  len;                        /* Number of bytes in the entry */
+    uint8_t         *pad_ptr;
+    uint32_t len;                        /* Number of bytes in the entry */
 
     /* Find the record in the database */
     for (xx = 0; xx < sdp_cb.server_db.num_records; xx++, p_rec++)
@@ -898,14 +898,14 @@
                             *pad_ptr = *(pad_ptr+len);
                         p_rec->free_pad_ptr -= len;
                     }
-                    return (TRUE);
+                    return (true);
                 }
             }
         }
     }
 #endif
     /* If here, not found */
-    return (FALSE);
+    return (false);
 }
 
 /*******************************************************************************
@@ -922,17 +922,17 @@
 **
 *******************************************************************************/
 #if (SDP_RAW_DATA_INCLUDED == TRUE)
-INT32 SDP_ReadRecord(UINT32 handle, UINT8 *p_data, INT32 *p_data_len)
+int32_t SDP_ReadRecord(uint32_t handle, uint8_t *p_data, int32_t *p_data_len)
 {
-    INT32           len = 0;                        /* Number of bytes in the entry */
-    INT32           offset = -1; /* default to not found */
-#if SDP_SERVER_ENABLED == TRUE
+    int32_t         len = 0;                        /* Number of bytes in the entry */
+    int32_t         offset = -1; /* default to not found */
+#if (SDP_SERVER_ENABLED == TRUE)
     tSDP_RECORD     *p_rec;
-    UINT16          start = 0;
-    UINT16          end = 0xffff;
+    uint16_t        start = 0;
+    uint16_t        end = 0xffff;
     tSDP_ATTRIBUTE  *p_attr;
-    UINT16          rem_len;
-    UINT8           *p_rsp;
+    uint16_t        rem_len;
+    uint8_t         *p_rsp;
 
     /* Find the record in the database */
     p_rec = sdp_db_find_record(handle);
@@ -942,9 +942,9 @@
         while ( (p_attr = sdp_db_find_attr_in_rec (p_rec, start, end)) != NULL)
         {
             /* Check if attribute fits. Assume 3-byte value type/length */
-            rem_len = *p_data_len - (UINT16) (p_rsp - p_data);
+            rem_len = *p_data_len - (uint16_t) (p_rsp - p_data);
 
-            if (p_attr->len > (UINT32)(rem_len - 6))
+            if (p_attr->len > (uint32_t)(rem_len - 6))
                 break;
 
             p_rsp = sdpu_build_attrib_entry (p_rsp, p_attr);
@@ -952,22 +952,22 @@
             /* next attr id */
             start = p_attr->id + 1;
         }
-        len = (INT32) (p_rsp - p_data);
+        len = (int32_t) (p_rsp - p_data);
 
         /* Put in the sequence header (2 or 3 bytes) */
         if (len > 255)
         {
             offset = 0;
-            p_data[0] = (UINT8) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_WORD);
-            p_data[1] = (UINT8) ((len - 3) >> 8);
-            p_data[2] = (UINT8) (len - 3);
+            p_data[0] = (uint8_t) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_WORD);
+            p_data[1] = (uint8_t) ((len - 3) >> 8);
+            p_data[2] = (uint8_t) (len - 3);
         }
         else
         {
             offset = 1;
 
-            p_data[1] = (UINT8) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE);
-            p_data[2] = (UINT8) (len - 3);
+            p_data[1] = (uint8_t) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE);
+            p_data[2] = (uint8_t) (len - 3);
 
             len--;
         }
diff --git a/stack/sdp/sdp_discovery.c b/stack/sdp/sdp_discovery.c
index a610e22..66d4ac7 100644
--- a/stack/sdp/sdp_discovery.c
+++ b/stack/sdp/sdp_discovery.c
@@ -38,20 +38,20 @@
 
 
 #ifndef SDP_DEBUG_RAW
-#define SDP_DEBUG_RAW       FALSE
+#define SDP_DEBUG_RAW       false
 #endif
 
 /********************************************************************************/
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
-#if SDP_CLIENT_ENABLED == TRUE
-static void          process_service_search_rsp (tCONN_CB *p_ccb, UINT8 *p_reply);
-static void          process_service_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply);
-static void          process_service_search_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply);
-static UINT8         *save_attr_seq (tCONN_CB *p_ccb, UINT8 *p, UINT8 *p_msg_end);
+#if (SDP_CLIENT_ENABLED == TRUE)
+static void          process_service_search_rsp (tCONN_CB *p_ccb, uint8_t *p_reply);
+static void          process_service_attr_rsp (tCONN_CB *p_ccb, uint8_t *p_reply);
+static void          process_service_search_attr_rsp (tCONN_CB *p_ccb, uint8_t *p_reply);
+static uint8_t       *save_attr_seq (tCONN_CB *p_ccb, uint8_t *p, uint8_t *p_msg_end);
 static tSDP_DISC_REC *add_record (tSDP_DISCOVERY_DB *p_db, BD_ADDR p_bda);
-static UINT8         *add_attr (UINT8 *p, tSDP_DISCOVERY_DB *p_db, tSDP_DISC_REC *p_rec,
-                                UINT16 attr_id, tSDP_DISC_ATTR *p_parent_attr, UINT8 nest_level);
+static uint8_t       *add_attr (uint8_t *p, tSDP_DISCOVERY_DB *p_db, tSDP_DISC_REC *p_rec,
+                                uint16_t attr_id, tSDP_DISC_ATTR *p_parent_attr, uint8_t nest_level);
 
 /* Safety check in case we go crazy */
 #define MAX_NEST_LEVELS     5
@@ -69,10 +69,10 @@
 ** Returns          Pointer to next byte in the output buffer.
 **
 *******************************************************************************/
-static UINT8 *sdpu_build_uuid_seq (UINT8 *p_out, UINT16 num_uuids, tSDP_UUID *p_uuid_list)
+static uint8_t *sdpu_build_uuid_seq (uint8_t *p_out, uint16_t num_uuids, tSDP_UUID *p_uuid_list)
 {
-    UINT16  xx;
-    UINT8   *p_len;
+    uint16_t xx;
+    uint8_t *p_len;
 
     /* First thing is the data element header */
     UINT8_TO_BE_STREAM  (p_out, (DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE);
@@ -102,7 +102,7 @@
     }
 
     /* Now, put in the length */
-    xx = (UINT16)(p_out - p_len - 1);
+    xx = (uint16_t)(p_out - p_len - 1);
     UINT8_TO_BE_STREAM (p_len, xx);
 
     return (p_out);
@@ -117,15 +117,15 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void sdp_snd_service_search_req(tCONN_CB *p_ccb, UINT8 cont_len, UINT8 * p_cont)
+static void sdp_snd_service_search_req(tCONN_CB *p_ccb, uint8_t cont_len, uint8_t * p_cont)
 {
-    UINT8           *p, *p_start, *p_param_len;
+    uint8_t         *p, *p_start, *p_param_len;
     BT_HDR          *p_cmd = (BT_HDR *) osi_malloc(SDP_DATA_BUF_SIZE);
-    UINT16          param_len;
+    uint16_t        param_len;
 
     /* Prepare the buffer for sending the packet to L2CAP */
     p_cmd->offset = L2CAP_MIN_OFFSET;
-    p = p_start = (UINT8 *)(p_cmd + 1) + L2CAP_MIN_OFFSET;
+    p = p_start = (uint8_t *)(p_cmd + 1) + L2CAP_MIN_OFFSET;
 
     /* Build a service search request packet */
     UINT8_TO_BE_STREAM  (p, SDP_PDU_SERVICE_SEARCH_REQ);
@@ -137,7 +137,7 @@
     p += 2;
 
     /* Build the UID sequence. */
-#if (defined(SDP_BROWSE_PLUS) && SDP_BROWSE_PLUS == TRUE)
+#if (SDP_BROWSE_PLUS == TRUE)
     p = sdpu_build_uuid_seq (p, 1, &p_ccb->p_db->uuid_filters[p_ccb->cur_uuid_idx]);
 #else
     p = sdpu_build_uuid_seq (p, p_ccb->p_db->num_uuid_filters, p_ccb->p_db->uuid_filters);
@@ -157,13 +157,13 @@
     }
 
     /* Go back and put the parameter length into the buffer */
-    param_len = (UINT16)(p - p_param_len - 2);
+    param_len = (uint16_t)(p - p_param_len - 2);
     UINT16_TO_BE_STREAM (p_param_len, param_len);
 
     p_ccb->disc_state = SDP_DISC_WAIT_HANDLES;
 
     /* Set the length of the SDP data in the buffer */
-    p_cmd->len = (UINT16)(p - p_start);
+    p_cmd->len = (uint16_t)(p - p_start);
 
 #if (SDP_DEBUG_RAW == TRUE)
     SDP_TRACE_WARNING("sdp_snd_service_search_req cont_len :%d disc_state:%d",cont_len, p_ccb->disc_state);
@@ -219,8 +219,8 @@
 *******************************************************************************/
 void sdp_disc_server_rsp (tCONN_CB *p_ccb, BT_HDR *p_msg)
 {
-    UINT8           *p, rsp_pdu;
-    BOOLEAN         invalid_pdu = TRUE;
+    uint8_t         *p, rsp_pdu;
+    bool            invalid_pdu = true;
 
 #if (SDP_DEBUG_RAW == TRUE)
     SDP_TRACE_WARNING("sdp_disc_server_rsp disc_state:%d", p_ccb->disc_state);
@@ -230,7 +230,7 @@
     alarm_cancel(p_ccb->sdp_conn_timer);
 
     /* Got a reply!! Check what we got back */
-    p = (UINT8 *)(p_msg + 1) + p_msg->offset;
+    p = (uint8_t *)(p_msg + 1) + p_msg->offset;
 
     BE_STREAM_TO_UINT8 (rsp_pdu, p);
 
@@ -242,7 +242,7 @@
         if (p_ccb->disc_state == SDP_DISC_WAIT_HANDLES)
         {
             process_service_search_rsp (p_ccb, p);
-            invalid_pdu = FALSE;
+            invalid_pdu = false;
         }
         break;
 
@@ -250,7 +250,7 @@
         if (p_ccb->disc_state == SDP_DISC_WAIT_ATTR)
         {
             process_service_attr_rsp (p_ccb, p);
-            invalid_pdu = FALSE;
+            invalid_pdu = false;
         }
         break;
 
@@ -258,7 +258,7 @@
         if (p_ccb->disc_state == SDP_DISC_WAIT_SEARCH_ATTR)
         {
             process_service_search_attr_rsp (p_ccb, p);
-            invalid_pdu = FALSE;
+            invalid_pdu = false;
         }
         break;
     }
@@ -280,11 +280,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void process_service_search_rsp (tCONN_CB *p_ccb, UINT8 *p_reply)
+static void process_service_search_rsp (tCONN_CB *p_ccb, uint8_t *p_reply)
 {
-    UINT16      xx;
-    UINT16      total, cur_handles, orig;
-    UINT8       cont_len;
+    uint16_t    xx;
+    uint16_t    total, cur_handles, orig;
+    uint8_t     cont_len;
 
     /* Skip transaction, and param len */
     p_reply += 4;
@@ -341,20 +341,20 @@
 **
 *******************************************************************************/
 #if (SDP_RAW_DATA_INCLUDED == TRUE)
-static void sdp_copy_raw_data (tCONN_CB *p_ccb, BOOLEAN offset)
+static void sdp_copy_raw_data (tCONN_CB *p_ccb, bool    offset)
 {
     unsigned int    cpy_len;
-    UINT32          list_len;
-    UINT8           *p;
-    UINT8           type;
+    uint32_t        list_len;
+    uint8_t         *p;
+    uint8_t         type;
 
 #if (SDP_DEBUG_RAW == TRUE)
-    UINT8 num_array[SDP_MAX_LIST_BYTE_COUNT];
-    UINT32 i;
+    uint8_t num_array[SDP_MAX_LIST_BYTE_COUNT];
+    uint32_t i;
 
     for (i = 0; i < p_ccb->list_len; i++)
     {
-        sprintf((char *)&num_array[i*2],"%02X",(UINT8)(p_ccb->rsp_list[i]));
+        sprintf((char *)&num_array[i*2],"%02X",(uint8_t)(p_ccb->rsp_list[i]));
     }
     SDP_TRACE_WARNING("result :%s",num_array);
 #endif
@@ -394,11 +394,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void process_service_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply)
+static void process_service_attr_rsp (tCONN_CB *p_ccb, uint8_t *p_reply)
 {
-    UINT8           *p_start, *p_param_len;
-    UINT16          param_len, list_byte_count;
-    BOOLEAN         cont_request_needed = FALSE;
+    uint8_t         *p_start, *p_param_len;
+    uint16_t        param_len, list_byte_count;
+    bool            cont_request_needed = false;
 
 #if (SDP_DEBUG_RAW == TRUE)
     SDP_TRACE_WARNING("process_service_attr_rsp raw inc:%d",
@@ -431,7 +431,7 @@
             p_ccb->list_len, list_byte_count);
 #endif
         if (p_ccb->rsp_list == NULL)
-            p_ccb->rsp_list = (UINT8 *)osi_malloc(SDP_MAX_LIST_BYTE_COUNT);
+            p_ccb->rsp_list = (uint8_t *)osi_malloc(SDP_MAX_LIST_BYTE_COUNT);
         memcpy(&p_ccb->rsp_list[p_ccb->list_len], p_reply, list_byte_count);
         p_ccb->list_len += list_byte_count;
         p_reply         += list_byte_count;
@@ -448,14 +448,14 @@
                 sdp_disconnect (p_ccb, SDP_INVALID_CONT_STATE);
                 return;
             }
-            cont_request_needed = TRUE;
+            cont_request_needed = true;
         }
         else
         {
 
 #if (SDP_RAW_DATA_INCLUDED == TRUE)
             SDP_TRACE_WARNING("process_service_attr_rsp");
-            sdp_copy_raw_data (p_ccb, FALSE);
+            sdp_copy_raw_data (p_ccb, false);
 #endif
 
             /* Save the response in the database. Stop on any error */
@@ -473,10 +473,10 @@
     if (p_ccb->cur_handle < p_ccb->num_handles)
     {
         BT_HDR  *p_msg = (BT_HDR *)osi_malloc(SDP_DATA_BUF_SIZE);
-        UINT8   *p;
+        uint8_t *p;
 
         p_msg->offset = L2CAP_MIN_OFFSET;
-        p = p_start = (UINT8 *)(p_msg + 1) + L2CAP_MIN_OFFSET;
+        p = p_start = (uint8_t *)(p_msg + 1) + L2CAP_MIN_OFFSET;
 
         /* Get all the attributes from the server */
         UINT8_TO_BE_STREAM  (p, SDP_PDU_SERVICE_ATTR_REQ);
@@ -508,11 +508,11 @@
             UINT8_TO_BE_STREAM (p, 0);
 
         /* Go back and put the parameter length into the buffer */
-        param_len = (UINT16)(p - p_param_len - 2);
+        param_len = (uint16_t)(p - p_param_len - 2);
         UINT16_TO_BE_STREAM (p_param_len, param_len);
 
         /* Set the length of the SDP data in the buffer */
-        p_msg->len = (UINT16)(p - p_start);
+        p_msg->len = (uint16_t)(p - p_start);
 
 
         L2CA_DataWrite (p_ccb->connection_id, p_msg);
@@ -540,13 +540,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void process_service_search_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply)
+static void process_service_search_attr_rsp (tCONN_CB *p_ccb, uint8_t *p_reply)
 {
-    UINT8           *p, *p_start, *p_end, *p_param_len;
-    UINT8           type;
-    UINT32          seq_len;
-    UINT16          param_len, lists_byte_count = 0;
-    BOOLEAN         cont_request_needed = FALSE;
+    uint8_t         *p, *p_start, *p_end, *p_param_len;
+    uint8_t         type;
+    uint32_t        seq_len;
+    uint16_t        param_len, lists_byte_count = 0;
+    bool            cont_request_needed = false;
 
 #if (SDP_DEBUG_RAW == TRUE)
     SDP_TRACE_WARNING("process_service_search_attr_rsp");
@@ -578,7 +578,7 @@
             p_ccb->list_len, lists_byte_count);
 #endif
         if (p_ccb->rsp_list == NULL)
-            p_ccb->rsp_list = (UINT8 *)osi_malloc(SDP_MAX_LIST_BYTE_COUNT);
+            p_ccb->rsp_list = (uint8_t *)osi_malloc(SDP_MAX_LIST_BYTE_COUNT);
         memcpy (&p_ccb->rsp_list[p_ccb->list_len], p_reply, lists_byte_count);
         p_ccb->list_len += lists_byte_count;
         p_reply         += lists_byte_count;
@@ -596,7 +596,7 @@
                 return;
             }
 
-            cont_request_needed = TRUE;
+            cont_request_needed = true;
         }
     }
 
@@ -607,10 +607,10 @@
     if ((cont_request_needed) || (!p_reply))
     {
         BT_HDR  *p_msg = (BT_HDR *)osi_malloc(SDP_DATA_BUF_SIZE);
-        UINT8   *p;
+        uint8_t *p;
 
         p_msg->offset = L2CAP_MIN_OFFSET;
-        p = p_start = (UINT8 *)(p_msg + 1) + L2CAP_MIN_OFFSET;
+        p = p_start = (uint8_t *)(p_msg + 1) + L2CAP_MIN_OFFSET;
 
         /* Build a service search request packet */
         UINT8_TO_BE_STREAM  (p, SDP_PDU_SERVICE_SEARCH_ATTR_REQ);
@@ -622,7 +622,7 @@
         p += 2;
 
         /* Build the UID sequence. */
-#if (defined(SDP_BROWSE_PLUS) && SDP_BROWSE_PLUS == TRUE)
+#if (SDP_BROWSE_PLUS == TRUE)
         p = sdpu_build_uuid_seq (p, 1, &p_ccb->p_db->uuid_filters[p_ccb->cur_uuid_idx]);
 #else
         p = sdpu_build_uuid_seq (p, p_ccb->p_db->num_uuid_filters, p_ccb->p_db->uuid_filters);
@@ -671,7 +671,7 @@
 
 #if (SDP_RAW_DATA_INCLUDED == TRUE)
     SDP_TRACE_WARNING("process_service_search_attr_rsp");
-    sdp_copy_raw_data (p_ccb, TRUE);
+    sdp_copy_raw_data (p_ccb, true);
 #endif
 
     p = &p_ccb->rsp_list[0];
@@ -718,11 +718,11 @@
 ** Returns          pointer to next byte or NULL if error
 **
 *******************************************************************************/
-static UINT8 *save_attr_seq (tCONN_CB *p_ccb, UINT8 *p, UINT8 *p_msg_end)
+static uint8_t *save_attr_seq (tCONN_CB *p_ccb, uint8_t *p, uint8_t *p_msg_end)
 {
-    UINT32      seq_len, attr_len;
-    UINT16      attr_id;
-    UINT8       type, *p_seq_end;
+    uint32_t    seq_len, attr_len;
+    uint16_t    attr_id;
+    uint8_t     type, *p_seq_end;
     tSDP_DISC_REC *p_rec;
 
     type = *p++;
@@ -829,17 +829,17 @@
 ** Returns          pointer to next byte in data stream
 **
 *******************************************************************************/
-static UINT8 *add_attr (UINT8 *p, tSDP_DISCOVERY_DB *p_db, tSDP_DISC_REC *p_rec,
-                        UINT16 attr_id, tSDP_DISC_ATTR *p_parent_attr, UINT8 nest_level)
+static uint8_t *add_attr (uint8_t *p, tSDP_DISCOVERY_DB *p_db, tSDP_DISC_REC *p_rec,
+                        uint16_t attr_id, tSDP_DISC_ATTR *p_parent_attr, uint8_t nest_level)
 {
     tSDP_DISC_ATTR  *p_attr;
-    UINT32          attr_len;
-    UINT32          total_len;
-    UINT16          attr_type;
-    UINT16          id;
-    UINT8           type;
-    UINT8           *p_end;
-    UINT8           is_additional_list = nest_level & SDP_ADDITIONAL_LIST_MASK;
+    uint32_t        attr_len;
+    uint32_t        total_len;
+    uint16_t        attr_type;
+    uint16_t        id;
+    uint8_t         type;
+    uint8_t         *p_end;
+    uint8_t         is_additional_list = nest_level & SDP_ADDITIONAL_LIST_MASK;
 
     nest_level &= ~(SDP_ADDITIONAL_LIST_MASK);
 
@@ -851,7 +851,7 @@
 
     /* See if there is enough space in the database */
     if (attr_len > 4)
-        total_len = attr_len - 4 + (UINT16)sizeof (tSDP_DISC_ATTR);
+        total_len = attr_len - 4 + (uint16_t)sizeof (tSDP_DISC_ATTR);
     else
         total_len = sizeof (tSDP_DISC_ATTR);
 
@@ -864,7 +864,7 @@
 
     p_attr                = (tSDP_DISC_ATTR *) p_db->p_free_mem;
     p_attr->attr_id       = attr_id;
-    p_attr->attr_len_type = (UINT16)attr_len | (attr_type << 12);
+    p_attr->attr_len_type = (uint16_t)attr_len | (attr_type << 12);
     p_attr->p_next_attr = NULL;
 
     /* Store the attribute value */
@@ -892,7 +892,7 @@
                 }
 
                 /* Now, add the list entry */
-                p = add_attr (p, p_db, p_rec, ATTR_ID_PROTOCOL_DESC_LIST, p_attr, (UINT8)(nest_level + 1));
+                p = add_attr (p, p_db, p_rec, ATTR_ID_PROTOCOL_DESC_LIST, p_attr, (uint8_t)(nest_level + 1));
 
                 break;
             }
@@ -912,7 +912,7 @@
             BE_STREAM_TO_UINT32 (p_attr->attr_value.v.u32, p);
             break;
         default:
-            BE_STREAM_TO_ARRAY (p, p_attr->attr_value.v.array, (INT32)attr_len);
+            BE_STREAM_TO_ARRAY (p, p_attr->attr_value.v.array, (int32_t)attr_len);
             break;
         }
         break;
@@ -928,8 +928,8 @@
             if (p_attr->attr_value.v.u32 < 0x10000)
             {
                 attr_len = 2;
-                p_attr->attr_len_type = (UINT16)attr_len | (attr_type << 12);
-                p_attr->attr_value.v.u16 = (UINT16) p_attr->attr_value.v.u32;
+                p_attr->attr_len_type = (uint16_t)attr_len | (attr_type << 12);
+                p_attr->attr_value.v.u16 = (uint16_t) p_attr->attr_value.v.u32;
 
             }
             break;
@@ -960,7 +960,7 @@
                     The actual size of tSDP_DISC_ATVAL does not matter.
                     If the array size in tSDP_DISC_ATVAL is increase, we would increase the system RAM usage unnecessarily
                 */
-                BE_STREAM_TO_ARRAY (p, p_attr->attr_value.v.array, (INT32)attr_len);
+                BE_STREAM_TO_ARRAY (p, p_attr->attr_value.v.array, (int32_t)attr_len);
             }
             break;
         default:
@@ -990,7 +990,7 @@
         while (p < p_end)
         {
             /* Now, add the list entry */
-            p = add_attr (p, p_db, p_rec, 0, p_attr, (UINT8)(nest_level + 1));
+            p = add_attr (p, p_db, p_rec, 0, p_attr, (uint8_t)(nest_level + 1));
 
             if (!p)
                 return (NULL);
@@ -999,7 +999,7 @@
 
     case TEXT_STR_DESC_TYPE:
     case URL_DESC_TYPE:
-        BE_STREAM_TO_ARRAY (p, p_attr->attr_value.v.array, (INT32)attr_len);
+        BE_STREAM_TO_ARRAY (p, p_attr->attr_value.v.array, (int32_t)attr_len);
         break;
 
     case BOOLEAN_DESC_TYPE:
diff --git a/stack/sdp/sdp_main.c b/stack/sdp/sdp_main.c
index c888817..6cabbb6 100644
--- a/stack/sdp/sdp_main.c
+++ b/stack/sdp/sdp_main.c
@@ -48,23 +48,23 @@
 /********************************************************************************/
 /*                       G L O B A L      S D P       D A T A                   */
 /********************************************************************************/
-#if SDP_DYNAMIC_MEMORY == FALSE
+#if (SDP_DYNAMIC_MEMORY == FALSE)
 tSDP_CB  sdp_cb;
 #endif
 
 /********************************************************************************/
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
-static void sdp_connect_ind (BD_ADDR  bd_addr, UINT16 l2cap_cid, UINT16 psm,
-                             UINT8 l2cap_id);
-static void sdp_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
-static void sdp_config_cfm (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
-static void sdp_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed);
-static void sdp_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg);
+static void sdp_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid, uint16_t psm,
+                             uint8_t l2cap_id);
+static void sdp_config_ind (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
+static void sdp_config_cfm (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg);
+static void sdp_disconnect_ind (uint16_t l2cap_cid, bool    ack_needed);
+static void sdp_data_ind (uint16_t l2cap_cid, BT_HDR *p_msg);
 
-#if SDP_CLIENT_ENABLED == TRUE
-static void sdp_connect_cfm (UINT16 l2cap_cid, UINT16 result);
-static void sdp_disconnect_cfm (UINT16 l2cap_cid, UINT16 result);
+#if (SDP_CLIENT_ENABLED == TRUE)
+static void sdp_connect_cfm (uint16_t l2cap_cid, uint16_t result);
+static void sdp_disconnect_cfm (uint16_t l2cap_cid, uint16_t result);
 #else
 #define sdp_connect_cfm     NULL
 #define sdp_disconnect_cfm  NULL
@@ -86,17 +86,17 @@
     memset (&sdp_cb, 0, sizeof (tSDP_CB));
 
     /* Initialize the L2CAP configuration. We only care about MTU and flush */
-    sdp_cb.l2cap_my_cfg.mtu_present       = TRUE;
+    sdp_cb.l2cap_my_cfg.mtu_present       = true;
     sdp_cb.l2cap_my_cfg.mtu               = SDP_MTU_SIZE;
-    sdp_cb.l2cap_my_cfg.flush_to_present  = TRUE;
+    sdp_cb.l2cap_my_cfg.flush_to_present  = true;
     sdp_cb.l2cap_my_cfg.flush_to          = SDP_FLUSH_TO;
 
     sdp_cb.max_attr_list_size             = SDP_MTU_SIZE - 16;
     sdp_cb.max_recs_per_search            = SDP_MAX_DISC_SERVER_RECS;
 
-#if SDP_SERVER_ENABLED == TRUE
+#if (SDP_SERVER_ENABLED == TRUE)
     /* Register with Security Manager for the specific security level */
-    if (!BTM_SetSecurityLevel (FALSE, SDP_SERVICE_NAME, BTM_SEC_SERVICE_SDP_SERVER,
+    if (!BTM_SetSecurityLevel (false, SDP_SERVICE_NAME, BTM_SEC_SERVICE_SDP_SERVER,
                                SDP_SECURITY_LEVEL, SDP_PSM, 0, 0))
     {
         SDP_TRACE_ERROR ("Security Registration Server failed");
@@ -104,9 +104,9 @@
     }
 #endif
 
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     /* Register with Security Manager for the specific security level */
-    if (!BTM_SetSecurityLevel (TRUE, SDP_SERVICE_NAME, BTM_SEC_SERVICE_SDP_SERVER,
+    if (!BTM_SetSecurityLevel (true, SDP_SERVICE_NAME, BTM_SEC_SERVICE_SDP_SERVER,
                                SDP_SECURITY_LEVEL, SDP_PSM, 0, 0))
     {
         SDP_TRACE_ERROR ("Security Registration for Client failed");
@@ -139,7 +139,7 @@
     }
 }
 
-#if (defined(SDP_DEBUG) && SDP_DEBUG == TRUE)
+#if (SDP_DEBUG == TRUE)
 /*******************************************************************************
 **
 ** Function         sdp_set_max_attr_list_size
@@ -149,7 +149,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-UINT16 sdp_set_max_attr_list_size (UINT16 max_size)
+uint16_t sdp_set_max_attr_list_size (uint16_t max_size)
 {
     if (max_size > (sdp_cb.l2cap_my_cfg.mtu - 16) )
         max_size = sdp_cb.l2cap_my_cfg.mtu - 16;
@@ -171,10 +171,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void sdp_connect_ind (BD_ADDR  bd_addr, UINT16 l2cap_cid, UINT16 psm, UINT8 l2cap_id)
+static void sdp_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid, uint16_t psm, uint8_t l2cap_id)
 {
     UNUSED(psm);
-#if SDP_SERVER_ENABLED == TRUE
+#if (SDP_SERVER_ENABLED == TRUE)
     tCONN_CB    *p_ccb;
 
     /* Allocate a new CCB. Return if none available. */
@@ -205,7 +205,7 @@
         {
             /* FCR not desired; try again in basic mode */
             cfg.fcr.mode = L2CAP_FCR_BASIC_MODE;
-            cfg.fcr_present = FALSE;
+            cfg.fcr_present = false;
             L2CA_ConfigReq (l2cap_cid, &cfg);
         }
     }
@@ -217,7 +217,7 @@
 #endif
 }
 
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
 /*******************************************************************************
 **
 ** Function         sdp_connect_cfm
@@ -229,7 +229,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void sdp_connect_cfm (UINT16 l2cap_cid, UINT16 result)
+static void sdp_connect_cfm (uint16_t l2cap_cid, uint16_t result)
 {
     tCONN_CB    *p_ccb;
     tL2CAP_CFG_INFO cfg;
@@ -260,7 +260,7 @@
              && cfg.fcr.mode != L2CAP_FCR_BASIC_MODE)
         {
             /* FCR not desired; try again in basic mode */
-            cfg.fcr_present = FALSE;
+            cfg.fcr_present = false;
             cfg.fcr.mode = L2CAP_FCR_BASIC_MODE;
             L2CA_ConfigReq (l2cap_cid, &cfg);
         }
@@ -274,7 +274,7 @@
         /* Tell the user if he has a callback */
         if (p_ccb->p_cb || p_ccb->p_cb2)
         {
-            UINT16 err = -1;
+            uint16_t err = -1;
             if ((result == HCI_ERR_HOST_REJECT_SECURITY)
              || (result == HCI_ERR_AUTH_FAILURE)
              || (result == HCI_ERR_PAIRING_NOT_ALLOWED)
@@ -307,7 +307,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void sdp_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
+static void sdp_config_ind (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
 {
     tCONN_CB    *p_ccb;
 
@@ -333,8 +333,8 @@
     }
 
     /* For now, always accept configuration from the other side */
-    p_cfg->flush_to_present = FALSE;
-    p_cfg->mtu_present      = FALSE;
+    p_cfg->flush_to_present = false;
+    p_cfg->mtu_present      = false;
     p_cfg->result           = L2CAP_CFG_OK;
 
     /* Check peer config request against our rfcomm configuration */
@@ -368,7 +368,7 @@
             }
         }
         else    /* We agree with peer's request */
-            p_cfg->fcr_present = FALSE;
+            p_cfg->fcr_present = false;
     }
 
     L2CA_ConfigRsp (l2cap_cid, p_cfg);
@@ -402,7 +402,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void sdp_config_cfm (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
+static void sdp_config_cfm (uint16_t l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
 {
     tCONN_CB    *p_ccb;
 
@@ -440,14 +440,14 @@
         if (p_cfg->fcr_present)
         {
             tL2CAP_CFG_INFO cfg = sdp_cb.l2cap_my_cfg;
-            cfg.fcr_present = FALSE;
+            cfg.fcr_present = false;
             L2CA_ConfigReq (l2cap_cid, &cfg);
 
             /* Remain in configure state */
             return;
         }
 
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
         sdp_disconnect(p_ccb, SDP_CFG_FAILED);
 #endif
     }
@@ -463,7 +463,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void sdp_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed)
+static void sdp_disconnect_ind (uint16_t l2cap_cid, bool    ack_needed)
 {
     tCONN_CB    *p_ccb;
 
@@ -478,13 +478,13 @@
         L2CA_DisconnectRsp (l2cap_cid);
 
     SDP_TRACE_EVENT ("SDP - Rcvd L2CAP disc, CID: 0x%x", l2cap_cid);
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     /* Tell the user if he has a callback */
     if (p_ccb->p_cb)
-        (*p_ccb->p_cb) ((UINT16) ((p_ccb->con_state == SDP_STATE_CONNECTED) ?
+        (*p_ccb->p_cb) ((uint16_t) ((p_ccb->con_state == SDP_STATE_CONNECTED) ?
                         SDP_SUCCESS : SDP_CONN_FAILED));
     else if (p_ccb->p_cb2)
-        (*p_ccb->p_cb2) ((UINT16) ((p_ccb->con_state == SDP_STATE_CONNECTED) ?
+        (*p_ccb->p_cb2) ((uint16_t) ((p_ccb->con_state == SDP_STATE_CONNECTED) ?
                         SDP_SUCCESS : SDP_CONN_FAILED), p_ccb->user_data);
 
 #endif
@@ -506,7 +506,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void sdp_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg)
+static void sdp_data_ind (uint16_t l2cap_cid, BT_HDR *p_msg)
 {
     tCONN_CB    *p_ccb;
 
@@ -535,7 +535,7 @@
 }
 
 
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
 /*******************************************************************************
 **
 ** Function         sdp_conn_originate
@@ -546,10 +546,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-tCONN_CB* sdp_conn_originate (UINT8 *p_bd_addr)
+tCONN_CB* sdp_conn_originate (uint8_t *p_bd_addr)
 {
     tCONN_CB              *p_ccb;
-    UINT16                cid;
+    uint16_t              cid;
 
     /* Allocate a new CCB. Return if none available. */
     if ((p_ccb = sdpu_allocate_ccb()) == NULL)
@@ -595,9 +595,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void sdp_disconnect (tCONN_CB*p_ccb, UINT16 reason)
+void sdp_disconnect (tCONN_CB*p_ccb, uint16_t reason)
 {
-#if (defined(SDP_BROWSE_PLUS) && SDP_BROWSE_PLUS == TRUE)
+#if (SDP_BROWSE_PLUS == TRUE)
 
     /* If we are browsing for multiple UUIDs ... */
     if ((p_ccb->con_state == SDP_STATE_CONNECTED)
@@ -670,7 +670,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void sdp_disconnect_cfm (UINT16 l2cap_cid, UINT16 result)
+static void sdp_disconnect_cfm (uint16_t l2cap_cid, uint16_t result)
 {
     tCONN_CB    *p_ccb;
     UNUSED(result);
@@ -714,7 +714,7 @@
                       p_ccb->con_state, p_ccb->connection_id);
 
     L2CA_DisconnectReq (p_ccb->connection_id);
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     /* Tell the user if he has a callback */
     if (p_ccb->p_cb)
         (*p_ccb->p_cb) (SDP_CONN_FAILED);
diff --git a/stack/sdp/sdp_server.c b/stack/sdp/sdp_server.c
index 627f4cf..40a2abf 100644
--- a/stack/sdp/sdp_server.c
+++ b/stack/sdp/sdp_server.c
@@ -40,7 +40,7 @@
 #include "sdpint.h"
 
 
-#if SDP_SERVER_ENABLED == TRUE
+#if (SDP_SERVER_ENABLED == TRUE)
 
 extern fixed_queue_t *btu_general_alarm_queue;
 
@@ -52,17 +52,17 @@
 /********************************************************************************/
 /*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /********************************************************************************/
-static void process_service_search (tCONN_CB *p_ccb, UINT16 trans_num,
-                                    UINT16 param_len, UINT8 *p_req,
-                                    UINT8 *p_req_end);
+static void process_service_search (tCONN_CB *p_ccb, uint16_t trans_num,
+                                    uint16_t param_len, uint8_t *p_req,
+                                    uint8_t *p_req_end);
 
-static void process_service_attr_req (tCONN_CB *p_ccb, UINT16 trans_num,
-                                      UINT16 param_len, UINT8 *p_req,
-                                      UINT8 *p_req_end);
+static void process_service_attr_req (tCONN_CB *p_ccb, uint16_t trans_num,
+                                      uint16_t param_len, uint8_t *p_req,
+                                      uint8_t *p_req_end);
 
-static void process_service_search_attr_req (tCONN_CB *p_ccb, UINT16 trans_num,
-                                             UINT16 param_len, UINT8 *p_req,
-                                             UINT8 *p_req_end);
+static void process_service_search_attr_req (tCONN_CB *p_ccb, uint16_t trans_num,
+                                             uint16_t param_len, uint8_t *p_req,
+                                             uint8_t *p_req_end);
 
 
 /********************************************************************************/
@@ -116,10 +116,10 @@
 *******************************************************************************/
 void sdp_server_handle_client_req (tCONN_CB *p_ccb, BT_HDR *p_msg)
 {
-    UINT8   *p_req     = (UINT8 *) (p_msg + 1) + p_msg->offset;
-    UINT8   *p_req_end = p_req + p_msg->len;
-    UINT8   pdu_id;
-    UINT16  trans_num, param_len;
+    uint8_t *p_req     = (uint8_t *) (p_msg + 1) + p_msg->offset;
+    uint8_t *p_req_end = p_req + p_msg->len;
+    uint8_t pdu_id;
+    uint16_t trans_num, param_len;
 
 
     /* Start inactivity timer */
@@ -173,17 +173,17 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void process_service_search (tCONN_CB *p_ccb, UINT16 trans_num,
-                                    UINT16 param_len, UINT8 *p_req,
-                                    UINT8 *p_req_end)
+static void process_service_search (tCONN_CB *p_ccb, uint16_t trans_num,
+                                    uint16_t param_len, uint8_t *p_req,
+                                    uint8_t *p_req_end)
 {
-    UINT16          max_replies, cur_handles, rem_handles, cont_offset;
+    uint16_t        max_replies, cur_handles, rem_handles, cont_offset;
     tSDP_UUID_SEQ   uid_seq;
-    UINT8           *p_rsp, *p_rsp_start, *p_rsp_param_len;
-    UINT16          rsp_param_len, num_rsp_handles, xx;
-    UINT32          rsp_handles[SDP_MAX_RECORDS] = {0};
+    uint8_t         *p_rsp, *p_rsp_start, *p_rsp_param_len;
+    uint16_t        rsp_param_len, num_rsp_handles, xx;
+    uint32_t        rsp_handles[SDP_MAX_RECORDS] = {0};
     tSDP_RECORD    *p_rec = NULL;
-    BOOLEAN         is_cont = FALSE;
+    bool            is_cont = false;
     UNUSED(p_req_end);
 
     p_req = sdpu_extract_uid_seq (p_req, param_len, &uid_seq);
@@ -247,20 +247,20 @@
     }
 
     /* Calculate how many handles will fit in one PDU */
-    cur_handles = (UINT16)((p_ccb->rem_mtu_size - SDP_MAX_SERVICE_RSPHDR_LEN) / 4);
+    cur_handles = (uint16_t)((p_ccb->rem_mtu_size - SDP_MAX_SERVICE_RSPHDR_LEN) / 4);
 
     if (rem_handles <= cur_handles)
         cur_handles = rem_handles;
     else /* Continuation is set */
     {
         p_ccb->cont_offset += cur_handles;
-        is_cont = TRUE;
+        is_cont = true;
     }
 
     /* Get a buffer to use to build the response */
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(SDP_DATA_BUF_SIZE);
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p_rsp = p_rsp_start = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p_rsp = p_rsp_start = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* Start building a rsponse */
     UINT8_TO_BE_STREAM  (p_rsp, SDP_PDU_SERVICE_SEARCH_RSP);
@@ -312,20 +312,20 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void process_service_attr_req (tCONN_CB *p_ccb, UINT16 trans_num,
-                                      UINT16 param_len, UINT8 *p_req,
-                                      UINT8 *p_req_end)
+static void process_service_attr_req (tCONN_CB *p_ccb, uint16_t trans_num,
+                                      uint16_t param_len, uint8_t *p_req,
+                                      uint8_t *p_req_end)
 {
-    UINT16          max_list_len, len_to_send, cont_offset;
-    INT16           rem_len;
+    uint16_t        max_list_len, len_to_send, cont_offset;
+    int16_t         rem_len;
     tSDP_ATTR_SEQ   attr_seq, attr_seq_sav;
-    UINT8           *p_rsp, *p_rsp_start, *p_rsp_param_len;
-    UINT16          rsp_param_len, xx;
-    UINT32          rec_handle;
+    uint8_t         *p_rsp, *p_rsp_start, *p_rsp_param_len;
+    uint16_t        rsp_param_len, xx;
+    uint32_t        rec_handle;
     tSDP_RECORD     *p_rec;
     tSDP_ATTRIBUTE  *p_attr;
-    BOOLEAN         is_cont = FALSE;
-    UINT16          attr_len;
+    bool            is_cont = false;
+    uint16_t        attr_len;
 
     /* Extract the record handle */
     BE_STREAM_TO_UINT32 (rec_handle, p_req);
@@ -362,7 +362,7 @@
 
     /* Free and reallocate buffer */
     osi_free(p_ccb->rsp_list);
-    p_ccb->rsp_list = (UINT8 *)osi_malloc(max_list_len);
+    p_ccb->rsp_list = (uint8_t *)osi_malloc(max_list_len);
 
     /* Check if this is a continuation request */
     if (*p_req) {
@@ -378,7 +378,7 @@
                                     SDP_TEXT_BAD_CONT_INX);
             return;
         }
-        is_cont = TRUE;
+        is_cont = true;
 
         /* Initialise for continuation response */
         p_rsp = &p_ccb->rsp_list[0];
@@ -402,7 +402,7 @@
         if (p_attr)
         {
             /* Check if attribute fits. Assume 3-byte value type/length */
-            rem_len = max_list_len - (INT16) (p_rsp - &p_ccb->rsp_list[0]);
+            rem_len = max_list_len - (int16_t) (p_rsp - &p_ccb->rsp_list[0]);
 
             /* just in case */
             if (rem_len <= 0)
@@ -435,7 +435,7 @@
                 }
 
                 /* add the partial attribute if possible */
-                p_rsp = sdpu_build_partial_attrib_entry (p_rsp, p_attr, (UINT16)rem_len,
+                p_rsp = sdpu_build_partial_attrib_entry (p_rsp, p_attr, (uint16_t)rem_len,
                                                          &p_ccb->cont_info.attr_offset);
 
                 p_ccb->cont_info.next_attr_index = xx;
@@ -460,7 +460,7 @@
     if (xx == attr_seq.num_attr)
         p_ccb->cont_info.next_attr_index = 0;
 
-    len_to_send = (UINT16) (p_rsp - &p_ccb->rsp_list[0]);
+    len_to_send = (uint16_t) (p_rsp - &p_ccb->rsp_list[0]);
     cont_offset = 0;
 
     if (!is_cont)
@@ -469,16 +469,16 @@
         /* Put in the sequence header (2 or 3 bytes) */
         if (p_ccb->list_len > 255)
         {
-            p_ccb->rsp_list[0] = (UINT8) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_WORD);
-            p_ccb->rsp_list[1] = (UINT8) ((p_ccb->list_len - 3) >> 8);
-            p_ccb->rsp_list[2] = (UINT8) (p_ccb->list_len - 3);
+            p_ccb->rsp_list[0] = (uint8_t) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_WORD);
+            p_ccb->rsp_list[1] = (uint8_t) ((p_ccb->list_len - 3) >> 8);
+            p_ccb->rsp_list[2] = (uint8_t) (p_ccb->list_len - 3);
         }
         else
         {
             cont_offset = 1;
 
-            p_ccb->rsp_list[1] = (UINT8) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE);
-            p_ccb->rsp_list[2] = (UINT8) (p_ccb->list_len - 3);
+            p_ccb->rsp_list[1] = (uint8_t) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE);
+            p_ccb->rsp_list[2] = (uint8_t) (p_ccb->list_len - 3);
 
             p_ccb->list_len--;
             len_to_send--;
@@ -488,7 +488,7 @@
     /* Get a buffer to use to build the response */
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(SDP_DATA_BUF_SIZE);
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p_rsp = p_rsp_start = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p_rsp = p_rsp_start = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* Start building a rsponse */
     UINT8_TO_BE_STREAM  (p_rsp, SDP_PDU_SERVICE_ATTR_RSP);
@@ -508,7 +508,7 @@
     /* If anything left to send, continuation needed */
     if (p_ccb->cont_offset < p_ccb->list_len)
     {
-        is_cont = TRUE;
+        is_cont = true;
 
         UINT8_TO_BE_STREAM  (p_rsp, SDP_CONTINUATION_LEN);
         UINT16_TO_BE_STREAM (p_rsp, p_ccb->cont_offset);
@@ -541,22 +541,22 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void process_service_search_attr_req (tCONN_CB *p_ccb, UINT16 trans_num,
-                                             UINT16 param_len, UINT8 *p_req,
-                                             UINT8 *p_req_end)
+static void process_service_search_attr_req (tCONN_CB *p_ccb, uint16_t trans_num,
+                                             uint16_t param_len, uint8_t *p_req,
+                                             uint8_t *p_req_end)
 {
-    UINT16         max_list_len;
-    INT16          rem_len;
-    UINT16         len_to_send, cont_offset;
+    uint16_t       max_list_len;
+    int16_t        rem_len;
+    uint16_t       len_to_send, cont_offset;
     tSDP_UUID_SEQ   uid_seq;
-    UINT8           *p_rsp, *p_rsp_start, *p_rsp_param_len;
-    UINT16          rsp_param_len, xx;
+    uint8_t         *p_rsp, *p_rsp_start, *p_rsp_param_len;
+    uint16_t        rsp_param_len, xx;
     tSDP_RECORD    *p_rec;
     tSDP_ATTR_SEQ   attr_seq, attr_seq_sav;
     tSDP_ATTRIBUTE *p_attr;
-    BOOLEAN         maxxed_out = FALSE, is_cont = FALSE;
-    UINT8           *p_seq_start;
-    UINT16          seq_len, attr_len;
+    bool            maxxed_out = false, is_cont = false;
+    uint8_t         *p_seq_start;
+    uint16_t        seq_len, attr_len;
     UNUSED(p_req_end);
 
     /* Extract the UUID sequence to search for */
@@ -586,7 +586,7 @@
 
     /* Free and reallocate buffer */
     osi_free(p_ccb->rsp_list);
-    p_ccb->rsp_list = (UINT8 *)osi_malloc(max_list_len);
+    p_ccb->rsp_list = (uint8_t *)osi_malloc(max_list_len);
 
     /* Check if this is a continuation request */
     if (*p_req) {
@@ -602,7 +602,7 @@
                                      SDP_TEXT_BAD_CONT_INX);
             return;
         }
-        is_cont = TRUE;
+        is_cont = true;
 
         /* Initialise for continuation response */
         p_rsp = &p_ccb->rsp_list[0];
@@ -615,7 +615,7 @@
         /* Reset continuation parameters in p_ccb */
         p_ccb->cont_info.prev_sdp_rec = NULL;
         p_ccb->cont_info.next_attr_index = 0;
-        p_ccb->cont_info.last_attr_seq_desc_sent = FALSE;
+        p_ccb->cont_info.last_attr_seq_desc_sent = false;
         p_ccb->cont_info.attr_offset = 0;
     }
 
@@ -624,10 +624,10 @@
     {
         /* Allow space for attribute sequence type and length */
         p_seq_start = p_rsp;
-        if (p_ccb->cont_info.last_attr_seq_desc_sent == FALSE)
+        if (p_ccb->cont_info.last_attr_seq_desc_sent == false)
         {
             /* See if there is enough room to include a new service in the current response */
-            rem_len = max_list_len - (INT16) (p_rsp - &p_ccb->rsp_list[0]);
+            rem_len = max_list_len - (int16_t) (p_rsp - &p_ccb->rsp_list[0]);
             if (rem_len < 3)
             {
                 /* Not enough room. Update continuation info for next response */
@@ -646,14 +646,14 @@
             if (p_attr)
             {
                 /* Check if attribute fits. Assume 3-byte value type/length */
-                rem_len = max_list_len - (INT16) (p_rsp - &p_ccb->rsp_list[0]);
+                rem_len = max_list_len - (int16_t) (p_rsp - &p_ccb->rsp_list[0]);
 
                 /* just in case */
                 if (rem_len <= 0)
                 {
                     p_ccb->cont_info.next_attr_index = xx;
                     p_ccb->cont_info.next_attr_start_id = p_attr->id;
-                    maxxed_out = TRUE;
+                    maxxed_out = true;
                     break;
                 }
 
@@ -667,7 +667,7 @@
                     /* If the partial attrib could not been fully added yet */
                     if (p_ccb->cont_info.attr_offset != attr_len)
                     {
-                        maxxed_out = TRUE;
+                        maxxed_out = true;
                         break;
                     }
                     else /* If the partial attrib has been added in full by now */
@@ -683,12 +683,12 @@
                     }
 
                     /* add the partial attribute if possible */
-                    p_rsp = sdpu_build_partial_attrib_entry (p_rsp, p_attr, (UINT16)rem_len,
+                    p_rsp = sdpu_build_partial_attrib_entry (p_rsp, p_attr, (uint16_t)rem_len,
                                                              &p_ccb->cont_info.attr_offset);
 
                     p_ccb->cont_info.next_attr_index = xx;
                     p_ccb->cont_info.next_attr_start_id = p_attr->id;
-                    maxxed_out = TRUE;
+                    maxxed_out = true;
                     break;
                 }
                 else /* build the whole attribute */
@@ -706,7 +706,7 @@
         }
 
         /* Go back and put the type and length into the buffer */
-        if (p_ccb->cont_info.last_attr_seq_desc_sent == FALSE)
+        if (p_ccb->cont_info.last_attr_seq_desc_sent == false)
         {
             seq_len = sdpu_get_attrib_seq_len(p_rec, &attr_seq_sav);
             if (seq_len != 0)
@@ -715,7 +715,7 @@
                 UINT16_TO_BE_STREAM (p_seq_start, seq_len);
 
                 if (maxxed_out)
-                    p_ccb->cont_info.last_attr_seq_desc_sent = TRUE;
+                    p_ccb->cont_info.last_attr_seq_desc_sent = true;
             }
             else
                 p_rsp = p_seq_start;
@@ -730,11 +730,11 @@
         /* Reset the next attr index */
         p_ccb->cont_info.next_attr_index = 0;
         p_ccb->cont_info.prev_sdp_rec = p_rec;
-        p_ccb->cont_info.last_attr_seq_desc_sent = FALSE;
+        p_ccb->cont_info.last_attr_seq_desc_sent = false;
     }
 
     /* response length */
-    len_to_send = (UINT16) (p_rsp - &p_ccb->rsp_list[0]);
+    len_to_send = (uint16_t) (p_rsp - &p_ccb->rsp_list[0]);
     cont_offset = 0;
 
     // The current SDP server design has a critical flaw where it can run into an infinite
@@ -766,16 +766,16 @@
         /* Put in the sequence header (2 or 3 bytes) */
         if (p_ccb->list_len > 255)
         {
-            p_ccb->rsp_list[0] = (UINT8) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_WORD);
-            p_ccb->rsp_list[1] = (UINT8) ((p_ccb->list_len - 3) >> 8);
-            p_ccb->rsp_list[2] = (UINT8) (p_ccb->list_len - 3);
+            p_ccb->rsp_list[0] = (uint8_t) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_WORD);
+            p_ccb->rsp_list[1] = (uint8_t) ((p_ccb->list_len - 3) >> 8);
+            p_ccb->rsp_list[2] = (uint8_t) (p_ccb->list_len - 3);
         }
         else
         {
             cont_offset = 1;
 
-            p_ccb->rsp_list[1] = (UINT8) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE);
-            p_ccb->rsp_list[2] = (UINT8) (p_ccb->list_len - 3);
+            p_ccb->rsp_list[1] = (uint8_t) ((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE);
+            p_ccb->rsp_list[2] = (uint8_t) (p_ccb->list_len - 3);
 
             p_ccb->list_len--;
             len_to_send--;
@@ -785,7 +785,7 @@
     /* Get a buffer to use to build the response */
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(SDP_DATA_BUF_SIZE);
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p_rsp = p_rsp_start = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p_rsp = p_rsp_start = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     /* Start building a rsponse */
     UINT8_TO_BE_STREAM  (p_rsp, SDP_PDU_SERVICE_SEARCH_ATTR_RSP);
@@ -807,7 +807,7 @@
     /* If anything left to send, continuation needed */
     if (p_ccb->cont_offset < p_ccb->list_len)
     {
-        is_cont = TRUE;
+        is_cont = true;
 
         UINT8_TO_BE_STREAM  (p_rsp, SDP_CONTINUATION_LEN);
         UINT16_TO_BE_STREAM (p_rsp, p_ccb->cont_offset);
diff --git a/stack/sdp/sdp_utils.c b/stack/sdp/sdp_utils.c
index a6f0ba6..407f828 100644
--- a/stack/sdp/sdp_utils.c
+++ b/stack/sdp/sdp_utils.c
@@ -40,8 +40,8 @@
 #include "btu.h"
 
 
-static const UINT8  sdp_base_uuid[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-                                       0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+static const uint8_t sdp_base_uuid[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
+                                        0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
 
 /*******************************************************************************
 **
@@ -53,9 +53,9 @@
 ** Returns          the CCB address, or NULL if not found.
 **
 *******************************************************************************/
-tCONN_CB *sdpu_find_ccb_by_cid (UINT16 cid)
+tCONN_CB *sdpu_find_ccb_by_cid (uint16_t cid)
 {
-    UINT16       xx;
+    uint16_t     xx;
     tCONN_CB     *p_ccb;
 
     /* Look through each connection control block */
@@ -82,8 +82,8 @@
 *******************************************************************************/
 tCONN_CB *sdpu_find_ccb_by_db (tSDP_DISCOVERY_DB *p_db)
 {
-#if SDP_CLIENT_ENABLED == TRUE
-    UINT16       xx;
+#if (SDP_CLIENT_ENABLED == TRUE)
+    uint16_t     xx;
     tCONN_CB     *p_ccb;
 
     if (p_db)
@@ -112,7 +112,7 @@
 *******************************************************************************/
 tCONN_CB *sdpu_allocate_ccb (void)
 {
-    UINT16       xx;
+    uint16_t     xx;
     tCONN_CB     *p_ccb;
 
     /* Look through each connection control block for a free one */
@@ -148,8 +148,8 @@
 
     /* Drop any response pointer we may be holding */
     p_ccb->con_state = SDP_STATE_IDLE;
-#if SDP_CLIENT_ENABLED == TRUE
-    p_ccb->is_attr_search = FALSE;
+#if (SDP_CLIENT_ENABLED == TRUE)
+    p_ccb->is_attr_search = false;
 #endif
 
     /* Free the response buffer */
@@ -170,9 +170,9 @@
 ** Returns          Pointer to next byte in the output buffer.
 **
 *******************************************************************************/
-UINT8 *sdpu_build_attrib_seq (UINT8 *p_out, UINT16 *p_attr, UINT16 num_attrs)
+uint8_t *sdpu_build_attrib_seq (uint8_t *p_out, uint16_t *p_attr, uint16_t num_attrs)
 {
-    UINT16  xx;
+    uint16_t xx;
 
     /* First thing is the data element header. See if the length fits 1 byte */
     /* If no attributes, assume a 4-byte wildcard */
@@ -224,7 +224,7 @@
 ** Returns          Pointer to next byte in the output buffer.
 **
 *******************************************************************************/
-UINT8 *sdpu_build_attrib_entry (UINT8 *p_out, tSDP_ATTRIBUTE *p_attr)
+uint8_t *sdpu_build_attrib_entry (uint8_t *p_out, tSDP_ATTRIBUTE *p_attr)
 {
     /* First, store the attribute ID. Goes as a UINT */
     UINT8_TO_BE_STREAM  (p_out, (UINT_DESC_TYPE << 3) | SIZE_TWO_BYTES);
@@ -309,10 +309,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void sdpu_build_n_send_error (tCONN_CB *p_ccb, UINT16 trans_num, UINT16 error_code, char *p_error_text)
+void sdpu_build_n_send_error (tCONN_CB *p_ccb, uint16_t trans_num, uint16_t error_code, char *p_error_text)
 {
-    UINT8           *p_rsp, *p_rsp_start, *p_rsp_param_len;
-    UINT16          rsp_param_len;
+    uint8_t         *p_rsp, *p_rsp_start, *p_rsp_param_len;
+    uint16_t        rsp_param_len;
     BT_HDR          *p_buf = (BT_HDR *)osi_malloc(SDP_DATA_BUF_SIZE);
 
 
@@ -321,7 +321,7 @@
 
     /* Send the packet to L2CAP */
     p_buf->offset = L2CAP_MIN_OFFSET;
-    p_rsp = p_rsp_start = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p_rsp = p_rsp_start = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     UINT8_TO_BE_STREAM(p_rsp, SDP_PDU_ERROR_RESPONSE);
     UINT16_TO_BE_STREAM(p_rsp, trans_num);
@@ -359,11 +359,11 @@
 ** Returns          Pointer to next byte in the input buffer after the sequence.
 **
 *******************************************************************************/
-UINT8 *sdpu_extract_uid_seq (UINT8 *p, UINT16 param_len, tSDP_UUID_SEQ *p_seq)
+uint8_t *sdpu_extract_uid_seq (uint8_t *p, uint16_t param_len, tSDP_UUID_SEQ *p_seq)
 {
-    UINT8   *p_seq_end;
-    UINT8   descr, type, size;
-    UINT32  seq_len, uuid_len;
+    uint8_t *p_seq_end;
+    uint8_t descr, type, size;
+    uint32_t seq_len, uuid_len;
 
     /* Assume none found */
     p_seq->num_uids = 0;
@@ -443,7 +443,7 @@
         /* If UUID length is valid, copy it across */
         if ((uuid_len == 2) || (uuid_len == 4) || (uuid_len == 16))
         {
-            p_seq->uuid_entry[p_seq->num_uids].len = (UINT16) uuid_len;
+            p_seq->uuid_entry[p_seq->num_uids].len = (uint16_t) uuid_len;
             BE_STREAM_TO_ARRAY (p, p_seq->uuid_entry[p_seq->num_uids].value, (int)uuid_len);
             p_seq->num_uids++;
         }
@@ -473,11 +473,11 @@
 ** Returns          Pointer to next byte in the input buffer after the sequence.
 **
 *******************************************************************************/
-UINT8 *sdpu_extract_attr_seq (UINT8 *p, UINT16 param_len, tSDP_ATTR_SEQ *p_seq)
+uint8_t *sdpu_extract_attr_seq (uint8_t *p, uint16_t param_len, tSDP_ATTR_SEQ *p_seq)
 {
-    UINT8   *p_end_list;
-    UINT8   descr, type, size;
-    UINT32  list_len, attr_len;
+    uint8_t *p_end_list;
+    uint8_t descr, type, size;
+    uint32_t list_len, attr_len;
 
     /* Assume none found */
     p_seq->num_attr = 0;
@@ -577,11 +577,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-UINT8 *sdpu_get_len_from_type (UINT8 *p, UINT8 type, UINT32 *p_len)
+uint8_t *sdpu_get_len_from_type (uint8_t *p, uint8_t type, uint32_t *p_len)
 {
-    UINT8   u8;
-    UINT16  u16;
-    UINT32  u32;
+    uint8_t u8;
+    uint16_t u16;
+    uint32_t u32;
 
     switch (type & 7)
     {
@@ -610,7 +610,7 @@
         break;
     case SIZE_IN_NEXT_LONG:
         BE_STREAM_TO_UINT32 (u32, p);
-        *p_len = (UINT16) u32;
+        *p_len = (uint16_t) u32;
         break;
     }
 
@@ -625,19 +625,19 @@
 ** Description      This function checks a 128-bit UUID with the base to see if
 **                  it matches. Only the last 12 bytes are compared.
 **
-** Returns          TRUE if matched, else FALSE
+** Returns          true if matched, else false
 **
 *******************************************************************************/
-BOOLEAN sdpu_is_base_uuid (UINT8 *p_uuid)
+bool    sdpu_is_base_uuid (uint8_t *p_uuid)
 {
-    UINT16    xx;
+    uint16_t  xx;
 
     for (xx = 4; xx < MAX_UUID_SIZE; xx++)
         if (p_uuid[xx] != sdp_base_uuid[xx])
-            return (FALSE);
+            return (false);
 
     /* If here, matched */
-    return (TRUE);
+    return (true);
 }
 
 
@@ -650,19 +650,19 @@
 **
 ** NOTE             it is assumed that the arrays are in Big Endian format
 **
-** Returns          TRUE if matched, else FALSE
+** Returns          true if matched, else false
 **
 *******************************************************************************/
-BOOLEAN sdpu_compare_uuid_arrays (UINT8 *p_uuid1, UINT32 len1, UINT8 *p_uuid2, UINT16 len2)
+bool    sdpu_compare_uuid_arrays (uint8_t *p_uuid1, uint32_t len1, uint8_t *p_uuid2, uint16_t len2)
 {
-    UINT8       nu1[MAX_UUID_SIZE];
-    UINT8       nu2[MAX_UUID_SIZE];
+    uint8_t     nu1[MAX_UUID_SIZE];
+    uint8_t     nu2[MAX_UUID_SIZE];
 
     if( ((len1 != 2) && (len1 != 4) && (len1 != 16)) ||
         ((len2 != 2) && (len2 != 4) && (len2 != 16)) )
     {
         SDP_TRACE_ERROR("%s: invalid length", __func__);
-        return FALSE;
+        return false;
     }
 
     /* If lengths match, do a straight compare */
@@ -733,10 +733,10 @@
 ** NOTE             it is assumed that BT UUID structures are compressed to the
 **                  smallest possible UUIDs (by removing the base SDP UUID)
 **
-** Returns          TRUE if matched, else FALSE
+** Returns          true if matched, else false
 **
 *******************************************************************************/
-BOOLEAN sdpu_compare_bt_uuids (tBT_UUID *p_uuid1, tBT_UUID *p_uuid2)
+bool    sdpu_compare_bt_uuids (tBT_UUID *p_uuid1, tBT_UUID *p_uuid2)
 {
     /* Lengths must match for BT UUIDs to match */
     if (p_uuid1->len == p_uuid2->len)
@@ -746,10 +746,10 @@
         else if (p_uuid1->len == 4)
             return (p_uuid1->uu.uuid32 == p_uuid2->uu.uuid32);
         else if (!memcmp (p_uuid1->uu.uuid128, p_uuid2->uu.uuid128, 16))
-            return (TRUE);
+            return (true);
     }
 
-    return (FALSE);
+    return (false);
 }
 
 
@@ -766,33 +766,33 @@
 **                - it is also assumed that the discovery atribute is compressed
 **                  to the smallest possible
 **
-** Returns          TRUE if matched, else FALSE
+** Returns          true if matched, else false
 **
 *******************************************************************************/
-BOOLEAN sdpu_compare_uuid_with_attr (tBT_UUID *p_btuuid, tSDP_DISC_ATTR *p_attr)
+bool    sdpu_compare_uuid_with_attr (tBT_UUID *p_btuuid, tSDP_DISC_ATTR *p_attr)
 {
-    UINT16      attr_len = SDP_DISC_ATTR_LEN (p_attr->attr_len_type);
+    uint16_t    attr_len = SDP_DISC_ATTR_LEN (p_attr->attr_len_type);
 
     /* Since both UUIDs are compressed, lengths must match  */
     if (p_btuuid->len != attr_len)
-        return (FALSE);
+        return (false);
 
     if (p_btuuid->len == 2)
-        return (BOOLEAN)(p_btuuid->uu.uuid16 == p_attr->attr_value.v.u16);
+        return (bool   )(p_btuuid->uu.uuid16 == p_attr->attr_value.v.u16);
     else if (p_btuuid->len == 4)
-        return (BOOLEAN)(p_btuuid->uu.uuid32 == p_attr->attr_value.v.u32);
+        return (bool   )(p_btuuid->uu.uuid32 == p_attr->attr_value.v.u32);
     /* coverity[overrun-buffer-arg] */
     /*
        Event overrun-buffer-arg: Overrun of static array "&p_attr->attr_value.v.array" of size 4 bytes by passing it to a function which indexes it with argument "16U" at byte position 15
-       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.
        False-positive: SDP uses scratch buffer to hold the attribute value.
        The actual size of tSDP_DISC_ATVAL does not matter.
        If the array size in tSDP_DISC_ATVAL is increase, we would increase the system RAM usage unnecessarily
     */
     else if (!memcmp (p_btuuid->uu.uuid128,(void*) p_attr->attr_value.v.array, MAX_UUID_SIZE))
-        return (TRUE);
+        return (true);
 
-    return (FALSE);
+    return (false);
 }
 
 /*******************************************************************************
@@ -805,10 +805,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void sdpu_sort_attr_list( UINT16 num_attr, tSDP_DISCOVERY_DB *p_db )
+void sdpu_sort_attr_list( uint16_t num_attr, tSDP_DISCOVERY_DB *p_db )
 {
-    UINT16 i;
-    UINT16 x;
+    uint16_t i;
+    uint16_t x;
 
     /* Done if no attributes to sort */
     if (num_attr <= 1)
@@ -848,11 +848,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-UINT16 sdpu_get_list_len(tSDP_UUID_SEQ *uid_seq, tSDP_ATTR_SEQ *attr_seq)
+uint16_t sdpu_get_list_len(tSDP_UUID_SEQ *uid_seq, tSDP_ATTR_SEQ *attr_seq)
 {
     tSDP_RECORD    *p_rec;
-    UINT16 len = 0;
-    UINT16 len1;
+    uint16_t len = 0;
+    uint16_t len1;
 
     for (p_rec = sdp_db_service_search (NULL, uid_seq); p_rec; p_rec = sdp_db_service_search (p_rec, uid_seq))
     {
@@ -878,17 +878,17 @@
 ** Returns          void
 **
 *******************************************************************************/
-UINT16 sdpu_get_attrib_seq_len(tSDP_RECORD *p_rec, tSDP_ATTR_SEQ *attr_seq)
+uint16_t sdpu_get_attrib_seq_len(tSDP_RECORD *p_rec, tSDP_ATTR_SEQ *attr_seq)
 {
     tSDP_ATTRIBUTE *p_attr;
-    UINT16 len1 = 0;
-    UINT16 xx;
-    BOOLEAN is_range = FALSE;
-    UINT16 start_id=0, end_id=0;
+    uint16_t len1 = 0;
+    uint16_t xx;
+    bool    is_range = false;
+    uint16_t start_id=0, end_id=0;
 
     for (xx = 0; xx < attr_seq->num_attr; xx++)
     {
-        if (is_range == FALSE)
+        if (is_range == false)
         {
             start_id = attr_seq->attr_entry[xx].start;
             end_id = attr_seq->attr_entry[xx].end;
@@ -906,13 +906,13 @@
                 /* Update for next time through */
                 start_id = p_attr->id + 1;
                 xx--;
-                is_range = TRUE;
+                is_range = true;
             }
             else
-                is_range = FALSE;
+                is_range = false;
         }
         else
-            is_range = FALSE;
+            is_range = false;
     }
     return len1;
 }
@@ -926,9 +926,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-UINT16 sdpu_get_attrib_entry_len(tSDP_ATTRIBUTE *p_attr)
+uint16_t sdpu_get_attrib_entry_len(tSDP_ATTRIBUTE *p_attr)
 {
-    UINT16 len = 3;
+    uint16_t len = 3;
 
     /* the attribute is in the db record.
      * assuming the attribute len is less than SDP_MAX_ATTR_LEN */
@@ -997,12 +997,12 @@
 **                  offset is also updated
 **
 *******************************************************************************/
-UINT8 *sdpu_build_partial_attrib_entry (UINT8 *p_out, tSDP_ATTRIBUTE *p_attr, UINT16 len, UINT16 *offset)
+uint8_t *sdpu_build_partial_attrib_entry (uint8_t *p_out, tSDP_ATTRIBUTE *p_attr, uint16_t len, uint16_t *offset)
 {
-    UINT8 *p_attr_buff = (UINT8 *)osi_malloc(sizeof(UINT8) * SDP_MAX_ATTR_LEN);
+    uint8_t *p_attr_buff = (uint8_t *)osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN);
     sdpu_build_attrib_entry(p_attr_buff, p_attr);
 
-    UINT16 attr_len = sdpu_get_attrib_entry_len(p_attr);
+    uint16_t attr_len = sdpu_get_attrib_entry_len(p_attr);
 
     if (len > SDP_MAX_ATTR_LEN)
     {
@@ -1032,9 +1032,9 @@
 ** Returns          None
 **
 *******************************************************************************/
-void sdpu_uuid16_to_uuid128(UINT16 uuid16, UINT8* p_uuid128)
+void sdpu_uuid16_to_uuid128(uint16_t uuid16, uint8_t* p_uuid128)
 {
-    UINT16 uuid16_bo;
+    uint16_t uuid16_bo;
     memset(p_uuid128, 0, 16);
 
     memcpy(p_uuid128, sdp_base_uuid, MAX_UUID_SIZE);
diff --git a/stack/sdp/sdpint.h b/stack/sdp/sdpint.h
index 2276401..8926b76 100644
--- a/stack/sdp/sdpint.h
+++ b/stack/sdp/sdpint.h
@@ -94,13 +94,13 @@
 /* Internal UUID sequence representation */
 typedef struct
 {
-    UINT16     len;
-    UINT8      value[MAX_UUID_SIZE];
+    uint16_t   len;
+    uint8_t    value[MAX_UUID_SIZE];
 } tUID_ENT;
 
 typedef struct
 {
-    UINT16      num_uids;
+    uint16_t    num_uids;
     tUID_ENT    uuid_entry[MAX_UUIDS_PER_SEQ];
 } tSDP_UUID_SEQ;
 
@@ -108,13 +108,13 @@
 /* Internal attribute sequence definitions */
 typedef struct
 {
-    UINT16      start;
-    UINT16      end;
+    uint16_t    start;
+    uint16_t    end;
 } tATT_ENT;
 
 typedef struct
 {
-    UINT16      num_attr;
+    uint16_t    num_attr;
     tATT_ENT    attr_entry[MAX_ATTR_PER_SEQ];
 } tSDP_ATTR_SEQ;
 
@@ -122,28 +122,28 @@
 /* Define the attribute element of the SDP database record */
 typedef struct
 {
-    UINT32  len;           /* Number of bytes in the entry */
-    UINT8   *value_ptr;    /* Points to attr_pad */
-    UINT16  id;
-    UINT8   type;
+    uint32_t len;           /* Number of bytes in the entry */
+    uint8_t *value_ptr;    /* Points to attr_pad */
+    uint16_t id;
+    uint8_t type;
 } tSDP_ATTRIBUTE;
 
 /* An SDP record consists of a handle, and 1 or more attributes */
 typedef struct
 {
-    UINT32              record_handle;
-    UINT32              free_pad_ptr;
-    UINT16              num_attributes;
+    uint32_t            record_handle;
+    uint32_t            free_pad_ptr;
+    uint16_t            num_attributes;
     tSDP_ATTRIBUTE      attribute[SDP_MAX_REC_ATTR];
-    UINT8               attr_pad[SDP_MAX_PAD_LEN];
+    uint8_t             attr_pad[SDP_MAX_PAD_LEN];
 } tSDP_RECORD;
 
 
 /* Define the SDP database */
 typedef struct
 {
-    UINT32         di_primary_handle;       /* Device ID Primary record or NULL if nonexistent */
-    UINT16         num_records;
+    uint32_t       di_primary_handle;       /* Device ID Primary record or NULL if nonexistent */
+    uint16_t       num_records;
     tSDP_RECORD    record[SDP_MAX_RECORDS];
 } tSDP_DB;
 
@@ -153,15 +153,15 @@
     SDP_IS_ATTR_SEARCH,
 };
 
-#if SDP_SERVER_ENABLED == TRUE
+#if (SDP_SERVER_ENABLED == TRUE)
 /* Continuation information for the SDP server response */
 typedef struct
 {
-    UINT16            next_attr_index; /* attr index for next continuation response */
-    UINT16            next_attr_start_id;  /* attr id to start with for the attr index in next cont. response */
+    uint16_t          next_attr_index; /* attr index for next continuation response */
+    uint16_t          next_attr_start_id;  /* attr id to start with for the attr index in next cont. response */
     tSDP_RECORD       *prev_sdp_rec; /* last sdp record that was completely sent in the response */
-    BOOLEAN           last_attr_seq_desc_sent; /* whether attr seq length has been sent previously */
-    UINT16            attr_offset; /* offset within the attr to keep trak of partial attributes in the responses */
+    bool              last_attr_seq_desc_sent; /* whether attr seq length has been sent previously */
+    uint16_t          attr_offset; /* offset within the attr to keep trak of partial attributes in the responses */
 } tSDP_CONT_INFO;
 #endif  /* SDP_SERVER_ENABLED == TRUE */
 
@@ -172,32 +172,32 @@
 #define SDP_STATE_CONN_SETUP        1
 #define SDP_STATE_CFG_SETUP         2
 #define SDP_STATE_CONNECTED         3
-    UINT8             con_state;
+    uint8_t           con_state;
 
 #define SDP_FLAGS_IS_ORIG           0x01
 #define SDP_FLAGS_HIS_CFG_DONE      0x02
 #define SDP_FLAGS_MY_CFG_DONE       0x04
-    UINT8             con_flags;
+    uint8_t           con_flags;
 
     BD_ADDR           device_address;
     alarm_t           *sdp_conn_timer;
-    UINT16            rem_mtu_size;
-    UINT16            connection_id;
-    UINT16            list_len;                 /* length of the response in the GKI buffer */
-    UINT8             *rsp_list;                /* pointer to GKI buffer holding response */
+    uint16_t          rem_mtu_size;
+    uint16_t          connection_id;
+    uint16_t          list_len;                 /* length of the response in the GKI buffer */
+    uint8_t           *rsp_list;                /* pointer to GKI buffer holding response */
 
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
     tSDP_DISCOVERY_DB *p_db;                    /* Database to save info into   */
     tSDP_DISC_CMPL_CB *p_cb;                    /* Callback for discovery done  */
     tSDP_DISC_CMPL_CB2 *p_cb2;                   /* Callback for discovery done piggy back with the user data */
     void               *user_data;              /* piggy back user data */
-    UINT32            handles[SDP_MAX_DISC_SERVER_RECS]; /* Discovered server record handles */
-    UINT16            num_handles;              /* Number of server handles     */
-    UINT16            cur_handle;               /* Current handle being processed */
-    UINT16            transaction_id;
-    UINT16            disconnect_reason;        /* Disconnect reason            */
-#if (defined(SDP_BROWSE_PLUS) && SDP_BROWSE_PLUS == TRUE)
-    UINT16            cur_uuid_idx;
+    uint32_t          handles[SDP_MAX_DISC_SERVER_RECS]; /* Discovered server record handles */
+    uint16_t          num_handles;              /* Number of server handles     */
+    uint16_t          cur_handle;               /* Current handle being processed */
+    uint16_t          transaction_id;
+    uint16_t          disconnect_reason;        /* Disconnect reason            */
+#if (SDP_BROWSE_PLUS == TRUE)
+    uint16_t          cur_uuid_idx;
 #endif
 
 #define SDP_DISC_WAIT_CONN          0
@@ -206,12 +206,12 @@
 #define SDP_DISC_WAIT_SEARCH_ATTR   3
 #define SDP_DISC_WAIT_CANCEL        5
 
-    UINT8             disc_state;
-    UINT8             is_attr_search;
+    uint8_t           disc_state;
+    uint8_t           is_attr_search;
 #endif  /* SDP_CLIENT_ENABLED == TRUE */
 
-#if SDP_SERVER_ENABLED == TRUE
-    UINT16            cont_offset;              /* Continuation state data in the server response */
+#if (SDP_SERVER_ENABLED == TRUE)
+    uint16_t          cont_offset;              /* Continuation state data in the server response */
     tSDP_CONT_INFO    cont_info;                /* structure to hold continuation information for the server response */
 #endif  /* SDP_SERVER_ENABLED == TRUE */
 
@@ -223,17 +223,17 @@
 {
     tL2CAP_CFG_INFO   l2cap_my_cfg;             /* My L2CAP config     */
     tCONN_CB          ccb[SDP_MAX_CONNECTIONS];
-#if SDP_SERVER_ENABLED == TRUE
+#if (SDP_SERVER_ENABLED == TRUE)
     tSDP_DB           server_db;
 #endif
     tL2CAP_APPL_INFO  reg_info;                 /* L2CAP Registration info */
-    UINT16            max_attr_list_size;       /* Max attribute list size to use   */
-    UINT16            max_recs_per_search;      /* Max records we want per seaarch  */
-    UINT8             trace_level;
+    uint16_t          max_attr_list_size;       /* Max attribute list size to use   */
+    uint16_t          max_recs_per_search;      /* Max records we want per seaarch  */
+    uint8_t           trace_level;
 } tSDP_CB;
 
 /* Global SDP data */
-#if SDP_DYNAMIC_MEMORY == FALSE
+#if (SDP_DYNAMIC_MEMORY == FALSE)
 extern tSDP_CB  sdp_cb;
 #else
 extern tSDP_CB *sdp_cb_ptr;
@@ -242,10 +242,10 @@
 
 /* Functions provided by sdp_main.c */
 extern void     sdp_init (void);
-extern void     sdp_disconnect (tCONN_CB*p_ccb, UINT16 reason);
+extern void     sdp_disconnect (tCONN_CB*p_ccb, uint16_t reason);
 
-#if (defined(SDP_DEBUG) && SDP_DEBUG == TRUE)
-extern UINT16 sdp_set_max_attr_list_size (UINT16 max_size);
+#if (SDP_DEBUG == TRUE)
+extern uint16_t sdp_set_max_attr_list_size (uint16_t max_size);
 #endif
 
 /* Functions provided by sdp_conn.c
@@ -261,45 +261,45 @@
 extern void sdp_conn_rcv_l2e_data (BT_HDR *p_msg);
 extern void sdp_conn_timer_timeout(void *data);
 
-extern tCONN_CB *sdp_conn_originate (UINT8 *p_bd_addr);
+extern tCONN_CB *sdp_conn_originate (uint8_t *p_bd_addr);
 
 /* Functions provided by sdp_utils.c
 */
-extern tCONN_CB *sdpu_find_ccb_by_cid (UINT16 cid);
+extern tCONN_CB *sdpu_find_ccb_by_cid (uint16_t cid);
 extern tCONN_CB *sdpu_find_ccb_by_db (tSDP_DISCOVERY_DB *p_db);
 extern tCONN_CB *sdpu_allocate_ccb (void);
 extern void      sdpu_release_ccb (tCONN_CB *p_ccb);
 
-extern UINT8    *sdpu_build_attrib_seq (UINT8 *p_out, UINT16 *p_attr, UINT16 num_attrs);
-extern UINT8    *sdpu_build_attrib_entry (UINT8 *p_out, tSDP_ATTRIBUTE *p_attr);
-extern void      sdpu_build_n_send_error (tCONN_CB *p_ccb, UINT16 trans_num, UINT16 error_code, char *p_error_text);
+extern uint8_t  *sdpu_build_attrib_seq (uint8_t *p_out, uint16_t *p_attr, uint16_t num_attrs);
+extern uint8_t  *sdpu_build_attrib_entry (uint8_t *p_out, tSDP_ATTRIBUTE *p_attr);
+extern void      sdpu_build_n_send_error (tCONN_CB *p_ccb, uint16_t trans_num, uint16_t error_code, char *p_error_text);
 
-extern UINT8    *sdpu_extract_attr_seq (UINT8 *p, UINT16 param_len, tSDP_ATTR_SEQ *p_seq);
-extern UINT8    *sdpu_extract_uid_seq (UINT8 *p, UINT16 param_len, tSDP_UUID_SEQ *p_seq);
+extern uint8_t  *sdpu_extract_attr_seq (uint8_t *p, uint16_t param_len, tSDP_ATTR_SEQ *p_seq);
+extern uint8_t  *sdpu_extract_uid_seq (uint8_t *p, uint16_t param_len, tSDP_UUID_SEQ *p_seq);
 
-extern UINT8    *sdpu_get_len_from_type (UINT8 *p, UINT8 type, UINT32 *p_len);
-extern BOOLEAN  sdpu_is_base_uuid (UINT8 *p_uuid);
-extern BOOLEAN  sdpu_compare_uuid_arrays (UINT8 *p_uuid1, UINT32 len1, UINT8 *p_uuid2, UINT16 len2);
-extern BOOLEAN  sdpu_compare_bt_uuids (tBT_UUID *p_uuid1, tBT_UUID *p_uuid2);
-extern BOOLEAN  sdpu_compare_uuid_with_attr (tBT_UUID *p_btuuid, tSDP_DISC_ATTR *p_attr);
+extern uint8_t  *sdpu_get_len_from_type (uint8_t *p, uint8_t type, uint32_t *p_len);
+extern bool     sdpu_is_base_uuid (uint8_t *p_uuid);
+extern bool     sdpu_compare_uuid_arrays (uint8_t *p_uuid1, uint32_t len1, uint8_t *p_uuid2, uint16_t len2);
+extern bool     sdpu_compare_bt_uuids (tBT_UUID *p_uuid1, tBT_UUID *p_uuid2);
+extern bool     sdpu_compare_uuid_with_attr (tBT_UUID *p_btuuid, tSDP_DISC_ATTR *p_attr);
 
-extern void     sdpu_sort_attr_list( UINT16 num_attr, tSDP_DISCOVERY_DB *p_db );
-extern UINT16 sdpu_get_list_len( tSDP_UUID_SEQ   *uid_seq, tSDP_ATTR_SEQ   *attr_seq );
-extern UINT16 sdpu_get_attrib_seq_len(tSDP_RECORD *p_rec, tSDP_ATTR_SEQ *attr_seq);
-extern UINT16 sdpu_get_attrib_entry_len(tSDP_ATTRIBUTE *p_attr);
-extern UINT8 *sdpu_build_partial_attrib_entry (UINT8 *p_out, tSDP_ATTRIBUTE *p_attr, UINT16 len, UINT16 *offset);
-extern void sdpu_uuid16_to_uuid128(UINT16 uuid16, UINT8* p_uuid128);
+extern void     sdpu_sort_attr_list( uint16_t num_attr, tSDP_DISCOVERY_DB *p_db );
+extern uint16_t sdpu_get_list_len( tSDP_UUID_SEQ   *uid_seq, tSDP_ATTR_SEQ   *attr_seq );
+extern uint16_t sdpu_get_attrib_seq_len(tSDP_RECORD *p_rec, tSDP_ATTR_SEQ *attr_seq);
+extern uint16_t sdpu_get_attrib_entry_len(tSDP_ATTRIBUTE *p_attr);
+extern uint8_t *sdpu_build_partial_attrib_entry (uint8_t *p_out, tSDP_ATTRIBUTE *p_attr, uint16_t len, uint16_t *offset);
+extern void sdpu_uuid16_to_uuid128(uint16_t uuid16, uint8_t* p_uuid128);
 
 /* Functions provided by sdp_db.c
 */
 extern tSDP_RECORD    *sdp_db_service_search (tSDP_RECORD *p_rec, tSDP_UUID_SEQ *p_seq);
-extern tSDP_RECORD    *sdp_db_find_record (UINT32 handle);
-extern tSDP_ATTRIBUTE *sdp_db_find_attr_in_rec (tSDP_RECORD *p_rec, UINT16 start_attr, UINT16 end_attr);
+extern tSDP_RECORD    *sdp_db_find_record (uint32_t handle);
+extern tSDP_ATTRIBUTE *sdp_db_find_attr_in_rec (tSDP_RECORD *p_rec, uint16_t start_attr, uint16_t end_attr);
 
 
 /* Functions provided by sdp_server.c
 */
-#if SDP_SERVER_ENABLED == TRUE
+#if (SDP_SERVER_ENABLED == TRUE)
 extern void     sdp_server_handle_client_req (tCONN_CB *p_ccb, BT_HDR *p_msg);
 #else
 #define sdp_server_handle_client_req(p_ccb, p_msg)
@@ -307,7 +307,7 @@
 
 /* Functions provided by sdp_discovery.c
 */
-#if SDP_CLIENT_ENABLED == TRUE
+#if (SDP_CLIENT_ENABLED == TRUE)
 extern void sdp_disc_connected (tCONN_CB *p_ccb);
 extern void sdp_disc_server_rsp (tCONN_CB *p_ccb, BT_HDR *p_msg);
 #else
diff --git a/stack/smp/aes.c b/stack/smp/aes.c
index a42d444..1665fcc 100644
--- a/stack/smp/aes.c
+++ b/stack/smp/aes.c
@@ -68,7 +68,7 @@
 #include "aes.h"
 
 #if defined( HAVE_UINT_32T )
-  typedef UINT32 uint_32t;
+  typedef uint32_t uint_32t;
 #endif
 
 /* functions for finite field multiplication in the AES Galois field    */
diff --git a/stack/smp/p_256_curvepara.c b/stack/smp/p_256_curvepara.c
index 131e769..9d2c942 100644
--- a/stack/smp/p_256_curvepara.c
+++ b/stack/smp/p_256_curvepara.c
@@ -25,7 +25,7 @@
 #include <string.h>
 #include "p_256_ecc_pp.h"
 
-void p_256_init_curve(UINT32 keyLength)
+void p_256_init_curve(uint32_t keyLength)
 {
     elliptic_curve_t *ec;
 
@@ -45,7 +45,7 @@
         memset(ec->omega, 0, KEY_LENGTH_DWORDS_P256);
         memset(ec->a, 0, KEY_LENGTH_DWORDS_P256);
 
-        ec->a_minus3 = TRUE;
+        ec->a_minus3 = true;
 
         //b
         ec->b[7] =  0x5ac635d8;
diff --git a/stack/smp/p_256_ecc_pp.c b/stack/smp/p_256_ecc_pp.c
index 2eaebd4..9460c4c 100644
--- a/stack/smp/p_256_ecc_pp.c
+++ b/stack/smp/p_256_ecc_pp.c
@@ -201,7 +201,7 @@
 void ECC_PointMult_Bin_NAF(Point *q, Point *p, DWORD *n, uint32_t keyLength)
 {
     uint32_t sign;
-    UINT8 naf[256 / 4 +1];
+    uint8_t naf[256 / 4 +1];
     uint32_t NumNaf;
     Point minus_p;
     Point r;
diff --git a/stack/smp/p_256_ecc_pp.h b/stack/smp/p_256_ecc_pp.h
index fd3dc64..61dd5c4 100644
--- a/stack/smp/p_256_ecc_pp.h
+++ b/stack/smp/p_256_ecc_pp.h
@@ -60,6 +60,6 @@
 
 #define ECC_PointMult(q, p, n, keyLength)  ECC_PointMult_Bin_NAF(q, p, n, keyLength)
 
-void p_256_init_curve(UINT32 keyLength);
+void p_256_init_curve(uint32_t keyLength);
 
 
diff --git a/stack/smp/p_256_multprecision.c b/stack/smp/p_256_multprecision.c
index f939809..0c9c7c0 100644
--- a/stack/smp/p_256_multprecision.c
+++ b/stack/smp/p_256_multprecision.c
@@ -60,7 +60,7 @@
     return 1;
 }
 
-UINT32 multiprecision_dword_bits(DWORD a)
+uint32_t multiprecision_dword_bits(DWORD a)
 {
     uint32_t i;
     for (i = 0; i < DWORD_BITS; i++, a >>= 1)
@@ -70,7 +70,7 @@
     return i;
 }
 
-UINT32 multiprecision_most_signdwords(DWORD *a, uint32_t keyLength)
+uint32_t multiprecision_most_signdwords(DWORD *a, uint32_t keyLength)
 {
     int  i;
     for (i = keyLength - 1; i >= 0; i--)
@@ -79,7 +79,7 @@
     return (i + 1);
 }
 
-UINT32 multiprecision_most_signbits(DWORD *a, uint32_t keyLength)
+uint32_t multiprecision_most_signbits(DWORD *a, uint32_t keyLength)
 {
     int aMostSignDWORDs;
 
@@ -282,7 +282,7 @@
         for (uint32_t j = 0; j < keyLength; j++)
         {
             uint64_t result;
-            result = ((UINT64)a[i]) * ((uint64_t) b[j]);
+            result = ((uint64_t)a[i]) * ((uint64_t) b[j]);
             W = result >> 32;
             V = a[i] * b[j];
             V = V + U;
diff --git a/stack/smp/p_256_multprecision.h b/stack/smp/p_256_multprecision.h
index 0d1a964..39eca9d 100644
--- a/stack/smp/p_256_multprecision.h
+++ b/stack/smp/p_256_multprecision.h
@@ -40,9 +40,9 @@
 int multiprecision_iszero(DWORD *a, uint32_t keyLength);
 void multiprecision_init(DWORD *c, uint32_t keyLength);
 void multiprecision_copy(DWORD *c, DWORD *a, uint32_t keyLength);
-UINT32 multiprecision_dword_bits (DWORD a);
-UINT32 multiprecision_most_signdwords(DWORD *a, uint32_t keyLength);
-UINT32 multiprecision_most_signbits(DWORD *a, uint32_t keyLength);
+uint32_t multiprecision_dword_bits (DWORD a);
+uint32_t multiprecision_most_signdwords(DWORD *a, uint32_t keyLength);
+uint32_t multiprecision_most_signbits(DWORD *a, uint32_t keyLength);
 void multiprecision_inv_mod(DWORD *aminus, DWORD *a, uint32_t keyLength);
 DWORD multiprecision_add(DWORD *c, DWORD *a, DWORD *b, uint32_t keyLength); // c=a+b
 void multiprecision_add_mod(DWORD *c, DWORD *a, DWORD *b, uint32_t keyLength);
diff --git a/stack/smp/smp_act.c b/stack/smp/smp_act.c
index 51eb71c..3264cb1 100644
--- a/stack/smp/smp_act.c
+++ b/stack/smp/smp_act.c
@@ -26,8 +26,8 @@
 
 extern fixed_queue_t *btu_general_alarm_queue;
 
-#if SMP_INCLUDED == TRUE
-const UINT8 smp_association_table[2][SMP_IO_CAP_MAX][SMP_IO_CAP_MAX] =
+#if (SMP_INCLUDED == TRUE)
+const uint8_t smp_association_table[2][SMP_IO_CAP_MAX][SMP_IO_CAP_MAX] =
 {
     /* initiator */
     {{SMP_MODEL_ENCRYPTION_ONLY, SMP_MODEL_ENCRYPTION_ONLY, SMP_MODEL_PASSKEY,   SMP_MODEL_ENCRYPTION_ONLY, SMP_MODEL_PASSKEY}, /* Display Only */
@@ -105,7 +105,7 @@
 ** Function         smp_update_key_mask
 ** Description      This function updates the key mask for sending or receiving.
 *******************************************************************************/
-static void smp_update_key_mask (tSMP_CB *p_cb, UINT8 key_type, BOOLEAN recv)
+static void smp_update_key_mask (tSMP_CB *p_cb, uint8_t key_type, bool    recv)
 {
     SMP_TRACE_DEBUG("%s before update role=%d recv=%d local_i_key = %02x, local_r_key = %02x",
         __func__, p_cb->role, recv, p_cb->local_i_key, p_cb->local_r_key);
@@ -215,7 +215,7 @@
                         p_cb->loc_enc_size, p_cb->local_i_key, p_cb->local_r_key);
 
                     p_cb->secure_connections_only_mode_required =
-                        (btm_cb.security_mode == BTM_SEC_MODE_SC) ? TRUE : FALSE;
+                        (btm_cb.security_mode == BTM_SEC_MODE_SC) ? true : false;
 
                     if (p_cb->secure_connections_only_mode_required)
                     {
@@ -258,7 +258,7 @@
 
     if (!p_cb->cb_evt && p_cb->discard_sec_req)
     {
-        p_cb->discard_sec_req = FALSE;
+        p_cb->discard_sec_req = false;
         smp_sm_event(p_cb, SMP_DISCARD_SEC_REQ_EVT, NULL);
     }
 
@@ -271,15 +271,15 @@
 *******************************************************************************/
 void smp_send_pair_fail(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    p_cb->status = *(UINT8 *)p_data;
-    p_cb->failure = *(UINT8 *)p_data;
+    p_cb->status = *(uint8_t *)p_data;
+    p_cb->failure = *(uint8_t *)p_data;
 
     SMP_TRACE_DEBUG("%s status=%d failure=%d ", __func__, p_cb->status, p_cb->failure);
 
     if (p_cb->status <= SMP_MAX_FAIL_RSN_PER_SPEC && p_cb->status != SMP_SUCCESS)
     {
         smp_send_cmd(SMP_OPCODE_PAIRING_FAILED, p_cb);
-        p_cb->wait_for_authorization_complete = TRUE;
+        p_cb->wait_for_authorization_complete = true;
     }
 }
 
@@ -386,7 +386,7 @@
 *******************************************************************************/
 void smp_send_keypress_notification(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    p_cb->local_keypress_notification = *(UINT8 *) p_data;
+    p_cb->local_keypress_notification = *(uint8_t *) p_data;
     smp_send_cmd(SMP_OPCODE_PAIR_KEYPR_NOTIF, p_cb);
 }
 
@@ -399,7 +399,7 @@
     tBTM_LE_LENC_KEYS   le_key;
 
     SMP_TRACE_DEBUG("%s p_cb->loc_enc_size = %d", __func__, p_cb->loc_enc_size);
-    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, FALSE);
+    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, false);
 
     smp_send_cmd(SMP_OPCODE_ENCRYPT_INFO, p_cb);
     smp_send_cmd(SMP_OPCODE_MASTER_ID, p_cb);
@@ -412,7 +412,7 @@
 
     if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND))
         btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LENC,
-                            (tBTM_LE_KEY_VALUE *)&le_key, TRUE);
+                            (tBTM_LE_KEY_VALUE *)&le_key, true);
 
     SMP_TRACE_WARNING ("%s", __func__);
 
@@ -427,14 +427,14 @@
 {
     tBTM_LE_KEY_VALUE   le_key;
     SMP_TRACE_DEBUG("%s", __func__);
-    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ID, FALSE);
+    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ID, false);
 
     smp_send_cmd(SMP_OPCODE_IDENTITY_INFO, p_cb);
     smp_send_cmd(SMP_OPCODE_ID_ADDR, p_cb);
 
     if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND))
         btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LID,
-                            &le_key, TRUE);
+                            &le_key, true);
 
     SMP_TRACE_WARNING ("%s", __func__);
     smp_key_distribution_by_transport(p_cb, NULL);
@@ -448,7 +448,7 @@
 {
     tBTM_LE_LCSRK_KEYS  key;
     SMP_TRACE_DEBUG("%s", __func__);
-    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_CSRK, FALSE);
+    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_CSRK, false);
 
     if (smp_send_cmd(SMP_OPCODE_SIGN_INFO, p_cb))
     {
@@ -456,7 +456,7 @@
         key.sec_level = p_cb->sec_level;
         key.counter = 0; /* initialize the local counter */
         memcpy (key.csrk, p_cb->csrk, BT_OCTET16_LEN);
-        btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LCSRK, (tBTM_LE_KEY_VALUE *)&key, TRUE);
+        btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LCSRK, (tBTM_LE_KEY_VALUE *)&key, true);
     }
 
     smp_key_distribution_by_transport(p_cb, NULL);
@@ -470,7 +470,7 @@
 {
     SMP_TRACE_DEBUG("%s", __func__);
     /* send stk as LTK response */
-    btm_ble_ltk_request_reply(p_cb->pairing_bda, TRUE, p_data->key.p_data);
+    btm_ble_ltk_request_reply(p_cb->pairing_bda, true, p_data->key.p_data);
 }
 
 /*******************************************************************************
@@ -481,7 +481,7 @@
 {
     tBTM_LE_AUTH_REQ auth_req = *(tBTM_LE_AUTH_REQ *)p_data;
     tBTM_BLE_SEC_REQ_ACT sec_req_act;
-    UINT8 reason;
+    uint8_t reason;
 
     SMP_TRACE_DEBUG("%s auth_req=0x%x", __func__, auth_req);
 
@@ -500,7 +500,7 @@
 
         case BTM_BLE_SEC_REQ_ACT_PAIR:
             p_cb->secure_connections_only_mode_required =
-                    (btm_cb.security_mode == BTM_SEC_MODE_SC) ? TRUE : FALSE;
+                    (btm_cb.security_mode == BTM_SEC_MODE_SC) ? true : false;
 
             /* respond to non SC pairing request as failure in SC only mode */
             if (p_cb->secure_connections_only_mode_required &&
@@ -519,7 +519,7 @@
             break;
 
         case BTM_BLE_SEC_REQ_ACT_DISCARD:
-            p_cb->discard_sec_req = TRUE;
+            p_cb->discard_sec_req = true;
             break;
 
         default:
@@ -534,7 +534,7 @@
 *******************************************************************************/
 void smp_proc_sec_grant(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 res= *(UINT8 *)p_data;
+    uint8_t res= *(uint8_t *)p_data;
     SMP_TRACE_DEBUG("%s", __func__);
     if (res != SMP_SUCCESS)
     {
@@ -554,7 +554,7 @@
 void smp_proc_pair_fail(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
     SMP_TRACE_DEBUG("%s", __func__);
-    p_cb->status = *(UINT8 *)p_data;
+    p_cb->status = *(uint8_t *)p_data;
 
     /* Cancel pending auth complete timer if set */
     alarm_cancel(p_cb->delayed_auth_timer_ent);
@@ -566,8 +566,8 @@
 *******************************************************************************/
 void smp_proc_pair_cmd(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   *p = (UINT8 *)p_data;
-    UINT8   reason = SMP_ENC_KEY_SIZE;
+    uint8_t *p = (uint8_t *)p_data;
+    uint8_t reason = SMP_ENC_KEY_SIZE;
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (p_cb->pairing_bda);
 
     SMP_TRACE_DEBUG("%s", __func__);
@@ -665,8 +665,8 @@
 *******************************************************************************/
 void smp_proc_confirm(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 *p = (UINT8 *)p_data;
-    UINT8 reason = SMP_INVALID_PARAMETERS;
+    uint8_t *p = (uint8_t *)p_data;
+    uint8_t reason = SMP_INVALID_PARAMETERS;
 
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -691,8 +691,8 @@
 *******************************************************************************/
 void smp_proc_init(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 *p = (UINT8 *)p_data;
-    UINT8 reason = SMP_INVALID_PARAMETERS;
+    uint8_t *p = (uint8_t *)p_data;
+    uint8_t reason = SMP_INVALID_PARAMETERS;
 
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -712,8 +712,8 @@
 *******************************************************************************/
 void smp_proc_rand(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 *p = (UINT8 *)p_data;
-    UINT8 reason = SMP_INVALID_PARAMETERS;
+    uint8_t *p = (uint8_t *)p_data;
+    uint8_t reason = SMP_INVALID_PARAMETERS;
 
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -737,8 +737,8 @@
 *******************************************************************************/
 void smp_process_pairing_public_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 *p = (UINT8 *)p_data;
-    UINT8 reason = SMP_INVALID_PARAMETERS;
+    uint8_t *p = (uint8_t *)p_data;
+    uint8_t reason = SMP_INVALID_PARAMETERS;
 
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -761,8 +761,8 @@
 *******************************************************************************/
 void smp_process_pairing_commitment(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 *p = (UINT8 *)p_data;
-    UINT8 reason = SMP_INVALID_PARAMETERS;
+    uint8_t *p = (uint8_t *)p_data;
+    uint8_t reason = SMP_INVALID_PARAMETERS;
 
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -786,8 +786,8 @@
 *******************************************************************************/
 void smp_process_dhkey_check(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 *p = (UINT8 *)p_data;
-    UINT8 reason = SMP_INVALID_PARAMETERS;
+    uint8_t *p = (uint8_t *)p_data;
+    uint8_t reason = SMP_INVALID_PARAMETERS;
 
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -811,11 +811,11 @@
 *******************************************************************************/
 void smp_process_keypress_notification(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 *p = (UINT8 *)p_data;
-    UINT8 reason = SMP_INVALID_PARAMETERS;
+    uint8_t *p = (uint8_t *)p_data;
+    uint8_t reason = SMP_INVALID_PARAMETERS;
 
     SMP_TRACE_DEBUG("%s", __func__);
-    p_cb->status = *(UINT8 *)p_data;
+    p_cb->status = *(uint8_t *)p_data;
 
     if (smp_command_has_invalid_parameters(p_cb))
     {
@@ -841,8 +841,8 @@
 *******************************************************************************/
 void smp_br_process_pairing_command(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   *p = (UINT8 *)p_data;
-    UINT8   reason = SMP_ENC_KEY_SIZE;
+    uint8_t *p = (uint8_t *)p_data;
+    uint8_t reason = SMP_ENC_KEY_SIZE;
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (p_cb->pairing_bda);
 
     SMP_TRACE_DEBUG("%s", __func__);
@@ -881,7 +881,7 @@
 
     if (p_cb->role == HCI_ROLE_SLAVE)
     {
-        p_dev_rec->new_encryption_key_is_p256 = FALSE;
+        p_dev_rec->new_encryption_key_is_p256 = false;
         /* shortcut to skip Security Grant step */
         p_cb->cb_evt = SMP_BR_KEYS_REQ_EVT;
     }
@@ -903,7 +903,7 @@
 *******************************************************************************/
 void smp_br_process_security_grant(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 res= *(UINT8 *)p_data;
+    uint8_t res= *(uint8_t *)p_data;
     SMP_TRACE_DEBUG("%s", __func__);
     if (res != SMP_SUCCESS)
     {
@@ -923,10 +923,10 @@
 *******************************************************************************/
 void smp_br_check_authorization_request(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 reason = SMP_SUCCESS;
+    uint8_t reason = SMP_SUCCESS;
 
     SMP_TRACE_DEBUG("%s rcvs i_keys=0x%x r_keys=0x%x "
-                      "(i-initiator r-responder)", __FUNCTION__, p_cb->local_i_key,
+                      "(i-initiator r-responder)", __func__, p_cb->local_i_key,
                       p_cb->local_r_key);
 
     /* In LE SC mode LK field is ignored when BR/EDR transport is used */
@@ -941,7 +941,7 @@
     }
 
     SMP_TRACE_DEBUG("%s rcvs upgrades: i_keys=0x%x r_keys=0x%x "
-                      "(i-initiator r-responder)", __FUNCTION__, p_cb->local_i_key,
+                      "(i-initiator r-responder)", __func__, p_cb->local_i_key,
                       p_cb->local_r_key);
 
     if (/*((p_cb->peer_auth_req & SMP_AUTH_BOND) ||
@@ -967,7 +967,7 @@
 *******************************************************************************/
 void smp_br_select_next_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   reason = SMP_SUCCESS;
+    uint8_t reason = SMP_SUCCESS;
     SMP_TRACE_DEBUG("%s role=%d (0-master) r_keys=0x%x i_keys=0x%x",
                        __func__, p_cb->role, p_cb->local_r_key, p_cb->local_i_key);
 
@@ -985,7 +985,7 @@
             if (p_cb->total_tx_unacked == 0)
                 smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &reason);
             else
-                p_cb->wait_for_authorization_complete = TRUE;
+                p_cb->wait_for_authorization_complete = true;
         }
     }
 }
@@ -996,7 +996,7 @@
 *******************************************************************************/
 void smp_proc_enc_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   *p = (UINT8 *)p_data;
+    uint8_t *p = (uint8_t *)p_data;
 
     SMP_TRACE_DEBUG("%s", __func__);
     STREAM_TO_ARRAY(p_cb->ltk, p, BT_OCTET16_LEN);
@@ -1009,11 +1009,11 @@
 *******************************************************************************/
 void smp_proc_master_id(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   *p = (UINT8 *)p_data;
+    uint8_t *p = (uint8_t *)p_data;
     tBTM_LE_PENC_KEYS   le_key;
 
     SMP_TRACE_DEBUG("%s", __func__);
-    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, TRUE);
+    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, true);
 
     STREAM_TO_UINT16(le_key.ediv, p);
     STREAM_TO_ARRAY(le_key.rand, p, BT_OCTET8_LEN );
@@ -1026,7 +1026,7 @@
     if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND))
         btm_sec_save_le_key(p_cb->pairing_bda,
                             BTM_LE_KEY_PENC,
-                            (tBTM_LE_KEY_VALUE *)&le_key, TRUE);
+                            (tBTM_LE_KEY_VALUE *)&le_key, true);
 
     smp_key_distribution(p_cb, NULL);
 }
@@ -1037,7 +1037,7 @@
 *******************************************************************************/
 void smp_proc_id_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   *p = (UINT8 *)p_data;
+    uint8_t *p = (uint8_t *)p_data;
 
     SMP_TRACE_DEBUG("%s", __func__);
     STREAM_TO_ARRAY (p_cb->tk, p, BT_OCTET16_LEN);   /* reuse TK for IRK */
@@ -1050,25 +1050,25 @@
 *******************************************************************************/
 void smp_proc_id_addr(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   *p = (UINT8 *)p_data;
+    uint8_t *p = (uint8_t *)p_data;
     tBTM_LE_PID_KEYS    pid_key;
 
     SMP_TRACE_DEBUG("%s", __func__);
-    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ID, TRUE);
+    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ID, true);
 
     STREAM_TO_UINT8(pid_key.addr_type, p);
     STREAM_TO_BDADDR(pid_key.static_addr, p);
     memcpy(pid_key.irk, p_cb->tk, BT_OCTET16_LEN);
 
     /* to use as BD_ADDR for lk derived from ltk */
-    p_cb->id_addr_rcvd = TRUE;
+    p_cb->id_addr_rcvd = true;
     p_cb->id_addr_type = pid_key.addr_type;
     memcpy(p_cb->id_addr, pid_key.static_addr, BD_ADDR_LEN);
 
     /* store the ID key from peer device */
     if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND))
         btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_PID,
-                            (tBTM_LE_KEY_VALUE *)&pid_key, TRUE);
+                            (tBTM_LE_KEY_VALUE *)&pid_key, true);
     smp_key_distribution_by_transport(p_cb, NULL);
 }
 
@@ -1081,7 +1081,7 @@
     tBTM_LE_PCSRK_KEYS   le_key;
 
     SMP_TRACE_DEBUG("%s", __func__);
-    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_CSRK, TRUE);
+    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_CSRK, true);
 
     /* save CSRK to security record */
     le_key.sec_level = p_cb->sec_level;
@@ -1091,7 +1091,7 @@
     if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND))
         btm_sec_save_le_key(p_cb->pairing_bda,
                             BTM_LE_KEY_PCSRK,
-                            (tBTM_LE_KEY_VALUE *)&le_key, TRUE);
+                            (tBTM_LE_KEY_VALUE *)&le_key, true);
     smp_key_distribution_by_transport(p_cb, NULL);
 }
 
@@ -1101,7 +1101,7 @@
 *******************************************************************************/
 void smp_proc_compare(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   reason;
+    uint8_t reason;
 
     SMP_TRACE_DEBUG("%s", __func__);
     if (!memcmp(p_cb->rconfirm, p_data->key.p_data, BT_OCTET16_LEN))
@@ -1135,7 +1135,7 @@
 *******************************************************************************/
 void smp_proc_sl_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 key_type = p_data->key.key_type;
+    uint8_t key_type = p_data->key.key_type;
 
     SMP_TRACE_DEBUG("%s", __func__);
     if (key_type == SMP_KEY_TYPE_TK)
@@ -1158,13 +1158,13 @@
 void smp_start_enc(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
     tBTM_STATUS cmd;
-    UINT8 reason = SMP_ENC_FAIL;
+    uint8_t reason = SMP_ENC_FAIL;
 
     SMP_TRACE_DEBUG("%s", __func__);
     if (p_data != NULL)
-        cmd = btm_ble_start_encrypt(p_cb->pairing_bda, TRUE, p_data->key.p_data);
+        cmd = btm_ble_start_encrypt(p_cb->pairing_bda, true, p_data->key.p_data);
     else
-        cmd = btm_ble_start_encrypt(p_cb->pairing_bda, FALSE, NULL);
+        cmd = btm_ble_start_encrypt(p_cb->pairing_bda, false, NULL);
 
     if (cmd != BTM_CMD_STARTED && cmd != BTM_BUSY)
         smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
@@ -1187,8 +1187,8 @@
 *******************************************************************************/
 void smp_enc_cmpl(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 enc_enable = *(UINT8 *)p_data;
-    UINT8 reason = enc_enable ? SMP_SUCCESS : SMP_ENC_FAIL;
+    uint8_t enc_enable = *(uint8_t *)p_data;
+    uint8_t reason = enc_enable ? SMP_SUCCESS : SMP_ENC_FAIL;
 
     SMP_TRACE_DEBUG("%s", __func__);
     smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
@@ -1200,8 +1200,8 @@
 *******************************************************************************/
 void smp_check_auth_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 enc_enable = *(UINT8 *)p_data;
-    UINT8 reason = enc_enable ? SMP_SUCCESS : SMP_ENC_FAIL;
+    uint8_t enc_enable = *(uint8_t *)p_data;
+    uint8_t reason = enc_enable ? SMP_SUCCESS : SMP_ENC_FAIL;
 
     SMP_TRACE_DEBUG("%s rcvs enc_enable=%d i_keys=0x%x r_keys=0x%x "
                       "(i-initiator r-responder)",
@@ -1269,8 +1269,8 @@
 *******************************************************************************/
 void smp_key_pick_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   key_to_dist = (p_cb->role == HCI_ROLE_SLAVE) ? p_cb->local_r_key : p_cb->local_i_key;
-    UINT8   i = 0;
+    uint8_t key_to_dist = (p_cb->role == HCI_ROLE_SLAVE) ? p_cb->local_r_key : p_cb->local_i_key;
+    uint8_t i = 0;
 
     SMP_TRACE_DEBUG("%s key_to_dist=0x%x", __func__, key_to_dist);
     while (i < SMP_KEY_DIST_TYPE_MAX)
@@ -1309,7 +1309,7 @@
             if (p_cb->derive_lk)
             {
                 smp_derive_link_key_from_long_term_key(p_cb, NULL);
-                p_cb->derive_lk = FALSE;
+                p_cb->derive_lk = false;
             }
 
             if (p_cb->total_tx_unacked == 0)
@@ -1327,7 +1327,7 @@
                                        smp_delayed_auth_complete_timeout, NULL, btu_general_alarm_queue);
                 }
             } else {
-                p_cb->wait_for_authorization_complete = TRUE;
+                p_cb->wait_for_authorization_complete = true;
             }
         }
     }
@@ -1341,8 +1341,8 @@
 *******************************************************************************/
 void smp_decide_association_model(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   failure = SMP_UNKNOWN_IO_CAP;
-    UINT8 int_evt = 0;
+    uint8_t failure = SMP_UNKNOWN_IO_CAP;
+    uint8_t int_evt = 0;
     tSMP_KEY key;
     tSMP_INT_DATA   *p = NULL;
 
@@ -1503,7 +1503,7 @@
     if (p_cb->total_tx_unacked == 0)
     {
         /* update connection parameter to remote preferred */
-        L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, TRUE);
+        L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, true);
         /* process the pairing complete */
         smp_proc_pairing_cmpl(p_cb);
     }
@@ -1543,7 +1543,7 @@
 void smp_fast_conn_param(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
     /* disable connection parameter update */
-    L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
+    L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, false);
 }
 
 /*******************************************************************************
@@ -1696,7 +1696,7 @@
 *******************************************************************************/
 void smp_process_peer_nonce(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   reason;
+    uint8_t reason;
 
     SMP_TRACE_DEBUG("%s start ", __func__);
 
@@ -1777,7 +1777,7 @@
             break;
     }
 
-    SMP_TRACE_DEBUG("%s end ",__FUNCTION__);
+    SMP_TRACE_DEBUG("%s end ",__func__);
 }
 
 /*******************************************************************************
@@ -1787,7 +1787,7 @@
 *******************************************************************************/
 void smp_match_dhkey_checks(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 reason = SMP_DHKEY_CHK_FAIL;
+    uint8_t reason = SMP_DHKEY_CHK_FAIL;
 
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -1876,7 +1876,7 @@
 *******************************************************************************/
 void smp_start_passkey_verification(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8 *p = NULL;
+    uint8_t *p = NULL;
 
     SMP_TRACE_DEBUG("%s", __func__);
     p = p_cb->local_random;
@@ -1921,7 +1921,7 @@
         memcpy(p_cb->remote_commitment, p_sc_oob_data->peer_oob_data.commitment,
                sizeof(p_cb->remote_commitment));
 
-        UINT8 reason = SMP_CONFIRM_VALUE_ERR;
+        uint8_t reason = SMP_CONFIRM_VALUE_ERR;
         /* check commitment */
         if (!smp_check_commitment(p_cb))
         {
@@ -1939,8 +1939,8 @@
         }
     }
 
-    print128(p_cb->local_random, (const UINT8 *)"local OOB randomizer");
-    print128(p_cb->peer_random, (const UINT8 *)"peer OOB randomizer");
+    print128(p_cb->local_random, (const uint8_t *)"local OOB randomizer");
+    print128(p_cb->peer_random, (const uint8_t *)"peer OOB randomizer");
     smp_start_nonce_generation(p_cb);
 }
 
@@ -1976,26 +1976,26 @@
                      p_cb->sc_oob_data.loc_oob_data.randomizer, 0,
                      p_cb->sc_oob_data.loc_oob_data.commitment);
 
-#if SMP_DEBUG == TRUE
-    UINT8   *p_print = NULL;
+#if (SMP_DEBUG == TRUE)
+    uint8_t *p_print = NULL;
     SMP_TRACE_DEBUG("local SC OOB data set:");
-    p_print = (UINT8*) &p_cb->sc_oob_data.loc_oob_data.addr_sent_to;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"addr_sent_to",
+    p_print = (uint8_t*) &p_cb->sc_oob_data.loc_oob_data.addr_sent_to;
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"addr_sent_to",
                                          sizeof(tBLE_BD_ADDR));
-    p_print = (UINT8*) &p_cb->sc_oob_data.loc_oob_data.private_key_used;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"private_key_used",
+    p_print = (uint8_t*) &p_cb->sc_oob_data.loc_oob_data.private_key_used;
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"private_key_used",
                                          BT_OCTET32_LEN);
-    p_print = (UINT8*) &p_cb->sc_oob_data.loc_oob_data.publ_key_used.x;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"publ_key_used.x",
+    p_print = (uint8_t*) &p_cb->sc_oob_data.loc_oob_data.publ_key_used.x;
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"publ_key_used.x",
                                          BT_OCTET32_LEN);
-    p_print = (UINT8*) &p_cb->sc_oob_data.loc_oob_data.publ_key_used.y;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"publ_key_used.y",
+    p_print = (uint8_t*) &p_cb->sc_oob_data.loc_oob_data.publ_key_used.y;
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"publ_key_used.y",
                                          BT_OCTET32_LEN);
-    p_print = (UINT8*) &p_cb->sc_oob_data.loc_oob_data.randomizer;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"randomizer",
+    p_print = (uint8_t*) &p_cb->sc_oob_data.loc_oob_data.randomizer;
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"randomizer",
                                          BT_OCTET16_LEN);
-    p_print = (UINT8*) &p_cb->sc_oob_data.loc_oob_data.commitment;
-    smp_debug_print_nbyte_little_endian (p_print,(const UINT8 *) "commitment",
+    p_print = (uint8_t*) &p_cb->sc_oob_data.loc_oob_data.commitment;
+    smp_debug_print_nbyte_little_endian (p_print,(const uint8_t *) "commitment",
                                          BT_OCTET16_LEN);
     SMP_TRACE_DEBUG("");
 #endif
@@ -2019,7 +2019,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void smp_link_encrypted(BD_ADDR bda, UINT8 encr_enable)
+void smp_link_encrypted(BD_ADDR bda, uint8_t encr_enable)
 {
     tSMP_CB *p_cb = &smp_cb;
 
@@ -2049,14 +2049,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN smp_proc_ltk_request(BD_ADDR bda)
+bool    smp_proc_ltk_request(BD_ADDR bda)
 {
     SMP_TRACE_DEBUG("%s state = %d",  __func__, smp_cb.state);
-    BOOLEAN match = FALSE;
+    bool    match = false;
 
     if (!memcmp(bda, smp_cb.pairing_bda, BD_ADDR_LEN))
     {
-        match = TRUE;
+        match = true;
     } else {
         BD_ADDR dummy_bda = {0};
         tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(bda);
@@ -2064,17 +2064,17 @@
             0 == memcmp(p_dev_rec->ble.pseudo_addr, smp_cb.pairing_bda, BD_ADDR_LEN) &&
             0 != memcmp(p_dev_rec->ble.pseudo_addr, dummy_bda, BD_ADDR_LEN))
         {
-            match = TRUE;
+            match = true;
         }
     }
 
     if (match && smp_cb.state == SMP_STATE_ENCRYPTION_PENDING)
     {
         smp_sm_event(&smp_cb, SMP_ENC_REQ_EVT, NULL);
-        return TRUE;
+        return true;
     }
 
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -2095,7 +2095,7 @@
     SMP_TRACE_DEBUG("%s", __func__);
     smp_save_secure_connections_long_term_key(p_cb);
 
-    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, FALSE);
+    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, false);
     smp_key_distribution(p_cb, NULL);
 }
 
@@ -2113,8 +2113,8 @@
 void smp_set_derive_link_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
     SMP_TRACE_DEBUG ("%s", __func__);
-    p_cb->derive_lk = TRUE;
-    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_LK, FALSE);
+    p_cb->derive_lk = true;
+    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_LK, false);
     smp_key_distribution(p_cb, NULL);
 }
 
@@ -2134,7 +2134,7 @@
     SMP_TRACE_DEBUG("%s", __func__);
     if (!smp_calculate_link_key_from_long_term_key(p_cb))
     {
-        SMP_TRACE_ERROR("%s failed", __FUNCTION__);
+        SMP_TRACE_ERROR("%s failed", __func__);
         smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status);
         return;
     }
@@ -2158,14 +2158,14 @@
     SMP_TRACE_DEBUG("%s", __func__);
     if (!smp_calculate_long_term_key_from_link_key(p_cb))
     {
-        SMP_TRACE_ERROR ("%s failed",__FUNCTION__);
+        SMP_TRACE_ERROR ("%s failed",__func__);
         smp_sm_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &status);
         return;
     }
 
-    SMP_TRACE_DEBUG("%s: LTK derivation from LK successfully completed", __FUNCTION__);
+    SMP_TRACE_DEBUG("%s: LTK derivation from LK successfully completed", __func__);
     smp_save_secure_connections_long_term_key(p_cb);
-    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, FALSE);
+    smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, false);
     smp_br_select_next_key(p_cb, NULL);
 }
 
diff --git a/stack/smp/smp_api.c b/stack/smp/smp_api.c
index ddf9ba4..7fcda63 100644
--- a/stack/smp/smp_api.c
+++ b/stack/smp/smp_api.c
@@ -28,7 +28,7 @@
 #include "bt_utils.h"
 #include "stack_config.h"
 
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
     #include "smp_int.h"
     #include "smp_api.h"
     #include "l2cdefs.h"
@@ -59,7 +59,7 @@
 #else
     smp_cb.trace_level = BT_TRACE_LEVEL_NONE;    /* No traces */
 #endif
-    SMP_TRACE_EVENT ("%s", __FUNCTION__);
+    SMP_TRACE_EVENT ("%s", __func__);
 
     smp_l2cap_if_init();
     /* initialization of P-256 parameters */
@@ -92,7 +92,7 @@
 ** Returns          The new or current trace level
 **
 *******************************************************************************/
-extern UINT8 SMP_SetTraceLevel (UINT8 new_level)
+extern uint8_t SMP_SetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         smp_cb.trace_level = new_level;
@@ -110,7 +110,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN SMP_Register (tSMP_CALLBACK *p_cback)
+bool    SMP_Register (tSMP_CALLBACK *p_cback)
 {
     SMP_TRACE_EVENT ("SMP_Register state=%d", smp_cb.state);
 
@@ -120,7 +120,7 @@
     }
     smp_cb.p_callback = p_cback;
 
-    return(TRUE);
+    return(true);
 
 }
 
@@ -139,10 +139,10 @@
 tSMP_STATUS SMP_Pair (BD_ADDR bd_addr)
 {
     tSMP_CB   *p_cb = &smp_cb;
-    UINT8     status = SMP_PAIR_INTERNAL_ERR;
+    uint8_t   status = SMP_PAIR_INTERNAL_ERR;
 
     SMP_TRACE_EVENT ("%s state=%d br_state=%d flag=0x%x ",
-                      __FUNCTION__, p_cb->state, p_cb->br_state, p_cb->flags);
+                      __func__, p_cb->state, p_cb->br_state, p_cb->flags);
     if (p_cb->state != SMP_STATE_IDLE || p_cb->flags & SMP_PAIR_FLAGS_WE_STARTED_DD ||
         p_cb->smp_over_br)
     {
@@ -157,7 +157,7 @@
 
         if (!L2CA_ConnectFixedChnl (L2CAP_SMP_CID, bd_addr))
         {
-            SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.", __FUNCTION__);
+            SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.", __func__);
             smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status);
             return status;
         }
@@ -181,7 +181,7 @@
 tSMP_STATUS SMP_BR_PairWith (BD_ADDR bd_addr)
 {
     tSMP_CB   *p_cb = &smp_cb;
-    UINT8     status = SMP_PAIR_INTERNAL_ERR;
+    uint8_t   status = SMP_PAIR_INTERNAL_ERR;
 
     SMP_TRACE_EVENT ("%s state=%d br_state=%d flag=0x%x ",
                       __func__, p_cb->state, p_cb->br_state, p_cb->flags);
@@ -196,13 +196,13 @@
 
     p_cb->role = HCI_ROLE_MASTER;
     p_cb->flags = SMP_PAIR_FLAGS_WE_STARTED_DD;
-    p_cb->smp_over_br = TRUE;
+    p_cb->smp_over_br = true;
 
     memcpy (p_cb->pairing_bda, bd_addr, BD_ADDR_LEN);
 
     if (!L2CA_ConnectFixedChnl (L2CAP_SMP_BR_CID, bd_addr))
     {
-        SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.",__FUNCTION__);
+        SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.",__func__);
         smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &status);
         return status;
     }
@@ -218,14 +218,14 @@
 **
 ** Parameters       bd_addr - peer device bd address.
 **
-** Returns          TRUE - Pairining is cancelled
+** Returns          true - Pairining is cancelled
 **
 *******************************************************************************/
-BOOLEAN SMP_PairCancel (BD_ADDR bd_addr)
+bool    SMP_PairCancel (BD_ADDR bd_addr)
 {
     tSMP_CB   *p_cb = &smp_cb;
-    UINT8     err_code = SMP_PAIR_FAIL_UNKNOWN;
-    BOOLEAN   status = FALSE;
+    uint8_t   err_code = SMP_PAIR_FAIL_UNKNOWN;
+    bool      status = false;
 
     // PTS SMP failure test cases
     if (p_cb->cert_failure == 7)
@@ -237,10 +237,10 @@
     if ( (p_cb->state != SMP_STATE_IDLE)  &&
          (!memcmp (p_cb->pairing_bda, bd_addr, BD_ADDR_LEN)) )
     {
-        p_cb->is_pair_cancel = TRUE;
+        p_cb->is_pair_cancel = true;
         SMP_TRACE_DEBUG("Cancel Pairing: set fail reason Unknown");
         smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &err_code);
-        status = TRUE;
+        status = true;
     }
 
     return status;
@@ -258,7 +258,7 @@
 ** Returns          None
 **
 *******************************************************************************/
-void SMP_SecurityGrant(BD_ADDR bd_addr, UINT8 res)
+void SMP_SecurityGrant(BD_ADDR bd_addr, uint8_t res)
 {
     SMP_TRACE_EVENT ("SMP_SecurityGrant ");
 
@@ -301,10 +301,10 @@
 **                  BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
 **
 *******************************************************************************/
-void SMP_PasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey)
+void SMP_PasskeyReply (BD_ADDR bd_addr, uint8_t res, uint32_t passkey)
 {
     tSMP_CB *p_cb = & smp_cb;
-    UINT8   failure = SMP_PASSKEY_ENTRY_FAIL;
+    uint8_t failure = SMP_PASSKEY_ENTRY_FAIL;
 
     SMP_TRACE_EVENT ("SMP_PasskeyReply: Key: %d  Result:%d",
                       passkey, res);
@@ -359,35 +359,35 @@
 **                  res          - comparison result SMP_SUCCESS if success
 **
 *******************************************************************************/
-void SMP_ConfirmReply (BD_ADDR bd_addr, UINT8 res)
+void SMP_ConfirmReply (BD_ADDR bd_addr, uint8_t res)
 {
     tSMP_CB *p_cb = & smp_cb;
-    UINT8   failure = SMP_NUMERIC_COMPAR_FAIL;
+    uint8_t failure = SMP_NUMERIC_COMPAR_FAIL;
 
-    SMP_TRACE_EVENT ("%s: Result:%d", __FUNCTION__, res);
+    SMP_TRACE_EVENT ("%s: Result:%d", __func__, res);
 
     /* If timeout already expired or has been canceled, ignore the reply */
     if (p_cb->cb_evt != SMP_NC_REQ_EVT)
     {
-        SMP_TRACE_WARNING ("%s() - Wrong State: %d", __FUNCTION__,p_cb->state);
+        SMP_TRACE_WARNING ("%s() - Wrong State: %d", __func__,p_cb->state);
         return;
     }
 
     if (memcmp (bd_addr, p_cb->pairing_bda, BD_ADDR_LEN) != 0)
     {
-        SMP_TRACE_ERROR ("%s() - Wrong BD Addr",__FUNCTION__);
+        SMP_TRACE_ERROR ("%s() - Wrong BD Addr",__func__);
         return;
     }
 
     if (btm_find_dev (bd_addr) == NULL)
     {
-        SMP_TRACE_ERROR ("%s() - no dev CB",__FUNCTION__);
+        SMP_TRACE_ERROR ("%s() - no dev CB",__func__);
         return;
     }
 
     if (res != SMP_SUCCESS)
     {
-        SMP_TRACE_WARNING ("%s() - Numeric Comparison fails",__FUNCTION__);
+        SMP_TRACE_WARNING ("%s() - Numeric Comparison fails",__func__);
         /* send pairing failure */
         smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure);
     }
@@ -409,13 +409,13 @@
 **                  p_data      - simple pairing Randomizer  C.
 **
 *******************************************************************************/
-void SMP_OobDataReply(BD_ADDR bd_addr, tSMP_STATUS res, UINT8 len, UINT8 *p_data)
+void SMP_OobDataReply(BD_ADDR bd_addr, tSMP_STATUS res, uint8_t len, uint8_t *p_data)
 {
     tSMP_CB *p_cb = & smp_cb;
-    UINT8   failure = SMP_OOB_FAIL;
+    uint8_t failure = SMP_OOB_FAIL;
     tSMP_KEY        key;
 
-    SMP_TRACE_EVENT ("%s State: %d  res:%d", __FUNCTION__, smp_cb.state, res);
+    SMP_TRACE_EVENT ("%s State: %d  res:%d", __func__, smp_cb.state, res);
 
     /* If timeout already expired or has been canceled, ignore the reply */
     if (p_cb->state != SMP_STATE_WAIT_APP_RSP || p_cb->cb_evt != SMP_OOB_REQ_EVT)
@@ -449,45 +449,45 @@
 ** Parameters:      p_data      - pointer to the data
 **
 *******************************************************************************/
-void SMP_SecureConnectionOobDataReply(UINT8 *p_data)
+void SMP_SecureConnectionOobDataReply(uint8_t *p_data)
 {
     tSMP_CB  *p_cb = &smp_cb;
 
-    UINT8  failure = SMP_OOB_FAIL;
+    uint8_t failure = SMP_OOB_FAIL;
     tSMP_SC_OOB_DATA  *p_oob = (tSMP_SC_OOB_DATA *) p_data;
     if (!p_oob)
     {
-        SMP_TRACE_ERROR("%s received no data",__FUNCTION__);
+        SMP_TRACE_ERROR("%s received no data",__func__);
         smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure);
         return;
     }
 
     SMP_TRACE_EVENT ("%s req_oob_type: %d, loc_oob_data.present: %d, "
                        "peer_oob_data.present: %d",
-                       __FUNCTION__, p_cb->req_oob_type, p_oob->loc_oob_data.present,
+                       __func__, p_cb->req_oob_type, p_oob->loc_oob_data.present,
                        p_oob->peer_oob_data.present);
 
     if (p_cb->state != SMP_STATE_WAIT_APP_RSP || p_cb->cb_evt != SMP_SC_OOB_REQ_EVT)
         return;
 
-    BOOLEAN  data_missing = FALSE;
+    bool     data_missing = false;
     switch (p_cb->req_oob_type)
     {
         case SMP_OOB_PEER:
             if (!p_oob->peer_oob_data.present)
-                data_missing = TRUE;
+                data_missing = true;
             break;
         case SMP_OOB_LOCAL:
             if (!p_oob->loc_oob_data.present)
-                data_missing = TRUE;
+                data_missing = true;
             break;
         case SMP_OOB_BOTH:
             if (!p_oob->loc_oob_data.present || !p_oob->peer_oob_data.present)
-                data_missing = TRUE;
+                data_missing = true;
             break;
         default:
             SMP_TRACE_EVENT ("Unexpected OOB data type requested. Fail OOB");
-            data_missing = TRUE;
+            data_missing = true;
             break;
     }
 
@@ -518,12 +518,12 @@
 **
 **  Returns         Boolean - request is successful
 *******************************************************************************/
-BOOLEAN SMP_Encrypt (UINT8 *key, UINT8 key_len,
-                     UINT8 *plain_text, UINT8 pt_len,
+bool    SMP_Encrypt (uint8_t *key, uint8_t key_len,
+                     uint8_t *plain_text, uint8_t pt_len,
                      tSMP_ENC *p_out)
 
 {
-    BOOLEAN status=FALSE;
+    bool    status=false;
     status = smp_encrypt_data(key, key_len, plain_text, pt_len, p_out);
     return status;
 }
@@ -538,21 +538,21 @@
 **                 value        Keypress notification parameter value
 **
 *******************************************************************************/
-void SMP_KeypressNotification (BD_ADDR bd_addr, UINT8 value)
+void SMP_KeypressNotification (BD_ADDR bd_addr, uint8_t value)
 {
     tSMP_CB   *p_cb = &smp_cb;
 
-    SMP_TRACE_EVENT ("%s: Value: %d", __FUNCTION__,value);
+    SMP_TRACE_EVENT ("%s: Value: %d", __func__,value);
 
     if (memcmp (bd_addr, p_cb->pairing_bda, BD_ADDR_LEN) != 0)
     {
-        SMP_TRACE_ERROR ("%s() - Wrong BD Addr",__FUNCTION__);
+        SMP_TRACE_ERROR ("%s() - Wrong BD Addr",__func__);
         return;
     }
 
     if (btm_find_dev (bd_addr) == NULL)
     {
-        SMP_TRACE_ERROR ("%s() - no dev CB",__FUNCTION__);
+        SMP_TRACE_ERROR ("%s() - no dev CB",__func__);
         return;
     }
 
@@ -561,13 +561,13 @@
     if (p_cb->local_io_capability != SMP_IO_CAP_IN)
     {
         SMP_TRACE_ERROR ("%s() - wrong local IO capabilities %d",
-                          __FUNCTION__, p_cb->local_io_capability);
+                          __func__, p_cb->local_io_capability);
         return;
     }
 
     if (p_cb->selected_association_model != SMP_MODEL_SEC_CONN_PASSKEY_ENT)
     {
-        SMP_TRACE_ERROR ("%s() - wrong protocol %d", __FUNCTION__,
+        SMP_TRACE_ERROR ("%s() - wrong protocol %d", __func__,
                          p_cb->selected_association_model);
         return;
     }
@@ -584,23 +584,23 @@
 **
 ** Parameters:      bd_addr      - Address of the device to send OOB data block to
 **
-**  Returns         Boolean - TRUE: creation of local SC OOB data set started.
+**  Returns         Boolean - true: creation of local SC OOB data set started.
 *******************************************************************************/
-BOOLEAN SMP_CreateLocalSecureConnectionsOobData (tBLE_BD_ADDR *addr_to_send_to)
+bool    SMP_CreateLocalSecureConnectionsOobData (tBLE_BD_ADDR *addr_to_send_to)
 {
     tSMP_CB *p_cb = &smp_cb;
-    UINT8   *bd_addr;
+    uint8_t *bd_addr;
 
     if (addr_to_send_to == NULL)
     {
-        SMP_TRACE_ERROR ("%s addr_to_send_to is not provided",__FUNCTION__);
-        return FALSE;
+        SMP_TRACE_ERROR ("%s addr_to_send_to is not provided",__func__);
+        return false;
     }
 
     bd_addr = addr_to_send_to->bda;
 
     SMP_TRACE_EVENT ("%s addr type: %u,  BDA: %08x%04x,  state: %u, br_state: %u",
-                      __FUNCTION__, addr_to_send_to->type,
+                      __func__, addr_to_send_to->type,
                       (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8) + bd_addr[3],
                       (bd_addr[4]<<8)+bd_addr[5],
                       p_cb->state,
@@ -609,14 +609,14 @@
     if ((p_cb->state != SMP_STATE_IDLE) || (p_cb->smp_over_br))
     {
         SMP_TRACE_WARNING ("%s creation of local OOB data set "\
-            "starts only in IDLE state",__FUNCTION__);
-        return FALSE;
+            "starts only in IDLE state",__func__);
+        return false;
     }
 
     p_cb->sc_oob_data.loc_oob_data.addr_sent_to = *addr_to_send_to;
     smp_sm_event(p_cb, SMP_CR_LOC_SC_OOB_DATA_EVT, NULL);
 
-    return TRUE;
+    return true;
 }
 
 #endif /* SMP_INCLUDED */
diff --git a/stack/smp/smp_br_main.c b/stack/smp/smp_br_main.c
index 11039ec..dbeea27 100644
--- a/stack/smp/smp_br_main.c
+++ b/stack/smp/smp_br_main.c
@@ -21,7 +21,7 @@
 #include <string.h>
 #include "smp_int.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
 const char *const smp_br_state_name [SMP_BR_STATE_MAX+1] =
 {
@@ -69,7 +69,7 @@
 #define SMP_BR_NUM_ACTIONS     2
 #define SMP_BR_SME_NEXT_STATE  2
 #define SMP_BR_SM_NUM_COLS     3
-typedef const UINT8 (*tSMP_BR_SM_TBL)[SMP_BR_SM_NUM_COLS];
+typedef const uint8_t (*tSMP_BR_SM_TBL)[SMP_BR_SM_NUM_COLS];
 
 enum
 {
@@ -114,7 +114,7 @@
     smp_idle_terminate
 };
 
-static const UINT8 smp_br_all_table[][SMP_BR_SM_NUM_COLS] =
+static const uint8_t smp_br_all_table[][SMP_BR_SM_NUM_COLS] =
 {
 /*                               Event                    Action           Next State */
 /* BR_PAIRING_FAILED        */  {SMP_PROC_PAIR_FAIL,  SMP_BR_PAIRING_COMPLETE, SMP_BR_STATE_IDLE},
@@ -123,7 +123,7 @@
 };
 
 /************ SMP Master FSM State/Event Indirection Table **************/
-static const UINT8 smp_br_master_entry_map[][SMP_BR_STATE_MAX] =
+static const uint8_t smp_br_master_entry_map[][SMP_BR_STATE_MAX] =
 {
 /* br_state name:               Idle      WaitApp  Pair    Bond
                                           Rsp      ReqRsp  Pend       */
@@ -154,27 +154,27 @@
 /* BR_DISCARD_SEC_REQ       */  { 0,       0,       0,      0     }
 };
 
-static const UINT8 smp_br_master_idle_table[][SMP_BR_SM_NUM_COLS] =
+static const uint8_t smp_br_master_idle_table[][SMP_BR_SM_NUM_COLS] =
 {
 /*                                Event               Action               Next State */
 /* BR_L2CAP_CONN        */  {SMP_SEND_APP_CBACK, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_WAIT_APP_RSP},
 /* BR_L2CAP_DISCONN   */  {SMP_IDLE_TERMINATE,  SMP_BR_SM_NO_ACTION, SMP_BR_STATE_IDLE}
 };
 
-static const UINT8 smp_br_master_wait_appln_response_table[][SMP_BR_SM_NUM_COLS] =
+static const uint8_t smp_br_master_wait_appln_response_table[][SMP_BR_SM_NUM_COLS] =
 {
 /*                                Event               Action              Next State */
 /* BR_KEYS_RSP           */{SMP_SEND_PAIR_REQ, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_PAIR_REQ_RSP}
 };
 
-static const UINT8 smp_br_master_pair_request_response_table [][SMP_BR_SM_NUM_COLS] =
+static const uint8_t smp_br_master_pair_request_response_table [][SMP_BR_SM_NUM_COLS] =
 {
 /*                        Event               Action                  Next State */
 /* BR_PAIRING_RSP   */  {SMP_BR_PROC_PAIR_CMD, SMP_BR_CHECK_AUTH_REQ, SMP_BR_STATE_PAIR_REQ_RSP},
 /* BR_BOND_REQ      */  {SMP_BR_SM_NO_ACTION, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING}
 };
 
-static const UINT8 smp_br_master_bond_pending_table[][SMP_BR_SM_NUM_COLS] =
+static const uint8_t smp_br_master_bond_pending_table[][SMP_BR_SM_NUM_COLS] =
 {
 /*                                Event               Action              Next State */
 /* BR_ID_INFO               */{SMP_PROC_ID_INFO, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING},
@@ -182,7 +182,7 @@
 /* BR_SIGN_INFO             */{SMP_PROC_SRK_INFO, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING}
 };
 
-static const UINT8 smp_br_slave_entry_map[][SMP_BR_STATE_MAX] =
+static const uint8_t smp_br_slave_entry_map[][SMP_BR_STATE_MAX] =
 {
 /* br_state name:               Idle      WaitApp  Pair    Bond
                                           Rsp      ReqRsp  Pend      */
@@ -213,13 +213,13 @@
 /* BR_DISCARD_SEC_REQ       */  { 0,       0,       0,      0    }
 };
 
-static const UINT8 smp_br_slave_idle_table[][SMP_BR_SM_NUM_COLS] =
+static const uint8_t smp_br_slave_idle_table[][SMP_BR_SM_NUM_COLS] =
 {
 /*                               Event                Action              Next State */
 /* BR_PAIRING_REQ    */ {SMP_BR_PROC_PAIR_CMD, SMP_SEND_APP_CBACK, SMP_BR_STATE_WAIT_APP_RSP}
 };
 
-static const UINT8 smp_br_slave_wait_appln_response_table [][SMP_BR_SM_NUM_COLS] =
+static const uint8_t smp_br_slave_wait_appln_response_table [][SMP_BR_SM_NUM_COLS] =
 {
 /*                               Event                 Action             Next State */
 /* BR_API_SEC_GRANT */ {SMP_BR_PROC_SEC_GRANT, SMP_SEND_APP_CBACK, SMP_BR_STATE_WAIT_APP_RSP},
@@ -227,7 +227,7 @@
 /* BR_BOND_REQ        */ {SMP_BR_KEY_DISTRIBUTION, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING}
 };
 
-static const UINT8 smp_br_slave_bond_pending_table[][SMP_BR_SM_NUM_COLS] =
+static const uint8_t smp_br_slave_bond_pending_table[][SMP_BR_SM_NUM_COLS] =
 {
 /*                                Event               Action               Next State */
 /* BR_ID_INFO               */  {SMP_PROC_ID_INFO, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING},
@@ -250,7 +250,7 @@
     {smp_br_master_bond_pending_table, smp_br_slave_bond_pending_table},
 };
 
-typedef const UINT8 (*tSMP_BR_ENTRY_TBL)[SMP_BR_STATE_MAX];
+typedef const uint8_t (*tSMP_BR_ENTRY_TBL)[SMP_BR_STATE_MAX];
 
 static const tSMP_BR_ENTRY_TBL smp_br_entry_table[] =
 {
@@ -275,7 +275,7 @@
     }
     else
     {
-        SMP_TRACE_DEBUG("%s invalid br_state =%d", __FUNCTION__,br_state );
+        SMP_TRACE_DEBUG("%s invalid br_state =%d", __func__,br_state );
     }
 }
 
@@ -334,7 +334,7 @@
 {
     tSMP_BR_STATE       curr_state = p_cb->br_state;
     tSMP_BR_SM_TBL      state_table;
-    UINT8               action, entry;
+    uint8_t             action, entry;
     tSMP_BR_ENTRY_TBL   entry_table =  smp_br_entry_table[p_cb->role];
 
     SMP_TRACE_EVENT("main %s", __func__);
@@ -382,7 +382,7 @@
      * The action function may set the Param for cback.
      * Depending on param, call cback or free buffer. */
     /* execute action functions */
-    for (UINT8 i = 0; i < SMP_BR_NUM_ACTIONS; i++)
+    for (uint8_t i = 0; i < SMP_BR_NUM_ACTIONS; i++)
     {
         if ((action = state_table[entry - 1][i]) != SMP_BR_SM_NO_ACTION)
         {
diff --git a/stack/smp/smp_cmac.c b/stack/smp/smp_cmac.c
index b164669..7224a18 100644
--- a/stack/smp/smp_cmac.c
+++ b/stack/smp/smp_cmac.c
@@ -24,7 +24,7 @@
 
 #include "bt_target.h"
 
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
     #include <stdio.h>
     #include <string.h>
 
@@ -34,9 +34,9 @@
 
 typedef struct
 {
-    UINT8               *text;
-    UINT16              len;
-    UINT16              round;
+    uint8_t             *text;
+    uint16_t            len;
+    uint16_t            round;
 }tCMAC_CB;
 
 tCMAC_CB    cmac_cb;
@@ -47,11 +47,11 @@
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
-void print128(BT_OCTET16 x, const UINT8 *key_name)
+void print128(BT_OCTET16 x, const uint8_t *key_name)
 {
-#if SMP_DEBUG == TRUE && SMP_DEBUG_VERBOSE == TRUE
-    UINT8  *p = (UINT8 *)x;
-    UINT8  i;
+#if (SMP_DEBUG == TRUE && SMP_DEBUG_VERBOSE == TRUE)
+    uint8_t *p = (uint8_t *)x;
+    uint8_t i;
 
     SMP_TRACE_WARNING("%s(MSB ~ LSB) = ", key_name);
 
@@ -76,9 +76,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void padding ( BT_OCTET16 dest, UINT8 length )
+static void padding ( BT_OCTET16 dest, uint8_t length )
 {
-    UINT8   i, *p = dest;
+    uint8_t i, *p = dest;
     /* original last block */
     for ( i = length ; i < BT_OCTET16_LEN; i++ )
         p[BT_OCTET16_LEN - i - 1] = ( i == length ) ? 0x80 : 0;
@@ -92,9 +92,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void leftshift_onebit(UINT8 *input, UINT8 *output)
+static void leftshift_onebit(uint8_t *input, uint8_t *output)
 {
-    UINT8   i, overflow = 0 , next_overflow = 0;
+    uint8_t i, overflow = 0 , next_overflow = 0;
     SMP_TRACE_EVENT ("leftshift_onebit ");
     /* input[0] is LSB */
     for ( i = 0; i < BT_OCTET16_LEN ; i ++ )
@@ -129,12 +129,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-static BOOLEAN cmac_aes_k_calculate(BT_OCTET16 key, UINT8 *p_signature, UINT16 tlen)
+static bool    cmac_aes_k_calculate(BT_OCTET16 key, uint8_t *p_signature, uint16_t tlen)
 {
     tSMP_ENC output;
-    UINT8    i = 1, err = 0;
-    UINT8    x[16] = {0};
-    UINT8   *p_mac;
+    uint8_t  i = 1, err = 0;
+    uint8_t  x[16] = {0};
+    uint8_t *p_mac;
 
     SMP_TRACE_EVENT ("cmac_aes_k_calculate ");
 
@@ -163,11 +163,11 @@
         SMP_TRACE_DEBUG("p_mac[4] = 0x%02x p_mac[5] = 0x%02x p_mac[6] = 0x%02x p_mac[7] = 0x%02x",
                          *(p_mac + 4), *(p_mac + 5), *(p_mac + 6), *(p_mac + 7));
 
-        return TRUE;
+        return true;
 
     }
     else
-        return FALSE;
+        return false;
 }
 /*******************************************************************************
 **
@@ -181,12 +181,12 @@
 *******************************************************************************/
 static void cmac_prepare_last_block (BT_OCTET16 k1, BT_OCTET16 k2)
 {
-//    UINT8       x[16] = {0};
-    BOOLEAN      flag;
+//    uint8_t     x[16] = {0};
+    bool         flag;
 
     SMP_TRACE_EVENT ("cmac_prepare_last_block ");
     /* last block is a complete block set flag to 1 */
-    flag = ((cmac_cb.len % BT_OCTET16_LEN) == 0 && cmac_cb.len != 0)  ? TRUE : FALSE;
+    flag = ((cmac_cb.len % BT_OCTET16_LEN) == 0 && cmac_cb.len != 0)  ? true : false;
 
     SMP_TRACE_WARNING("flag = %d round = %d", flag, cmac_cb.round);
 
@@ -196,7 +196,7 @@
     }
     else /* padding then xor with k2 */
     {
-        padding(&cmac_cb.text[0], (UINT8)(cmac_cb.len % 16));
+        padding(&cmac_cb.text[0], (uint8_t)(cmac_cb.len % 16));
 
         smp_xor_128(&cmac_cb.text[0], k2);
     }
@@ -212,10 +212,10 @@
 *******************************************************************************/
 static void cmac_subkey_cont(tSMP_ENC *p)
 {
-    UINT8 k1[BT_OCTET16_LEN], k2[BT_OCTET16_LEN];
-    UINT8 *pp = p->param_buf;
+    uint8_t k1[BT_OCTET16_LEN], k2[BT_OCTET16_LEN];
+    uint8_t *pp = p->param_buf;
     SMP_TRACE_EVENT ("cmac_subkey_cont ");
-    print128(pp, (const UINT8 *)"K1 before shift");
+    print128(pp, (const uint8_t *)"K1 before shift");
 
     /* If MSB(L) = 0, then K1 = L << 1 */
     if ( (pp[BT_OCTET16_LEN - 1] & 0x80) != 0 )
@@ -241,8 +241,8 @@
         leftshift_onebit(k1, k2);
     }
 
-    print128(k1, (const UINT8 *)"K1");
-    print128(k2, (const UINT8 *)"K2");
+    print128(k1, (const uint8_t *)"K1");
+    print128(k2, (const uint8_t *)"K2");
 
     cmac_prepare_last_block (k1, k2);
 }
@@ -257,10 +257,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static BOOLEAN cmac_generate_subkey(BT_OCTET16 key)
+static bool    cmac_generate_subkey(BT_OCTET16 key)
 {
     BT_OCTET16 z = {0};
-    BOOLEAN     ret = TRUE;
+    bool        ret = true;
     tSMP_ENC output;
     SMP_TRACE_EVENT (" cmac_generate_subkey");
 
@@ -269,7 +269,7 @@
         cmac_subkey_cont(&output);;
     }
     else
-        ret = FALSE;
+        ret = false;
 
     return ret;
 }
@@ -285,15 +285,15 @@
 **                  tlen - lenth of mac desired
 **                  p_signature - data pointer to where signed data to be stored, tlen long.
 **
-** Returns          FALSE if out of resources, TRUE in other cases.
+** Returns          false if out of resources, true in other cases.
 **
 *******************************************************************************/
-BOOLEAN aes_cipher_msg_auth_code(BT_OCTET16 key, UINT8 *input, UINT16 length,
-                                 UINT16 tlen, UINT8 *p_signature)
+bool    aes_cipher_msg_auth_code(BT_OCTET16 key, uint8_t *input, uint16_t length,
+                                 uint16_t tlen, uint8_t *p_signature)
 {
-    UINT16  len, diff;
-    UINT16  n = (length + BT_OCTET16_LEN - 1) / BT_OCTET16_LEN;       /* n is number of rounds */
-    BOOLEAN ret = FALSE;
+    uint16_t len, diff;
+    uint16_t n = (length + BT_OCTET16_LEN - 1) / BT_OCTET16_LEN;       /* n is number of rounds */
+    bool    ret = false;
 
     SMP_TRACE_EVENT ("%s", __func__);
 
@@ -302,7 +302,7 @@
 
     SMP_TRACE_WARNING("AES128_CMAC started, allocate buffer size = %d", len);
     /* allocate a memory space of multiple of 16 bytes to hold text  */
-    cmac_cb.text = (UINT8 *)osi_calloc(len);
+    cmac_cb.text = (uint8_t *)osi_calloc(len);
     cmac_cb.round = n;
     diff = len - length;
 
@@ -325,7 +325,7 @@
 }
 
     #if 0 /* testing code, sample data from spec */
-void test_cmac_cback(UINT8 *p_mac, UINT16 tlen)
+void test_cmac_cback(uint8_t *p_mac, uint16_t tlen)
 {
     SMP_TRACE_EVENT ("test_cmac_cback ");
     SMP_TRACE_ERROR("test_cmac_cback");
@@ -334,7 +334,7 @@
 void test_cmac(void)
 {
     SMP_TRACE_EVENT ("test_cmac ");
-    UINT8 M[64] = {
+    uint8_t M[64] = {
         0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
         0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
         0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
@@ -345,12 +345,12 @@
         0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
     };
 
-    UINT8 key[16] = {
+    uint8_t key[16] = {
         0x3c, 0x4f, 0xcf, 0x09, 0x88, 0x15, 0xf7, 0xab,
         0xa6, 0xd2, 0xae, 0x28, 0x16, 0x15, 0x7e, 0x2b
     };
-    UINT8 i =0, tmp;
-    UINT16 len;
+    uint8_t i =0, tmp;
+    uint16_t len;
 
     len = 64;
 
diff --git a/stack/smp/smp_int.h b/stack/smp/smp_int.h
index b2bc71c..8d951d2 100644
--- a/stack/smp/smp_int.h
+++ b/stack/smp/smp_int.h
@@ -24,7 +24,7 @@
 #ifndef  SMP_INT_H
 #define  SMP_INT_H
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
 #include "btu.h"
 #include "btm_ble_api.h"
@@ -47,7 +47,7 @@
                                     /* this side displays the key */
 #define SMP_MODEL_SEC_CONN_OOB  8   /* Secure Connections mode, OOB model */
 #define SMP_MODEL_OUT_OF_RANGE  9
-typedef UINT8   tSMP_ASSO_MODEL;
+typedef uint8_t tSMP_ASSO_MODEL;
 
 
 #ifndef SMP_MAX_CONN
@@ -132,7 +132,7 @@
 #define SMP_CR_LOC_SC_OOB_DATA_EVT      (SMP_SELF_DEF_EVT + 24)
 #define SMP_MAX_EVT                      SMP_CR_LOC_SC_OOB_DATA_EVT
 
-typedef UINT8 tSMP_EVENT;
+typedef uint8_t tSMP_EVENT;
 
 /* Assumption it's only using the low 8 bits, if bigger than that, need to expand it to 16 bits */
 #define SMP_SEC_KEY_MASK                    0x00ff
@@ -159,7 +159,7 @@
     SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA,
     SMP_STATE_MAX
 };
-typedef UINT8 tSMP_STATE;
+typedef uint8_t tSMP_STATE;
 
 /* SMP over BR/EDR events */
 #define SMP_BR_PAIRING_REQ_EVT              SMP_OPCODE_PAIRING_REQ
@@ -189,7 +189,7 @@
 #define SMP_BR_BOND_REQ_EVT                 (SMP_BR_SELF_DEF_EVT + 10)
 #define SMP_BR_DISCARD_SEC_REQ_EVT          (SMP_BR_SELF_DEF_EVT + 11)
 #define SMP_BR_MAX_EVT                      (SMP_BR_SELF_DEF_EVT + 12)
-typedef UINT8 tSMP_BR_EVENT;
+typedef uint8_t tSMP_BR_EVENT;
 
 /* SMP over BR/EDR pairing states */
 enum
@@ -200,7 +200,7 @@
     SMP_BR_STATE_BOND_PENDING,
     SMP_BR_STATE_MAX
 };
-typedef UINT8 tSMP_BR_STATE;
+typedef uint8_t tSMP_BR_STATE;
 
 /* random and encrption activity state */
 enum
@@ -233,16 +233,16 @@
 };
 typedef struct
 {
-    UINT8   key_type;
-    UINT8*  p_data;
+    uint8_t key_type;
+    uint8_t*  p_data;
 }tSMP_KEY;
 
 typedef union
 {
-    UINT8       *p_data;    /* UINT8 type data pointer */
+    uint8_t     *p_data;    /* uint8_t type data pointer */
     tSMP_KEY    key;
-    UINT16      reason;
-    UINT32      passkey;
+    uint16_t    reason;
+    uint32_t    passkey;
     tSMP_OOB_DATA_TYPE  req_oob_type;
 }tSMP_INT_DATA;
 
@@ -274,22 +274,22 @@
 {
     tSMP_CALLBACK   *p_callback;
     alarm_t         *smp_rsp_timer_ent;
-    UINT8           trace_level;
+    uint8_t         trace_level;
     BD_ADDR         pairing_bda;
     tSMP_STATE      state;
-    BOOLEAN         derive_lk;
-    BOOLEAN         id_addr_rcvd;
+    bool            derive_lk;
+    bool            id_addr_rcvd;
     tBLE_ADDR_TYPE  id_addr_type;
     BD_ADDR         id_addr;
-    BOOLEAN         smp_over_br;
+    bool            smp_over_br;
     tSMP_BR_STATE   br_state;           /* if SMP over BR/ERD has priority over SMP */
-    UINT8           failure;
-    UINT8           status;
-    UINT8           role;
-    UINT16          flags;
-    UINT8           cb_evt;
+    uint8_t         failure;
+    uint8_t         status;
+    uint8_t         role;
+    uint16_t        flags;
+    uint8_t         cb_evt;
     tSMP_SEC_LEVEL  sec_level;
-    BOOLEAN         connect_initialized;
+    bool            connect_initialized;
     BT_OCTET16      confirm;
     BT_OCTET16      rconfirm;
     BT_OCTET16      rrand;                      /* for SC this is peer nonce */
@@ -312,46 +312,46 @@
     tSMP_OOB_FLAG   loc_oob_flag;
     tSMP_AUTH_REQ   peer_auth_req;
     tSMP_AUTH_REQ   loc_auth_req;
-    BOOLEAN         secure_connections_only_mode_required;/* TRUE if locally SM is required to operate */
+    bool            secure_connections_only_mode_required;/* true if locally SM is required to operate */
                                             /* either in Secure Connections mode or not at all */
     tSMP_ASSO_MODEL selected_association_model;
-    BOOLEAN         le_secure_connections_mode_is_used;
-    BOOLEAN le_sc_kp_notif_is_used;
+    bool            le_secure_connections_mode_is_used;
+    bool    le_sc_kp_notif_is_used;
     tSMP_SC_KEY_TYPE local_keypress_notification;
     tSMP_SC_KEY_TYPE peer_keypress_notification;
-    UINT8           round;       /* authentication stage 1 round for passkey association model */
-    UINT32          number_to_display;
+    uint8_t         round;       /* authentication stage 1 round for passkey association model */
+    uint32_t        number_to_display;
     BT_OCTET16      mac_key;
-    UINT8           peer_enc_size;
-    UINT8           loc_enc_size;
-    UINT8           peer_i_key;
-    UINT8           peer_r_key;
-    UINT8           local_i_key;
-    UINT8           local_r_key;
+    uint8_t         peer_enc_size;
+    uint8_t         loc_enc_size;
+    uint8_t         peer_i_key;
+    uint8_t         peer_r_key;
+    uint8_t         local_i_key;
+    uint8_t         local_r_key;
 
     BT_OCTET16      tk;
     BT_OCTET16      ltk;
-    UINT16          div;
+    uint16_t        div;
     BT_OCTET16      csrk;  /* storage for local CSRK */
-    UINT16          ediv;
+    uint16_t        ediv;
     BT_OCTET8       enc_rand;
-    UINT8           rand_enc_proc_state;
-    UINT8           addr_type;
+    uint8_t         rand_enc_proc_state;
+    uint8_t         addr_type;
     BD_ADDR         local_bda;
-    BOOLEAN         is_pair_cancel;
-    BOOLEAN         discard_sec_req;
-    UINT8           rcvd_cmd_code;
-    UINT8           rcvd_cmd_len;
-    UINT16          total_tx_unacked;
-    BOOLEAN         wait_for_authorization_complete;
-    UINT8           cert_failure; /*failure case for certification */
+    bool            is_pair_cancel;
+    bool            discard_sec_req;
+    uint8_t         rcvd_cmd_code;
+    uint8_t         rcvd_cmd_len;
+    uint16_t        total_tx_unacked;
+    bool            wait_for_authorization_complete;
+    uint8_t         cert_failure; /*failure case for certification */
     alarm_t         *delayed_auth_timer_ent;
 }tSMP_CB;
 
 /* Server Action functions are of this type */
 typedef void (*tSMP_ACT)(tSMP_CB *p_cb, tSMP_INT_DATA *p_data);
 
-#if SMP_DYNAMIC_MEMORY == FALSE
+#if (SMP_DYNAMIC_MEMORY == FALSE)
 extern tSMP_CB  smp_cb;
 #else
 extern tSMP_CB *smp_cb_ptr;
@@ -369,25 +369,25 @@
 extern void smp_sm_event(tSMP_CB *p_cb, tSMP_EVENT event, void *p_data);
 
 extern void smp_proc_sec_request(tSMP_CB *p_cb, tSMP_INT_DATA *p_data);
-extern void  smp_set_fail_nc (BOOLEAN enable);
-extern void  smp_set_fail_conf (BOOLEAN enable);
-extern void  smp_set_passk_entry_fail(BOOLEAN enable);
-extern void  smp_set_oob_fail(BOOLEAN enable);
-extern void  smp_set_peer_sc_notif(BOOLEAN enable);
-extern void smp_aes_cmac_rfc4493_chk (UINT8 *key, UINT8 *msg, UINT8 msg_len,
-                                              UINT8 mac_len, UINT8 *mac);
-extern void smp_f4_calc_chk (UINT8 *U, UINT8 *V, UINT8 *X, UINT8 *Z, UINT8 *mac);
-extern void smp_g2_calc_chk (UINT8 *U, UINT8 *V, UINT8 *X, UINT8 *Y);
-extern void smp_h6_calc_chk (UINT8 *key, UINT8 *key_id, UINT8 *mac);
-extern void smp_f5_key_calc_chk (UINT8 *w, UINT8 *mac);
-extern void smp_f5_mackey_or_ltk_calc_chk(UINT8 *t, UINT8 *counter,
-                                                  UINT8 *key_id, UINT8 *n1,
-                                                  UINT8 *n2, UINT8 *a1, UINT8 *a2,
-                                                  UINT8 *length, UINT8 *mac);
-extern void smp_f5_calc_chk (UINT8 *w, UINT8 *n1, UINT8 *n2, UINT8 *a1, UINT8 *a2,
-                                    UINT8 *mac_key, UINT8 *ltk);
-extern void smp_f6_calc_chk (UINT8 *w, UINT8 *n1, UINT8 *n2, UINT8 *r,
-                                     UINT8 *iocap, UINT8 *a1, UINT8 *a2, UINT8 *mac);
+extern void  smp_set_fail_nc (bool    enable);
+extern void  smp_set_fail_conf (bool    enable);
+extern void  smp_set_passk_entry_fail(bool    enable);
+extern void  smp_set_oob_fail(bool    enable);
+extern void  smp_set_peer_sc_notif(bool    enable);
+extern void smp_aes_cmac_rfc4493_chk (uint8_t *key, uint8_t *msg, uint8_t msg_len,
+                                              uint8_t mac_len, uint8_t *mac);
+extern void smp_f4_calc_chk (uint8_t *U, uint8_t *V, uint8_t *X, uint8_t *Z, uint8_t *mac);
+extern void smp_g2_calc_chk (uint8_t *U, uint8_t *V, uint8_t *X, uint8_t *Y);
+extern void smp_h6_calc_chk (uint8_t *key, uint8_t *key_id, uint8_t *mac);
+extern void smp_f5_key_calc_chk (uint8_t *w, uint8_t *mac);
+extern void smp_f5_mackey_or_ltk_calc_chk(uint8_t *t, uint8_t *counter,
+                                                  uint8_t *key_id, uint8_t *n1,
+                                                  uint8_t *n2, uint8_t *a1, uint8_t *a2,
+                                                  uint8_t *length, uint8_t *mac);
+extern void smp_f5_calc_chk (uint8_t *w, uint8_t *n1, uint8_t *n2, uint8_t *a1, uint8_t *a2,
+                                    uint8_t *mac_key, uint8_t *ltk);
+extern void smp_f6_calc_chk (uint8_t *w, uint8_t *n1, uint8_t *n2, uint8_t *r,
+                                     uint8_t *iocap, uint8_t *a1, uint8_t *a2, uint8_t *mac);
 /* smp_main */
 extern void         smp_sm_event(tSMP_CB *p_cb, tSMP_EVENT event, void *p_data);
 extern tSMP_STATE   smp_get_state(void);
@@ -474,32 +474,32 @@
 extern void smp_data_ind (BD_ADDR bd_addr, BT_HDR *p_buf);
 
 /* smp_util.c */
-extern BOOLEAN smp_send_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
+extern bool    smp_send_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
 extern void smp_cb_cleanup(tSMP_CB *p_cb);
 extern void smp_reset_control_value(tSMP_CB *p_cb);
 extern void smp_proc_pairing_cmpl(tSMP_CB *p_cb);
-extern void smp_convert_string_to_tk(BT_OCTET16 tk, UINT32 passkey);
-extern void smp_mask_enc_key(UINT8 loc_enc_size, UINT8 * p_data);
+extern void smp_convert_string_to_tk(BT_OCTET16 tk, uint32_t passkey);
+extern void smp_mask_enc_key(uint8_t loc_enc_size, uint8_t * p_data);
 extern void smp_rsp_timeout(void *data);
 extern void smp_delayed_auth_complete_timeout(void *data);
 extern void smp_xor_128(BT_OCTET16 a, BT_OCTET16 b);
-extern BOOLEAN smp_encrypt_data (UINT8 *key, UINT8 key_len,
-                                 UINT8 *plain_text, UINT8 pt_len,
+extern bool    smp_encrypt_data (uint8_t *key, uint8_t key_len,
+                                 uint8_t *plain_text, uint8_t pt_len,
                                  tSMP_ENC *p_out);
-extern BOOLEAN smp_command_has_invalid_parameters(tSMP_CB *p_cb);
+extern bool    smp_command_has_invalid_parameters(tSMP_CB *p_cb);
 extern void smp_reject_unexpected_pairing_command(BD_ADDR bd_addr);
 extern tSMP_ASSO_MODEL smp_select_association_model(tSMP_CB *p_cb);
-extern void smp_reverse_array(UINT8 *arr, UINT8 len);
-extern UINT8 smp_calculate_random_input(UINT8 *random, UINT8 round);
-extern void smp_collect_local_io_capabilities(UINT8 *iocap, tSMP_CB *p_cb);
-extern void smp_collect_peer_io_capabilities(UINT8 *iocap, tSMP_CB *p_cb);
-extern void smp_collect_local_ble_address(UINT8 *le_addr, tSMP_CB *p_cb);
-extern void smp_collect_peer_ble_address(UINT8 *le_addr, tSMP_CB *p_cb);
-extern BOOLEAN smp_check_commitment(tSMP_CB *p_cb);
+extern void smp_reverse_array(uint8_t *arr, uint8_t len);
+extern uint8_t smp_calculate_random_input(uint8_t *random, uint8_t round);
+extern void smp_collect_local_io_capabilities(uint8_t *iocap, tSMP_CB *p_cb);
+extern void smp_collect_peer_io_capabilities(uint8_t *iocap, tSMP_CB *p_cb);
+extern void smp_collect_local_ble_address(uint8_t *le_addr, tSMP_CB *p_cb);
+extern void smp_collect_peer_ble_address(uint8_t *le_addr, tSMP_CB *p_cb);
+extern bool    smp_check_commitment(tSMP_CB *p_cb);
 extern void smp_save_secure_connections_long_term_key(tSMP_CB *p_cb);
-extern BOOLEAN smp_calculate_f5_mackey_and_long_term_key(tSMP_CB *p_cb);
+extern bool    smp_calculate_f5_mackey_and_long_term_key(tSMP_CB *p_cb);
 extern void smp_remove_fixed_channel(tSMP_CB *p_cb);
-extern BOOLEAN smp_request_oob_data(tSMP_CB *p_cb);
+extern bool    smp_request_oob_data(tSMP_CB *p_cb);
 
 /* smp_keys.c */
 extern void smp_generate_srand_mrand_confirm (tSMP_CB *p_cb, tSMP_INT_DATA *p_data);
@@ -517,28 +517,28 @@
 extern void smp_calculate_local_dhkey_check(tSMP_CB *p_cb, tSMP_INT_DATA *p_data);
 extern void smp_calculate_peer_dhkey_check(tSMP_CB *p_cb, tSMP_INT_DATA *p_data);
 extern void smp_start_nonce_generation(tSMP_CB *p_cb);
-extern BOOLEAN smp_calculate_link_key_from_long_term_key(tSMP_CB *p_cb);
-extern BOOLEAN smp_calculate_long_term_key_from_link_key(tSMP_CB *p_cb);
-extern void smp_calculate_f4(UINT8 *u, UINT8 *v, UINT8 *x, UINT8 z, UINT8 *c);
-extern UINT32 smp_calculate_g2(UINT8 *u, UINT8 *v, UINT8 *x, UINT8 *y);
-extern BOOLEAN smp_calculate_f5(UINT8 *w, UINT8 *n1, UINT8 *n2, UINT8 *a1, UINT8 *a2,
-                           UINT8 *mac_key, UINT8 *ltk);
-extern BOOLEAN smp_calculate_f5_mackey_or_long_term_key(UINT8 *t, UINT8 *counter,
-                                         UINT8 *key_id, UINT8 *n1, UINT8 *n2, UINT8 *a1,
-                                         UINT8 *a2, UINT8 *length, UINT8 *mac);
-extern BOOLEAN smp_calculate_f5_key(UINT8 *w, UINT8 *t);
-extern BOOLEAN smp_calculate_f6(UINT8 *w, UINT8 *n1, UINT8 *n2, UINT8 *r, UINT8 *iocap,
-                               UINT8 *a1, UINT8 *a2, UINT8 *f3);
-extern BOOLEAN smp_calculate_h6(UINT8 *w, UINT8 *keyid, UINT8 *h2);
-#if SMP_DEBUG == TRUE
-extern void smp_debug_print_nbyte_little_endian (UINT8 *p, const UINT8 *key_name,
-                                                 UINT8 len);
+extern bool    smp_calculate_link_key_from_long_term_key(tSMP_CB *p_cb);
+extern bool    smp_calculate_long_term_key_from_link_key(tSMP_CB *p_cb);
+extern void smp_calculate_f4(uint8_t *u, uint8_t *v, uint8_t *x, uint8_t z, uint8_t *c);
+extern uint32_t smp_calculate_g2(uint8_t *u, uint8_t *v, uint8_t *x, uint8_t *y);
+extern bool    smp_calculate_f5(uint8_t *w, uint8_t *n1, uint8_t *n2, uint8_t *a1, uint8_t *a2,
+                           uint8_t *mac_key, uint8_t *ltk);
+extern bool    smp_calculate_f5_mackey_or_long_term_key(uint8_t *t, uint8_t *counter,
+                                         uint8_t *key_id, uint8_t *n1, uint8_t *n2, uint8_t *a1,
+                                         uint8_t *a2, uint8_t *length, uint8_t *mac);
+extern bool    smp_calculate_f5_key(uint8_t *w, uint8_t *t);
+extern bool    smp_calculate_f6(uint8_t *w, uint8_t *n1, uint8_t *n2, uint8_t *r, uint8_t *iocap,
+                               uint8_t *a1, uint8_t *a2, uint8_t *f3);
+extern bool    smp_calculate_h6(uint8_t *w, uint8_t *keyid, uint8_t *h2);
+#if (SMP_DEBUG == TRUE)
+extern void smp_debug_print_nbyte_little_endian (uint8_t *p, const uint8_t *key_name,
+                                                 uint8_t len);
 #endif
 
 /* smp_cmac.c */
-extern BOOLEAN aes_cipher_msg_auth_code(BT_OCTET16 key, UINT8 *input, UINT16 length,
-                                                 UINT16 tlen, UINT8 *p_signature);
-extern void print128(BT_OCTET16 x, const UINT8 *key_name);
+extern bool    aes_cipher_msg_auth_code(BT_OCTET16 key, uint8_t *input, uint16_t length,
+                                                 uint16_t tlen, uint8_t *p_signature);
+extern void print128(BT_OCTET16 x, const uint8_t *key_name);
 
 #endif
 
diff --git a/stack/smp/smp_keys.c b/stack/smp/smp_keys.c
index 35187ee..01e7406 100644
--- a/stack/smp/smp_keys.c
+++ b/stack/smp/smp_keys.c
@@ -23,8 +23,8 @@
  ******************************************************************************/
 #include "bt_target.h"
 
-#if SMP_INCLUDED == TRUE
-#if SMP_DEBUG == TRUE
+#if (SMP_INCLUDED == TRUE)
+#if (SMP_DEBUG == TRUE)
     #include <stdio.h>
 #endif
 #include <string.h>
@@ -52,7 +52,7 @@
 static void smp_process_confirm(tSMP_CB *p_cb, tSMP_ENC *p);
 static void smp_process_compare(tSMP_CB *p_cb, tSMP_ENC *p);
 static void smp_process_ediv(tSMP_CB *p_cb, tSMP_ENC *p);
-static BOOLEAN smp_calculate_legacy_short_term_key(tSMP_CB *p_cb, tSMP_ENC *output);
+static bool    smp_calculate_legacy_short_term_key(tSMP_CB *p_cb, tSMP_ENC *output);
 static void smp_continue_private_key_creation(tSMP_CB *p_cb, tBTM_RAND_ENC *p);
 static void smp_process_private_key(tSMP_CB *p_cb);
 static void smp_finish_nonce_generation(tSMP_CB *p_cb);
@@ -60,13 +60,13 @@
 
 #define SMP_PASSKEY_MASK    0xfff00000
 
-void smp_debug_print_nbyte_little_endian(UINT8 *p, const UINT8 *key_name, UINT8 len)
+void smp_debug_print_nbyte_little_endian(uint8_t *p, const uint8_t *key_name, uint8_t len)
 {
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     int     ind;
     int     col_count = 32;
     int     row_count;
-    UINT8   p_buf[512];
+    uint8_t p_buf[512];
 
     SMP_TRACE_WARNING("%s(LSB ~ MSB):", key_name);
     memset(p_buf, 0, sizeof(p_buf));
@@ -84,10 +84,10 @@
 #endif
 }
 
-void smp_debug_print_nbyte_big_endian (UINT8 *p, const UINT8 *key_name, UINT8 len)
+void smp_debug_print_nbyte_big_endian (uint8_t *p, const uint8_t *key_name, uint8_t len)
 {
-#if SMP_DEBUG == TRUE
-    UINT8  p_buf[512];
+#if (SMP_DEBUG == TRUE)
+    uint8_t p_buf[512];
 
     SMP_TRACE_WARNING("%s(MSB ~ LSB):", key_name);
     memset(p_buf, 0, sizeof(p_buf));
@@ -119,25 +119,25 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN smp_encrypt_data (UINT8 *key, UINT8 key_len,
-                          UINT8 *plain_text, UINT8 pt_len,
+bool    smp_encrypt_data (uint8_t *key, uint8_t key_len,
+                          uint8_t *plain_text, uint8_t pt_len,
                           tSMP_ENC *p_out)
 {
     aes_context ctx;
-    UINT8 *p_start = NULL;
-    UINT8 *p = NULL;
-    UINT8 *p_rev_data = NULL;    /* input data in big endilan format */
-    UINT8 *p_rev_key = NULL;     /* input key in big endilan format */
-    UINT8 *p_rev_output = NULL;  /* encrypted output in big endilan format */
+    uint8_t *p_start = NULL;
+    uint8_t *p = NULL;
+    uint8_t *p_rev_data = NULL;    /* input data in big endilan format */
+    uint8_t *p_rev_key = NULL;     /* input key in big endilan format */
+    uint8_t *p_rev_output = NULL;  /* encrypted output in big endilan format */
 
     SMP_TRACE_DEBUG ("%s", __func__);
     if ( (p_out == NULL ) || (key_len != SMP_ENCRYT_KEY_SIZE) )
     {
         SMP_TRACE_ERROR ("%s failed", __func__);
-        return FALSE;
+        return false;
     }
 
-    p_start = (UINT8 *)osi_calloc(SMP_ENCRYT_DATA_SIZE * 4);
+    p_start = (uint8_t *)osi_calloc(SMP_ENCRYT_DATA_SIZE * 4);
 
     if (pt_len > SMP_ENCRYT_DATA_SIZE)
         pt_len = SMP_ENCRYT_DATA_SIZE;
@@ -149,9 +149,9 @@
     p_rev_key = p; /* start at byte 32 */
     REVERSE_ARRAY_TO_STREAM (p, key, SMP_ENCRYT_KEY_SIZE); /* byte 32 to byte 47 */
 
-#if SMP_DEBUG == TRUE && SMP_DEBUG_VERBOSE == TRUE
-    smp_debug_print_nbyte_little_endian(key, (const UINT8 *)"Key", SMP_ENCRYT_KEY_SIZE);
-    smp_debug_print_nbyte_little_endian(p_start, (const UINT8 *)"Plain text", SMP_ENCRYT_DATA_SIZE);
+#if (SMP_DEBUG == TRUE && SMP_DEBUG_VERBOSE == TRUE)
+    smp_debug_print_nbyte_little_endian(key, (const uint8_t *)"Key", SMP_ENCRYT_KEY_SIZE);
+    smp_debug_print_nbyte_little_endian(p_start, (const uint8_t *)"Plain text", SMP_ENCRYT_DATA_SIZE);
 #endif
     p_rev_output = p;
     aes_set_key(p_rev_key, SMP_ENCRYT_KEY_SIZE, &ctx);
@@ -159,8 +159,8 @@
 
     p = p_out->param_buf;
     REVERSE_ARRAY_TO_STREAM (p, p_rev_output, SMP_ENCRYT_DATA_SIZE);
-#if SMP_DEBUG == TRUE && SMP_DEBUG_VERBOSE == TRUE
-    smp_debug_print_nbyte_little_endian(p_out->param_buf, (const UINT8 *)"Encrypted text", SMP_ENCRYT_KEY_SIZE);
+#if (SMP_DEBUG == TRUE && SMP_DEBUG_VERBOSE == TRUE)
+    smp_debug_print_nbyte_little_endian(p_out->param_buf, (const uint8_t *)"Encrypted text", SMP_ENCRYT_KEY_SIZE);
 #endif
 
     p_out->param_len = SMP_ENCRYT_KEY_SIZE;
@@ -169,7 +169,7 @@
 
     osi_free(p_start);
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -204,10 +204,10 @@
 *******************************************************************************/
 void smp_proc_passkey(tSMP_CB *p_cb , tBTM_RAND_ENC *p)
 {
-    UINT8   *tt = p_cb->tk;
+    uint8_t *tt = p_cb->tk;
     tSMP_KEY    key;
-    UINT32  passkey; /* 19655 test number; */
-    UINT8 *pp = p->param_buf;
+    uint32_t passkey; /* 19655 test number; */
+    uint8_t *pp = p->param_buf;
 
     SMP_TRACE_DEBUG ("%s", __func__);
     STREAM_TO_UINT32(passkey, pp);
@@ -339,8 +339,8 @@
 {
     UNUSED(p_data);
 
-    BOOLEAN div_status;
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
+    bool    div_status;
+    SMP_TRACE_DEBUG ("%s", __func__);
     if (smp_get_br_state() == SMP_BR_STATE_BOND_PENDING)
     {
         smp_br_process_link_key(p_cb, NULL);
@@ -383,9 +383,9 @@
     UNUSED(p_data);
 
     BT_OCTET16  er;
-    UINT8       buffer[4]; /* for (r || DIV)  r=1*/
-    UINT16      r=1;
-    UINT8       *p=buffer;
+    uint8_t     buffer[4]; /* for (r || DIV)  r=1*/
+    uint16_t    r=1;
+    uint8_t     *p=buffer;
     tSMP_ENC    output;
     tSMP_STATUS   status = SMP_PAIR_FAIL_UNKNOWN;
 
@@ -429,7 +429,7 @@
 {
     UNUSED(p_data);
 
-    BOOLEAN     div_status;
+    bool        div_status;
 
     SMP_TRACE_DEBUG ("smp_generate_csrk");
 
@@ -451,9 +451,9 @@
 ** Function         smp_concatenate_peer
 **                  add pairing command sent from local device into p1.
 *******************************************************************************/
-void smp_concatenate_local( tSMP_CB *p_cb, UINT8 **p_data, UINT8 op_code)
+void smp_concatenate_local( tSMP_CB *p_cb, uint8_t **p_data, uint8_t op_code)
 {
-    UINT8   *p = *p_data;
+    uint8_t *p = *p_data;
 
     SMP_TRACE_DEBUG ("%s", __func__);
     UINT8_TO_STREAM(p, op_code);
@@ -471,9 +471,9 @@
 ** Function         smp_concatenate_peer
 **                  add pairing command received from peer device into p1.
 *******************************************************************************/
-void smp_concatenate_peer( tSMP_CB *p_cb, UINT8 **p_data, UINT8 op_code)
+void smp_concatenate_peer( tSMP_CB *p_cb, uint8_t **p_data, uint8_t op_code)
 {
-    UINT8   *p = *p_data;
+    uint8_t *p = *p_data;
 
     SMP_TRACE_DEBUG ("smp_concatenate_peer ");
     UINT8_TO_STREAM(p, op_code);
@@ -499,7 +499,7 @@
 *******************************************************************************/
 void smp_gen_p1_4_confirm( tSMP_CB *p_cb, BT_OCTET16 p1)
 {
-    UINT8 *p = (UINT8 *)p1;
+    uint8_t *p = (uint8_t *)p1;
     tBLE_ADDR_TYPE    addr_type = 0;
     BD_ADDR           remote_bda;
 
@@ -535,9 +535,9 @@
         /* concatinate pres */
         smp_concatenate_local(p_cb, &p, SMP_OPCODE_PAIRING_RSP);
     }
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     SMP_TRACE_DEBUG("p1 = pres || preq || rat' || iat'");
-    smp_debug_print_nbyte_little_endian ((UINT8 *)p1, (const UINT8 *)"P1", 16);
+    smp_debug_print_nbyte_little_endian ((uint8_t *)p1, (const uint8_t *)"P1", 16);
 #endif
 }
 
@@ -553,7 +553,7 @@
 *******************************************************************************/
 void smp_gen_p2_4_confirm( tSMP_CB *p_cb, BT_OCTET16 p2)
 {
-    UINT8       *p = (UINT8 *)p2;
+    uint8_t     *p = (uint8_t *)p2;
     BD_ADDR     remote_bda;
     tBLE_ADDR_TYPE  addr_type = 0;
 
@@ -581,9 +581,9 @@
         /* ia */
         BDADDR_TO_STREAM(p, remote_bda);
     }
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     SMP_TRACE_DEBUG("p2 = padding || ia || ra");
-    smp_debug_print_nbyte_little_endian(p2, (const UINT8 *)"p2", 16);
+    smp_debug_print_nbyte_little_endian(p2, (const uint8_t *)"p2", 16);
 #endif
 }
 
@@ -611,7 +611,7 @@
     /* p1 = rand XOR p1 */
     smp_xor_128(p1, rand);
 
-    smp_debug_print_nbyte_little_endian ((UINT8 *)p1, (const UINT8 *)"P1' = r XOR p1", 16);
+    smp_debug_print_nbyte_little_endian ((uint8_t *)p1, (const uint8_t *)"P1' = r XOR p1", 16);
 
     /* calculate e(k, r XOR p1), where k = TK */
     if (!SMP_Encrypt(p_cb->tk, BT_OCTET16_LEN, p1, BT_OCTET16_LEN, &output))
@@ -642,16 +642,16 @@
     tSMP_STATUS     status = SMP_PAIR_FAIL_UNKNOWN;
 
     SMP_TRACE_DEBUG ("smp_calculate_comfirm_cont ");
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     SMP_TRACE_DEBUG("Confirm step 1 p1' = e(k, r XOR p1)  Generated");
-    smp_debug_print_nbyte_little_endian (p->param_buf, (const UINT8 *)"C1", 16);
+    smp_debug_print_nbyte_little_endian (p->param_buf, (const uint8_t *)"C1", 16);
 #endif
 
     smp_gen_p2_4_confirm(p_cb, p2);
 
     /* calculate p2 = (p1' XOR p2) */
     smp_xor_128(p2, p->param_buf);
-    smp_debug_print_nbyte_little_endian ((UINT8 *)p2, (const UINT8 *)"p2' = C1 xor p2", 16);
+    smp_debug_print_nbyte_little_endian ((uint8_t *)p2, (const uint8_t *)"p2' = C1 xor p2", 16);
 
     /* calculate: Confirm = E(k, p1' XOR p2) */
     if (!SMP_Encrypt(p_cb->tk, BT_OCTET16_LEN, p2, BT_OCTET16_LEN, &output))
@@ -690,7 +690,7 @@
 
     SMP_TRACE_DEBUG ("%s", __func__);
     p_cb->rand_enc_proc_state = SMP_GEN_CONFIRM;
-    smp_debug_print_nbyte_little_endian ((UINT8 *)p_cb->rand,  (const UINT8 *)"local rand", 16);
+    smp_debug_print_nbyte_little_endian ((uint8_t *)p_cb->rand,  (const uint8_t *)"local rand", 16);
     smp_calculate_comfirm(p_cb, p_cb->rand, p_cb->pairing_bda);
 }
 
@@ -711,7 +711,7 @@
 
     SMP_TRACE_DEBUG ("smp_generate_compare ");
     p_cb->rand_enc_proc_state = SMP_GEN_COMPARE;
-    smp_debug_print_nbyte_little_endian ((UINT8 *)p_cb->rrand,  (const UINT8 *)"peer rand", 16);
+    smp_debug_print_nbyte_little_endian ((uint8_t *)p_cb->rrand,  (const uint8_t *)"peer rand", 16);
     smp_calculate_comfirm(p_cb, p_cb->rrand, p_cb->local_bda);
 }
 
@@ -729,12 +729,12 @@
 {
     tSMP_KEY    key;
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG ("%s", __func__);
     memcpy(p_cb->confirm, p->param_buf, BT_OCTET16_LEN);
 
 #if (SMP_DEBUG == TRUE)
     SMP_TRACE_DEBUG("Confirm  Generated");
-    smp_debug_print_nbyte_little_endian ((UINT8 *)p_cb->confirm,  (const UINT8 *)"Confirm", 16);
+    smp_debug_print_nbyte_little_endian ((uint8_t *)p_cb->confirm,  (const uint8_t *)"Confirm", 16);
 #endif
 
     key.key_type = SMP_KEY_TYPE_CFM;
@@ -759,7 +759,7 @@
     SMP_TRACE_DEBUG ("smp_process_compare ");
 #if (SMP_DEBUG == TRUE)
     SMP_TRACE_DEBUG("Compare Generated");
-    smp_debug_print_nbyte_little_endian (p->param_buf,  (const UINT8 *)"Compare", 16);
+    smp_debug_print_nbyte_little_endian (p->param_buf,  (const uint8_t *)"Compare", 16);
 #endif
     key.key_type = SMP_KEY_TYPE_CMP;
     key.p_data   = p->param_buf;
@@ -814,8 +814,8 @@
     BTM_GetDeviceEncRoot(er);
 
     /* LTK = d1(ER, DIV, 0)= e(ER, DIV)*/
-    if (!SMP_Encrypt(er, BT_OCTET16_LEN, (UINT8 *)&p_cb->div,
-                     sizeof(UINT16), &output))
+    if (!SMP_Encrypt(er, BT_OCTET16_LEN, (uint8_t *)&p_cb->div,
+                     sizeof(uint16_t), &output))
     {
         SMP_TRACE_ERROR("%s failed", __func__);
         smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status);
@@ -896,8 +896,8 @@
 static void smp_process_ediv(tSMP_CB *p_cb, tSMP_ENC *p)
 {
     tSMP_KEY    key;
-    UINT8 *pp= p->param_buf;
-    UINT16  y;
+    uint8_t *pp= p->param_buf;
+    uint16_t y;
 
     SMP_TRACE_DEBUG ("smp_process_ediv ");
     STREAM_TO_UINT16(y, pp);
@@ -918,13 +918,13 @@
 **
 ** Description      The function calculates legacy STK.
 **
-** Returns          FALSE if out of resources, TRUE in other cases.
+** Returns          false if out of resources, true in other cases.
 **
 *******************************************************************************/
-BOOLEAN smp_calculate_legacy_short_term_key(tSMP_CB *p_cb, tSMP_ENC *output)
+bool    smp_calculate_legacy_short_term_key(tSMP_CB *p_cb, tSMP_ENC *output)
 {
     BT_OCTET16 ptext;
-    UINT8 *p = ptext;
+    uint8_t *p = ptext;
 
     SMP_TRACE_DEBUG ("%s", __func__);
     memset(p, 0, BT_OCTET16_LEN);
@@ -939,7 +939,7 @@
         memcpy(&p[BT_OCTET8_LEN], p_cb->rand, BT_OCTET8_LEN);
     }
 
-    BOOLEAN encrypted;
+    bool    encrypted;
     /* generate STK = Etk(rand|rrand)*/
     encrypted = SMP_Encrypt( p_cb->tk, BT_OCTET16_LEN, ptext, BT_OCTET16_LEN, output);
     if (!encrypted)
@@ -963,7 +963,7 @@
 *******************************************************************************/
 void smp_create_private_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    SMP_TRACE_DEBUG ("%s",__FUNCTION__);
+    SMP_TRACE_DEBUG ("%s",__func__);
     p_cb->rand_enc_proc_state = SMP_GENERATE_PRIVATE_KEY_0_7;
     if (!btsnd_hcic_ble_rand((void *)smp_rand_back))
         smp_rand_back(NULL);
@@ -1017,7 +1017,7 @@
 *******************************************************************************/
 void smp_continue_private_key_creation (tSMP_CB *p_cb, tBTM_RAND_ENC *p)
 {
-    UINT8   state = p_cb->rand_enc_proc_state & ~0x80;
+    uint8_t state = p_cb->rand_enc_proc_state & ~0x80;
     SMP_TRACE_DEBUG ("%s state=0x%x", __func__, state);
 
     switch (state)
@@ -1071,18 +1071,18 @@
     Point       public_key;
     BT_OCTET32  private_key;
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG ("%s", __func__);
 
     memcpy(private_key, p_cb->private_key, BT_OCTET32_LEN);
     ECC_PointMult(&public_key, &(curve_p256.G), (DWORD*) private_key, KEY_LENGTH_DWORDS_P256);
     memcpy(p_cb->loc_publ_key.x, public_key.x, BT_OCTET32_LEN);
     memcpy(p_cb->loc_publ_key.y, public_key.y, BT_OCTET32_LEN);
 
-    smp_debug_print_nbyte_little_endian (p_cb->private_key, (const UINT8 *)"private",
+    smp_debug_print_nbyte_little_endian (p_cb->private_key, (const uint8_t *)"private",
                                          BT_OCTET32_LEN);
-    smp_debug_print_nbyte_little_endian (p_cb->loc_publ_key.x, (const UINT8 *)"local public(x)",
+    smp_debug_print_nbyte_little_endian (p_cb->loc_publ_key.x, (const uint8_t *)"local public(x)",
                                          BT_OCTET32_LEN);
-    smp_debug_print_nbyte_little_endian (p_cb->loc_publ_key.y, (const UINT8 *)"local public(y)",
+    smp_debug_print_nbyte_little_endian (p_cb->loc_publ_key.y, (const uint8_t *)"local public(y)",
                                          BT_OCTET32_LEN);
     p_cb->flags |= SMP_PAIR_FLAG_HAVE_LOCAL_PUBL_KEY;
     smp_sm_event(p_cb, SMP_LOC_PUBL_KEY_CRTD_EVT, NULL);
@@ -1105,7 +1105,7 @@
     Point       peer_publ_key, new_publ_key;
     BT_OCTET32  private_key;
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG ("%s", __func__);
 
     memcpy(private_key, p_cb->private_key, BT_OCTET32_LEN);
     memcpy(peer_publ_key.x, p_cb->peer_publ_key.x, BT_OCTET32_LEN);
@@ -1115,16 +1115,16 @@
 
     memcpy(p_cb->dhkey, new_publ_key.x, BT_OCTET32_LEN);
 
-    smp_debug_print_nbyte_little_endian (p_cb->dhkey, (const UINT8 *)"Old DHKey",
+    smp_debug_print_nbyte_little_endian (p_cb->dhkey, (const uint8_t *)"Old DHKey",
                                          BT_OCTET32_LEN);
 
-    smp_debug_print_nbyte_little_endian (p_cb->private_key, (const UINT8 *)"private",
+    smp_debug_print_nbyte_little_endian (p_cb->private_key, (const uint8_t *)"private",
                                          BT_OCTET32_LEN);
-    smp_debug_print_nbyte_little_endian (p_cb->peer_publ_key.x, (const UINT8 *)"rem public(x)",
+    smp_debug_print_nbyte_little_endian (p_cb->peer_publ_key.x, (const uint8_t *)"rem public(x)",
                                          BT_OCTET32_LEN);
-    smp_debug_print_nbyte_little_endian (p_cb->peer_publ_key.y, (const UINT8 *)"rem public(y)",
+    smp_debug_print_nbyte_little_endian (p_cb->peer_publ_key.y, (const uint8_t *)"rem public(y)",
                                          BT_OCTET32_LEN);
-    smp_debug_print_nbyte_little_endian (p_cb->dhkey, (const UINT8 *)"Reverted DHKey",
+    smp_debug_print_nbyte_little_endian (p_cb->dhkey, (const uint8_t *)"Reverted DHKey",
                                          BT_OCTET32_LEN);
 }
 
@@ -1139,9 +1139,9 @@
 *******************************************************************************/
 void smp_calculate_local_commitment(tSMP_CB *p_cb)
 {
-    UINT8 random_input;
+    uint8_t random_input;
 
-    SMP_TRACE_DEBUG("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG("%s", __func__);
 
     switch (p_cb->selected_association_model)
     {
@@ -1185,9 +1185,9 @@
 *******************************************************************************/
 void smp_calculate_peer_commitment(tSMP_CB *p_cb, BT_OCTET16 output_buf)
 {
-    UINT8 ri;
+    uint8_t ri;
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG ("%s", __func__);
 
     switch (p_cb->selected_association_model)
     {
@@ -1238,50 +1238,50 @@
 **                  the AES-CMAC input/output stream.
 **
 *******************************************************************************/
-void smp_calculate_f4(UINT8 *u, UINT8 *v, UINT8 *x, UINT8 z, UINT8 *c)
+void smp_calculate_f4(uint8_t *u, uint8_t *v, uint8_t *x, uint8_t z, uint8_t *c)
 {
-    UINT8   msg_len = BT_OCTET32_LEN /* U size */ + BT_OCTET32_LEN /* V size */ + 1 /* Z size */;
-    UINT8   msg[BT_OCTET32_LEN + BT_OCTET32_LEN + 1];
-    UINT8   key[BT_OCTET16_LEN];
-    UINT8   cmac[BT_OCTET16_LEN];
-    UINT8   *p = NULL;
-#if SMP_DEBUG == TRUE
-    UINT8   *p_prnt = NULL;
+    uint8_t msg_len = BT_OCTET32_LEN /* U size */ + BT_OCTET32_LEN /* V size */ + 1 /* Z size */;
+    uint8_t msg[BT_OCTET32_LEN + BT_OCTET32_LEN + 1];
+    uint8_t key[BT_OCTET16_LEN];
+    uint8_t cmac[BT_OCTET16_LEN];
+    uint8_t *p = NULL;
+#if (SMP_DEBUG == TRUE)
+    uint8_t *p_prnt = NULL;
 #endif
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG ("%s", __func__);
 
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = u;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"U", BT_OCTET32_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"U", BT_OCTET32_LEN);
     p_prnt = v;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"V", BT_OCTET32_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"V", BT_OCTET32_LEN);
     p_prnt = x;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"X", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"X", BT_OCTET16_LEN);
     p_prnt = &z;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"Z", 1);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"Z", 1);
 #endif
 
     p = msg;
     UINT8_TO_STREAM(p, z);
     ARRAY_TO_STREAM(p, v, BT_OCTET32_LEN);
     ARRAY_TO_STREAM(p, u, BT_OCTET32_LEN);
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = msg;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"M", msg_len);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"M", msg_len);
 #endif
 
     p = key;
     ARRAY_TO_STREAM(p, x, BT_OCTET16_LEN);
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = key;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"K", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"K", BT_OCTET16_LEN);
 #endif
 
     aes_cipher_msg_auth_code(key, msg, msg_len, BT_OCTET16_LEN, cmac);
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = cmac;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"AES_CMAC", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"AES_CMAC", BT_OCTET16_LEN);
 #endif
 
     p = c;
@@ -1318,7 +1318,7 @@
 
     if (p_cb->number_to_display >= (BTM_MAX_PASSKEY_VAL + 1))
     {
-        UINT8 reason;
+        uint8_t reason;
         reason = p_cb->failure = SMP_PAIR_FAIL_UNKNOWN;
         smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
         return;
@@ -1353,67 +1353,67 @@
 **                  the AES-CMAC input/output stream.
 **
 *******************************************************************************/
-UINT32 smp_calculate_g2(UINT8 *u, UINT8 *v, UINT8 *x, UINT8 *y)
+uint32_t smp_calculate_g2(uint8_t *u, uint8_t *v, uint8_t *x, uint8_t *y)
 {
-    UINT8   msg_len = BT_OCTET32_LEN /* U size */ + BT_OCTET32_LEN /* V size */
+    uint8_t msg_len = BT_OCTET32_LEN /* U size */ + BT_OCTET32_LEN /* V size */
                       + BT_OCTET16_LEN /* Y size */;
-    UINT8   msg[BT_OCTET32_LEN + BT_OCTET32_LEN + BT_OCTET16_LEN];
-    UINT8   key[BT_OCTET16_LEN];
-    UINT8   cmac[BT_OCTET16_LEN];
-    UINT8   *p = NULL;
-    UINT32  vres;
-#if SMP_DEBUG == TRUE
-    UINT8   *p_prnt = NULL;
+    uint8_t msg[BT_OCTET32_LEN + BT_OCTET32_LEN + BT_OCTET16_LEN];
+    uint8_t key[BT_OCTET16_LEN];
+    uint8_t cmac[BT_OCTET16_LEN];
+    uint8_t *p = NULL;
+    uint32_t vres;
+#if (SMP_DEBUG == TRUE)
+    uint8_t *p_prnt = NULL;
 #endif
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG ("%s", __func__);
 
     p = msg;
     ARRAY_TO_STREAM(p, y, BT_OCTET16_LEN);
     ARRAY_TO_STREAM(p, v, BT_OCTET32_LEN);
     ARRAY_TO_STREAM(p, u, BT_OCTET32_LEN);
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = u;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"U", BT_OCTET32_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"U", BT_OCTET32_LEN);
     p_prnt = v;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"V", BT_OCTET32_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"V", BT_OCTET32_LEN);
     p_prnt = x;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"X", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"X", BT_OCTET16_LEN);
     p_prnt = y;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"Y", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"Y", BT_OCTET16_LEN);
 #endif
 
     p = key;
     ARRAY_TO_STREAM(p, x, BT_OCTET16_LEN);
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = key;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"K", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"K", BT_OCTET16_LEN);
 #endif
 
     if(!aes_cipher_msg_auth_code(key, msg, msg_len, BT_OCTET16_LEN, cmac))
     {
-        SMP_TRACE_ERROR("%s failed",__FUNCTION__);
+        SMP_TRACE_ERROR("%s failed",__func__);
         return (BTM_MAX_PASSKEY_VAL + 1);
     }
 
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = cmac;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"AES-CMAC", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"AES-CMAC", BT_OCTET16_LEN);
 #endif
 
     /* vres = cmac mod 2**32 mod 10**6 */
     p = &cmac[0];
     STREAM_TO_UINT32(vres, p);
-#if SMP_DEBUG == TRUE
-    p_prnt = (UINT8 *) &vres;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"cmac mod 2**32", 4);
+#if (SMP_DEBUG == TRUE)
+    p_prnt = (uint8_t *) &vres;
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"cmac mod 2**32", 4);
 #endif
 
     while (vres > BTM_MAX_PASSKEY_VAL)
         vres -= (BTM_MAX_PASSKEY_VAL + 1);
-#if SMP_DEBUG == TRUE
-    p_prnt = (UINT8 *) &vres;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"cmac mod 2**32 mod 10**6", 4);
+#if (SMP_DEBUG == TRUE)
+    p_prnt = (uint8_t *) &vres;
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"cmac mod 2**32 mod 10**6", 4);
 #endif
 
     SMP_TRACE_ERROR("Value for numeric comparison = %d", vres);
@@ -1469,19 +1469,19 @@
 **                          MacKey  is 128 bits;
 **                          LTK     is 128 bits
 **
-** Returns          FALSE if out of resources, TRUE in other cases.
+** Returns          false if out of resources, true in other cases.
 **
 ** Note             The LSB is the first octet, the MSB is the last octet of
 **                  the AES-CMAC input/output stream.
 **
 *******************************************************************************/
-BOOLEAN smp_calculate_f5(UINT8 *w, UINT8 *n1, UINT8 *n2, UINT8 *a1, UINT8 *a2,
-                         UINT8 *mac_key, UINT8 *ltk)
+bool    smp_calculate_f5(uint8_t *w, uint8_t *n1, uint8_t *n2, uint8_t *a1, uint8_t *a2,
+                         uint8_t *mac_key, uint8_t *ltk)
 {
     BT_OCTET16  t;    /* AES-CMAC output in smp_calculate_f5_key(...), key in */
                       /* smp_calculate_f5_mackey_or_long_term_key(...) */
-#if SMP_DEBUG == TRUE
-    UINT8   *p_prnt = NULL;
+#if (SMP_DEBUG == TRUE)
+    uint8_t *p_prnt = NULL;
 #endif
     /* internal parameters: */
 
@@ -1489,64 +1489,64 @@
         counter is 0 for MacKey,
                 is 1 for LTK
     */
-    UINT8   counter_mac_key[1]  = {0};
-    UINT8   counter_ltk[1]      = {1};
+    uint8_t counter_mac_key[1]  = {0};
+    uint8_t counter_ltk[1]      = {1};
     /*
         keyID   62746c65
     */
-    UINT8   key_id[4] = {0x65, 0x6c, 0x74, 0x62};
+    uint8_t key_id[4] = {0x65, 0x6c, 0x74, 0x62};
     /*
         length  0100
     */
-    UINT8   length[2] = {0x00, 0x01};
+    uint8_t length[2] = {0x00, 0x01};
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
-#if SMP_DEBUG == TRUE
+    SMP_TRACE_DEBUG ("%s", __func__);
+#if (SMP_DEBUG == TRUE)
     p_prnt = w;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"W", BT_OCTET32_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"W", BT_OCTET32_LEN);
     p_prnt = n1;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"N1", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"N1", BT_OCTET16_LEN);
     p_prnt = n2;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"N2", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"N2", BT_OCTET16_LEN);
     p_prnt = a1;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"A1", 7);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"A1", 7);
     p_prnt = a2;
-    smp_debug_print_nbyte_little_endian (p_prnt,(const UINT8 *) "A2", 7);
+    smp_debug_print_nbyte_little_endian (p_prnt,(const uint8_t *) "A2", 7);
 #endif
 
     if (!smp_calculate_f5_key(w, t))
     {
-        SMP_TRACE_ERROR("%s failed to calc T",__FUNCTION__);
-        return FALSE;
+        SMP_TRACE_ERROR("%s failed to calc T",__func__);
+        return false;
     }
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = t;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"T", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"T", BT_OCTET16_LEN);
 #endif
 
     if (!smp_calculate_f5_mackey_or_long_term_key(t, counter_mac_key, key_id, n1, n2, a1, a2,
                                                   length, mac_key))
     {
-        SMP_TRACE_ERROR("%s failed to calc MacKey", __FUNCTION__);
-        return FALSE;
+        SMP_TRACE_ERROR("%s failed to calc MacKey", __func__);
+        return false;
     }
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = mac_key;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"MacKey", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"MacKey", BT_OCTET16_LEN);
 #endif
 
     if (!smp_calculate_f5_mackey_or_long_term_key(t, counter_ltk, key_id, n1, n2, a1, a2,
                                                   length, ltk))
     {
-        SMP_TRACE_ERROR("%s failed to calc LTK",__FUNCTION__);
-        return FALSE;
+        SMP_TRACE_ERROR("%s failed to calc LTK",__func__);
+        return false;
     }
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = ltk;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"LTK", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"LTK", BT_OCTET16_LEN);
 #endif
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -1575,53 +1575,53 @@
 **                              Length  is 16 bits, its value is 0x0100
 **                  output:     LTK     is 128 bit.
 **
-** Returns          FALSE if out of resources, TRUE in other cases.
+** Returns          false if out of resources, true in other cases.
 **
 ** Note             The LSB is the first octet, the MSB is the last octet of
 **                  the AES-CMAC input/output stream.
 **
 *******************************************************************************/
-BOOLEAN smp_calculate_f5_mackey_or_long_term_key(UINT8 *t, UINT8 *counter,
-                                  UINT8 *key_id, UINT8 *n1, UINT8 *n2, UINT8 *a1, UINT8 *a2,
-                                  UINT8 *length, UINT8 *mac)
+bool    smp_calculate_f5_mackey_or_long_term_key(uint8_t *t, uint8_t *counter,
+                                  uint8_t *key_id, uint8_t *n1, uint8_t *n2, uint8_t *a1, uint8_t *a2,
+                                  uint8_t *length, uint8_t *mac)
 {
-    UINT8   *p = NULL;
-    UINT8   cmac[BT_OCTET16_LEN];
-    UINT8   key[BT_OCTET16_LEN];
-    UINT8   msg_len = 1 /* Counter size */ + 4 /* keyID size */ +
+    uint8_t *p = NULL;
+    uint8_t cmac[BT_OCTET16_LEN];
+    uint8_t key[BT_OCTET16_LEN];
+    uint8_t msg_len = 1 /* Counter size */ + 4 /* keyID size */ +
             BT_OCTET16_LEN /* N1 size */ + BT_OCTET16_LEN /* N2 size */ +
             7 /* A1 size*/ + 7 /* A2 size*/ + 2 /* Length size */;
-    UINT8   msg[1 + 4 + BT_OCTET16_LEN + BT_OCTET16_LEN + 7 + 7 + 2];
-    BOOLEAN ret = TRUE;
-#if SMP_DEBUG == TRUE
-    UINT8   *p_prnt = NULL;
+    uint8_t msg[1 + 4 + BT_OCTET16_LEN + BT_OCTET16_LEN + 7 + 7 + 2];
+    bool    ret = true;
+#if (SMP_DEBUG == TRUE)
+    uint8_t *p_prnt = NULL;
 #endif
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
-#if SMP_DEBUG == TRUE
+    SMP_TRACE_DEBUG ("%s", __func__);
+#if (SMP_DEBUG == TRUE)
     p_prnt = t;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"T", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"T", BT_OCTET16_LEN);
     p_prnt = counter;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"Counter", 1);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"Counter", 1);
     p_prnt = key_id;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"KeyID", 4);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"KeyID", 4);
     p_prnt = n1;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"N1", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"N1", BT_OCTET16_LEN);
     p_prnt = n2;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"N2", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"N2", BT_OCTET16_LEN);
     p_prnt = a1;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"A1", 7);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"A1", 7);
     p_prnt = a2;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"A2", 7);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"A2", 7);
     p_prnt = length;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"Length", 2);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"Length", 2);
 #endif
 
     p = key;
     ARRAY_TO_STREAM(p, t, BT_OCTET16_LEN);
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = key;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"K", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"K", BT_OCTET16_LEN);
 #endif
     p = msg;
     ARRAY_TO_STREAM(p, length, 2);
@@ -1631,20 +1631,20 @@
     ARRAY_TO_STREAM(p, n1, BT_OCTET16_LEN);
     ARRAY_TO_STREAM(p, key_id, 4);
     ARRAY_TO_STREAM(p, counter, 1);
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = msg;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"M", msg_len);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"M", msg_len);
 #endif
 
     if (!aes_cipher_msg_auth_code(key, msg, msg_len, BT_OCTET16_LEN, cmac))
     {
-        SMP_TRACE_ERROR("%s failed", __FUNCTION__);
-        ret = FALSE;
+        SMP_TRACE_ERROR("%s failed", __func__);
+        ret = false;
     }
 
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = cmac;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"AES-CMAC", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"AES-CMAC", BT_OCTET16_LEN);
 #endif
 
     p = mac;
@@ -1665,15 +1665,15 @@
 **                  input:      W       is 256 bit.
 **                  Output:     T       is 128 bit.
 **
-** Returns          FALSE if out of resources, TRUE in other cases.
+** Returns          false if out of resources, true in other cases.
 **
 ** Note             The LSB is the first octet, the MSB is the last octet of
 **                  the AES-CMAC input/output stream.
 **
 *******************************************************************************/
-BOOLEAN smp_calculate_f5_key(UINT8 *w, UINT8 *t)
+bool    smp_calculate_f5_key(uint8_t *w, uint8_t *t)
 {
-    UINT8 *p = NULL;
+    uint8_t *p = NULL;
     /* Please see 2.2.7 LE Secure Connections Key Generation Function f5 */
     /*
         salt:   6C88 8391 AAF5 A538 6037 0BDB 5A60 83BE
@@ -1682,16 +1682,16 @@
         0xBE, 0x83, 0x60, 0x5A, 0xDB, 0x0B, 0x37, 0x60,
         0x38, 0xA5, 0xF5, 0xAA, 0x91, 0x83, 0x88, 0x6C
     };
-#if SMP_DEBUG == TRUE
-    UINT8   *p_prnt = NULL;
+#if (SMP_DEBUG == TRUE)
+    uint8_t *p_prnt = NULL;
 #endif
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
-#if SMP_DEBUG == TRUE
+    SMP_TRACE_DEBUG ("%s", __func__);
+#if (SMP_DEBUG == TRUE)
     p_prnt = salt;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"salt", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"salt", BT_OCTET16_LEN);
     p_prnt = w;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"W", BT_OCTET32_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"W", BT_OCTET32_LEN);
 #endif
 
     BT_OCTET16 key;
@@ -1701,24 +1701,24 @@
     ARRAY_TO_STREAM(p, salt, BT_OCTET16_LEN);
     p = msg;
     ARRAY_TO_STREAM(p, w, BT_OCTET32_LEN);
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = key;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"K", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"K", BT_OCTET16_LEN);
     p_prnt = msg;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"M", BT_OCTET32_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"M", BT_OCTET32_LEN);
 #endif
 
     BT_OCTET16 cmac;
-    BOOLEAN ret = TRUE;
+    bool    ret = true;
     if (!aes_cipher_msg_auth_code(key, msg, BT_OCTET32_LEN, BT_OCTET16_LEN, cmac))
     {
-        SMP_TRACE_ERROR("%s failed", __FUNCTION__);
-        ret = FALSE;
+        SMP_TRACE_ERROR("%s failed", __func__);
+        ret = false;
     }
 
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_prnt = cmac;
-    smp_debug_print_nbyte_little_endian (p_prnt, (const UINT8 *)"AES-CMAC", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_prnt, (const uint8_t *)"AES-CMAC", BT_OCTET16_LEN);
 #endif
 
     p = t;
@@ -1741,9 +1741,9 @@
 *******************************************************************************/
 void smp_calculate_local_dhkey_check(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8   iocap[3], a[7], b[7];
+    uint8_t iocap[3], a[7], b[7];
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG ("%s", __func__);
 
     smp_calculate_f5_mackey_and_long_term_key(p_cb);
 
@@ -1768,13 +1768,13 @@
 *******************************************************************************/
 void smp_calculate_peer_dhkey_check(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
-    UINT8       iocap[3], a[7], b[7];
+    uint8_t     iocap[3], a[7], b[7];
     BT_OCTET16  param_buf;
-    BOOLEAN     ret;
+    bool        ret;
     tSMP_KEY    key;
     tSMP_STATUS status = SMP_PAIR_FAIL_UNKNOWN;
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG ("%s", __func__);
 
     smp_collect_peer_io_capabilities(iocap, p_cb);
 
@@ -1787,7 +1787,7 @@
     {
         SMP_TRACE_EVENT ("peer DHKey check calculation is completed");
 #if (SMP_DEBUG == TRUE)
-        smp_debug_print_nbyte_little_endian (param_buf, (const UINT8 *)"peer DHKey check",
+        smp_debug_print_nbyte_little_endian (param_buf, (const uint8_t *)"peer DHKey check",
                                              BT_OCTET16_LEN);
 #endif
         key.key_type = SMP_KEY_TYPE_PEER_DHK_CHCK;
@@ -1818,50 +1818,50 @@
 **                          A2 is 56 bit,
 **                  output: C is 128 bit.
 **
-** Returns          FALSE if out of resources, TRUE in other cases.
+** Returns          false if out of resources, true in other cases.
 **
 ** Note             The LSB is the first octet, the MSB is the last octet of
 **                  the AES-CMAC input/output stream.
 **
 *******************************************************************************/
-BOOLEAN smp_calculate_f6(UINT8 *w, UINT8 *n1, UINT8 *n2, UINT8 *r, UINT8 *iocap, UINT8 *a1,
-                         UINT8 *a2, UINT8 *c)
+bool    smp_calculate_f6(uint8_t *w, uint8_t *n1, uint8_t *n2, uint8_t *r, uint8_t *iocap, uint8_t *a1,
+                         uint8_t *a2, uint8_t *c)
 {
-    UINT8   *p = NULL;
-    UINT8   msg_len = BT_OCTET16_LEN /* N1 size */ + BT_OCTET16_LEN /* N2 size */ +
+    uint8_t *p = NULL;
+    uint8_t msg_len = BT_OCTET16_LEN /* N1 size */ + BT_OCTET16_LEN /* N2 size */ +
                       BT_OCTET16_LEN /* R size */ + 3 /* IOcap size */ + 7 /* A1 size*/
                       + 7 /* A2 size*/;
-    UINT8   msg[BT_OCTET16_LEN + BT_OCTET16_LEN + BT_OCTET16_LEN + 3 + 7 + 7];
-#if SMP_DEBUG == TRUE
-    UINT8   *p_print = NULL;
+    uint8_t msg[BT_OCTET16_LEN + BT_OCTET16_LEN + BT_OCTET16_LEN + 3 + 7 + 7];
+#if (SMP_DEBUG == TRUE)
+    uint8_t *p_print = NULL;
 #endif
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
-#if SMP_DEBUG == TRUE
+    SMP_TRACE_DEBUG ("%s", __func__);
+#if (SMP_DEBUG == TRUE)
     p_print = w;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"W", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"W", BT_OCTET16_LEN);
     p_print = n1;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"N1", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"N1", BT_OCTET16_LEN);
     p_print = n2;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"N2", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"N2", BT_OCTET16_LEN);
     p_print = r;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"R", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"R", BT_OCTET16_LEN);
     p_print = iocap;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"IOcap", 3);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"IOcap", 3);
     p_print = a1;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"A1", 7);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"A1", 7);
     p_print = a2;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"A2", 7);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"A2", 7);
 #endif
 
-    UINT8 cmac[BT_OCTET16_LEN];
-    UINT8 key[BT_OCTET16_LEN];
+    uint8_t cmac[BT_OCTET16_LEN];
+    uint8_t key[BT_OCTET16_LEN];
 
     p = key;
     ARRAY_TO_STREAM(p, w, BT_OCTET16_LEN);
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_print = key;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"K", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"K", BT_OCTET16_LEN);
 #endif
 
     p = msg;
@@ -1871,21 +1871,21 @@
     ARRAY_TO_STREAM(p, r, BT_OCTET16_LEN);
     ARRAY_TO_STREAM(p, n2, BT_OCTET16_LEN);
     ARRAY_TO_STREAM(p, n1, BT_OCTET16_LEN);
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_print = msg;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"M", msg_len);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"M", msg_len);
 #endif
 
-    BOOLEAN ret = TRUE;
+    bool    ret = true;
     if(!aes_cipher_msg_auth_code(key, msg, msg_len, BT_OCTET16_LEN, cmac))
     {
-        SMP_TRACE_ERROR("%s failed", __FUNCTION__);
-        ret = FALSE;
+        SMP_TRACE_ERROR("%s failed", __func__);
+        ret = false;
     }
 
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_print = cmac;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"AES-CMAC", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"AES-CMAC", BT_OCTET16_LEN);
 #endif
 
     p = c;
@@ -1900,10 +1900,10 @@
 ** Description      The function calculates and saves BR/EDR link key derived from
 **                  LE SC LTK.
 **
-** Returns          FALSE if out of resources, TRUE in other cases.
+** Returns          false if out of resources, true in other cases.
 **
 *******************************************************************************/
-BOOLEAN smp_calculate_link_key_from_long_term_key(tSMP_CB *p_cb)
+bool    smp_calculate_link_key_from_long_term_key(tSMP_CB *p_cb)
 {
     tBTM_SEC_DEV_REC *p_dev_rec;
     BD_ADDR bda_for_lk;
@@ -1924,19 +1924,19 @@
     else
     {
         SMP_TRACE_WARNING ("Don't have peer public address to associate with LK");
-        return FALSE;
+        return false;
     }
 
     if ((p_dev_rec = btm_find_dev (p_cb->pairing_bda)) == NULL)
     {
         SMP_TRACE_ERROR("%s failed to find Security Record", __func__);
-        return FALSE;
+        return false;
     }
 
     BT_OCTET16 intermediate_link_key;
-    BOOLEAN ret = TRUE;
+    bool    ret = true;
 
-    ret = smp_calculate_h6(p_cb->ltk, (UINT8 *)"1pmt" /* reversed "tmp1" */,intermediate_link_key);
+    ret = smp_calculate_h6(p_cb->ltk, (uint8_t *)"1pmt" /* reversed "tmp1" */,intermediate_link_key);
     if (!ret)
     {
         SMP_TRACE_ERROR("%s failed to derive intermediate_link_key", __func__);
@@ -1944,14 +1944,14 @@
     }
 
     BT_OCTET16 link_key;
-    ret = smp_calculate_h6(intermediate_link_key, (UINT8 *) "rbel" /* reversed "lebr" */, link_key);
+    ret = smp_calculate_h6(intermediate_link_key, (uint8_t *) "rbel" /* reversed "lebr" */, link_key);
     if (!ret)
     {
         SMP_TRACE_ERROR("%s failed", __func__);
     }
     else
     {
-        UINT8 link_key_type;
+        uint8_t link_key_type;
         if (btm_cb.security_mode == BTM_SEC_MODE_SC)
         {
             /* Secure Connections Only Mode */
@@ -1977,12 +1977,12 @@
         {
             SMP_TRACE_ERROR ("%s failed to update link_key. Sec Mode = %d, sm4 = 0x%02x",
                  __func__, btm_cb.security_mode, p_dev_rec->sm4);
-            return FALSE;
+            return false;
         }
 
         link_key_type += BTM_LTK_DERIVED_LKEY_OFFSET;
 
-        UINT8 *p;
+        uint8_t *p;
         BT_OCTET16 notif_link_key;
         p = notif_link_key;
         ARRAY16_TO_STREAM(p, link_key);
@@ -2002,69 +2002,69 @@
 ** Description      The function calculates and saves SC LTK derived from BR/EDR
 **                  link key.
 **
-** Returns          FALSE if out of resources, TRUE in other cases.
+** Returns          false if out of resources, true in other cases.
 **
 *******************************************************************************/
-BOOLEAN smp_calculate_long_term_key_from_link_key(tSMP_CB *p_cb)
+bool    smp_calculate_long_term_key_from_link_key(tSMP_CB *p_cb)
 {
-    BOOLEAN ret = TRUE;
+    bool    ret = true;
     tBTM_SEC_DEV_REC *p_dev_rec;
-    UINT8 rev_link_key[16];
+    uint8_t rev_link_key[16];
 
-    SMP_TRACE_DEBUG ("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG ("%s", __func__);
 
     if ((p_dev_rec = btm_find_dev (p_cb->pairing_bda)) == NULL)
     {
-        SMP_TRACE_ERROR("%s failed to find Security Record",__FUNCTION__);
-        return FALSE;
+        SMP_TRACE_ERROR("%s failed to find Security Record",__func__);
+        return false;
     }
 
-    UINT8 br_link_key_type;
+    uint8_t br_link_key_type;
     if ((br_link_key_type = BTM_SecGetDeviceLinkKeyType (p_cb->pairing_bda))
         == BTM_LKEY_TYPE_IGNORE)
     {
-        SMP_TRACE_ERROR("%s failed to retrieve BR link type",__FUNCTION__);
-        return FALSE;
+        SMP_TRACE_ERROR("%s failed to retrieve BR link type",__func__);
+        return false;
     }
 
     if ((br_link_key_type != BTM_LKEY_TYPE_AUTH_COMB_P_256) &&
         (br_link_key_type != BTM_LKEY_TYPE_UNAUTH_COMB_P_256))
     {
         SMP_TRACE_ERROR("%s LE SC LTK can't be derived from LK %d",
-                         __FUNCTION__, br_link_key_type);
-        return FALSE;
+                         __func__, br_link_key_type);
+        return false;
     }
 
-    UINT8 *p1;
-    UINT8 *p2;
+    uint8_t *p1;
+    uint8_t *p2;
     p1 = rev_link_key;
     p2 = p_dev_rec->link_key;
     REVERSE_ARRAY_TO_STREAM(p1, p2, 16);
 
     BT_OCTET16 intermediate_long_term_key;
     /* "tmp2" obtained from the spec */
-    ret = smp_calculate_h6(rev_link_key, (UINT8 *) "2pmt" /* reversed "tmp2" */,
+    ret = smp_calculate_h6(rev_link_key, (uint8_t *) "2pmt" /* reversed "tmp2" */,
                            intermediate_long_term_key);
 
     if (!ret)
     {
-        SMP_TRACE_ERROR("%s failed to derive intermediate_long_term_key",__FUNCTION__);
+        SMP_TRACE_ERROR("%s failed to derive intermediate_long_term_key",__func__);
         return ret;
     }
 
     /* "brle" obtained from the spec */
-    ret = smp_calculate_h6(intermediate_long_term_key, (UINT8 *) "elrb" /* reversed "brle" */,
+    ret = smp_calculate_h6(intermediate_long_term_key, (uint8_t *) "elrb" /* reversed "brle" */,
                            p_cb->ltk);
 
     if (!ret)
     {
-        SMP_TRACE_ERROR("%s failed",__FUNCTION__);
+        SMP_TRACE_ERROR("%s failed",__func__);
     }
     else
     {
         p_cb->sec_level = (br_link_key_type == BTM_LKEY_TYPE_AUTH_COMB_P_256)
                            ? SMP_SEC_AUTHENTICATED : SMP_SEC_UNAUTHENTICATE;
-        SMP_TRACE_EVENT ("%s is completed",__FUNCTION__);
+        SMP_TRACE_EVENT ("%s is completed",__func__);
     }
 
     return ret;
@@ -2082,59 +2082,59 @@
 **                          KeyId is 32 bit,
 **                  output: C is 128 bit.
 **
-** Returns          FALSE if out of resources, TRUE in other cases.
+** Returns          false if out of resources, true in other cases.
 **
 ** Note             The LSB is the first octet, the MSB is the last octet of
 **                  the AES-CMAC input/output stream.
 **
 *******************************************************************************/
-BOOLEAN smp_calculate_h6(UINT8 *w, UINT8 *keyid, UINT8 *c)
+bool    smp_calculate_h6(uint8_t *w, uint8_t *keyid, uint8_t *c)
 {
-#if SMP_DEBUG == TRUE
-    UINT8   *p_print = NULL;
+#if (SMP_DEBUG == TRUE)
+    uint8_t *p_print = NULL;
 #endif
 
-    SMP_TRACE_DEBUG ("%s",__FUNCTION__);
-#if SMP_DEBUG == TRUE
+    SMP_TRACE_DEBUG ("%s",__func__);
+#if (SMP_DEBUG == TRUE)
     p_print = w;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"W", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"W", BT_OCTET16_LEN);
     p_print = keyid;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"keyID", 4);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"keyID", 4);
 #endif
 
-    UINT8 *p = NULL;
-    UINT8 key[BT_OCTET16_LEN];
+    uint8_t *p = NULL;
+    uint8_t key[BT_OCTET16_LEN];
 
     p = key;
     ARRAY_TO_STREAM(p, w, BT_OCTET16_LEN);
 
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_print = key;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"K", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"K", BT_OCTET16_LEN);
 #endif
 
-    UINT8 msg_len = 4 /* KeyID size */;
-    UINT8 msg[4];
+    uint8_t msg_len = 4 /* KeyID size */;
+    uint8_t msg[4];
 
     p = msg;
     ARRAY_TO_STREAM(p, keyid, 4);
 
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_print = msg;
-    smp_debug_print_nbyte_little_endian (p_print,(const UINT8 *) "M", msg_len);
+    smp_debug_print_nbyte_little_endian (p_print,(const uint8_t *) "M", msg_len);
 #endif
 
-    BOOLEAN ret = TRUE;
-    UINT8 cmac[BT_OCTET16_LEN];
+    bool    ret = true;
+    uint8_t cmac[BT_OCTET16_LEN];
     if (!aes_cipher_msg_auth_code(key, msg, msg_len, BT_OCTET16_LEN, cmac))
     {
-        SMP_TRACE_ERROR("%s failed",__FUNCTION__);
-        ret = FALSE;
+        SMP_TRACE_ERROR("%s failed",__func__);
+        ret = false;
     }
 
-#if SMP_DEBUG == TRUE
+#if (SMP_DEBUG == TRUE)
     p_print = cmac;
-    smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"AES-CMAC", BT_OCTET16_LEN);
+    smp_debug_print_nbyte_little_endian (p_print, (const uint8_t *)"AES-CMAC", BT_OCTET16_LEN);
 #endif
 
     p = c;
@@ -2153,7 +2153,7 @@
 *******************************************************************************/
 void smp_start_nonce_generation(tSMP_CB *p_cb)
 {
-    SMP_TRACE_DEBUG("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG("%s", __func__);
     p_cb->rand_enc_proc_state = SMP_GEN_NONCE_0_7;
     if (!btsnd_hcic_ble_rand((void *)smp_rand_back))
         smp_rand_back(NULL);
@@ -2170,7 +2170,7 @@
 *******************************************************************************/
 void smp_finish_nonce_generation(tSMP_CB *p_cb)
 {
-    SMP_TRACE_DEBUG("%s", __FUNCTION__);
+    SMP_TRACE_DEBUG("%s", __func__);
     p_cb->rand_enc_proc_state = SMP_GEN_NONCE_8_15;
     if (!btsnd_hcic_ble_rand((void *)smp_rand_back))
         smp_rand_back(NULL);
@@ -2187,7 +2187,7 @@
 *******************************************************************************/
 void smp_process_new_nonce(tSMP_CB *p_cb)
 {
-    SMP_TRACE_DEBUG ("%s round %d", __FUNCTION__, p_cb->round);
+    SMP_TRACE_DEBUG ("%s round %d", __func__, p_cb->round);
     smp_sm_event(p_cb, SMP_HAVE_LOC_NONCE_EVT, NULL);
 }
 
@@ -2204,11 +2204,11 @@
 static void smp_rand_back(tBTM_RAND_ENC *p)
 {
     tSMP_CB *p_cb = &smp_cb;
-    UINT8   *pp = p->param_buf;
-    UINT8   failure = SMP_PAIR_FAIL_UNKNOWN;
-    UINT8   state = p_cb->rand_enc_proc_state & ~0x80;
+    uint8_t *pp = p->param_buf;
+    uint8_t failure = SMP_PAIR_FAIL_UNKNOWN;
+    uint8_t state = p_cb->rand_enc_proc_state & ~0x80;
 
-    SMP_TRACE_DEBUG ("%s state=0x%x", __FUNCTION__, state);
+    SMP_TRACE_DEBUG ("%s state=0x%x", __func__, state);
     if (p && p->status == HCI_SUCCESS)
     {
         switch (state)
@@ -2263,7 +2263,7 @@
         return;
     }
 
-    SMP_TRACE_ERROR("%s key generation failed: (%d)", __FUNCTION__, p_cb->rand_enc_proc_state);
+    SMP_TRACE_ERROR("%s key generation failed: (%d)", __func__, p_cb->rand_enc_proc_state);
     smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure);
 }
 
diff --git a/stack/smp/smp_l2c.c b/stack/smp/smp_l2c.c
index d401136..a7a8e6d 100644
--- a/stack/smp/smp_l2c.c
+++ b/stack/smp/smp_l2c.c
@@ -24,7 +24,7 @@
 
 #include "bt_target.h"
 
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
 
 #include <string.h>
 #include "btm_ble_api.h"
@@ -35,15 +35,15 @@
 
 extern fixed_queue_t *btu_general_alarm_queue;
 
-static void smp_tx_complete_callback(UINT16 cid, UINT16 num_pkt);
+static void smp_tx_complete_callback(uint16_t cid, uint16_t num_pkt);
 
-static void smp_connect_callback(UINT16 channel, BD_ADDR bd_addr, BOOLEAN connected, UINT16 reason,
+static void smp_connect_callback(uint16_t channel, BD_ADDR bd_addr, bool    connected, uint16_t reason,
                                tBT_TRANSPORT transport);
-static void smp_data_received(UINT16 channel, BD_ADDR bd_addr, BT_HDR *p_buf);
+static void smp_data_received(uint16_t channel, BD_ADDR bd_addr, BT_HDR *p_buf);
 
-static void smp_br_connect_callback(UINT16 channel, BD_ADDR bd_addr, BOOLEAN connected, UINT16 reason,
+static void smp_br_connect_callback(uint16_t channel, BD_ADDR bd_addr, bool    connected, uint16_t reason,
                                     tBT_TRANSPORT transport);
-static void smp_br_data_received(UINT16 channel, BD_ADDR bd_addr, BT_HDR *p_buf);
+static void smp_br_data_received(uint16_t channel, BD_ADDR bd_addr, BT_HDR *p_buf);
 
 /*******************************************************************************
 **
@@ -85,17 +85,17 @@
 **
 ** Description      This callback function is called by L2CAP to indicate that
 **                  SMP channel is
-**                      connected (conn = TRUE)/disconnected (conn = FALSE).
+**                      connected (conn = true)/disconnected (conn = false).
 **
 *******************************************************************************/
-static void smp_connect_callback (UINT16 channel, BD_ADDR bd_addr, BOOLEAN connected, UINT16 reason,
+static void smp_connect_callback (uint16_t channel, BD_ADDR bd_addr, bool    connected, uint16_t reason,
                                   tBT_TRANSPORT transport)
 {
     tSMP_CB   *p_cb = &smp_cb;
     tSMP_INT_DATA   int_data;
     BD_ADDR dummy_bda = {0};
 
-    SMP_TRACE_EVENT ("SMDBG l2c %s", __FUNCTION__);
+    SMP_TRACE_EVENT ("SMDBG l2c %s", __func__);
 
     if (transport == BT_TRANSPORT_BR_EDR || memcmp(bd_addr, dummy_bda, BD_ADDR_LEN) == 0)
         return;
@@ -103,7 +103,7 @@
     if (memcmp(bd_addr, p_cb->pairing_bda, BD_ADDR_LEN) == 0)
     {
         SMP_TRACE_EVENT ("%s()  for pairing BDA: %08x%04x  Event: %s",
-                        __FUNCTION__,
+                        __func__,
                         (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8) + bd_addr[3],
                         (bd_addr[4]<<8)+bd_addr[5],
                         (connected) ? "connected" : "disconnected");
@@ -112,7 +112,7 @@
         {
             if(!p_cb->connect_initialized)
             {
-                p_cb->connect_initialized = TRUE;
+                p_cb->connect_initialized = true;
                 /* initiating connection established */
                 p_cb->role = L2CA_GetBleConnRole(bd_addr);
 
@@ -143,12 +143,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void smp_data_received(UINT16 channel, BD_ADDR bd_addr, BT_HDR *p_buf)
+static void smp_data_received(uint16_t channel, BD_ADDR bd_addr, BT_HDR *p_buf)
 {
     tSMP_CB *p_cb = &smp_cb;
-    UINT8   *p = (UINT8 *)(p_buf + 1) + p_buf->offset;
-    UINT8   cmd ;
-    SMP_TRACE_EVENT ("SMDBG l2c %s", __FUNCTION__);
+    uint8_t *p = (uint8_t *)(p_buf + 1) + p_buf->offset;
+    uint8_t cmd ;
+    SMP_TRACE_EVENT ("SMDBG l2c %s", __func__);
 
     STREAM_TO_UINT8(cmd, p);
 
@@ -188,7 +188,7 @@
         {
             SMP_TRACE_DEBUG ("in %s cmd = 0x%02x, peer_auth_req = 0x%02x,"
                               "loc_auth_req = 0x%02x",
-                              __FUNCTION__, cmd, p_cb->peer_auth_req, p_cb->loc_auth_req);
+                              __func__, cmd, p_cb->peer_auth_req, p_cb->loc_auth_req);
 
             if ((p_cb->peer_auth_req  & SMP_SC_SUPPORT_BIT) &&
                 (p_cb->loc_auth_req & SMP_SC_SUPPORT_BIT))
@@ -198,7 +198,7 @@
         }
 
         p_cb->rcvd_cmd_code = cmd;
-        p_cb->rcvd_cmd_len = (UINT8) p_buf->len;
+        p_cb->rcvd_cmd_len = (uint8_t) p_buf->len;
         smp_sm_event(p_cb, cmd, p);
     }
 
@@ -212,7 +212,7 @@
 ** Description      SMP channel tx complete callback
 **
 *******************************************************************************/
-static void smp_tx_complete_callback (UINT16 cid, UINT16 num_pkt)
+static void smp_tx_complete_callback (uint16_t cid, uint16_t num_pkt)
 {
     tSMP_CB *p_cb = &smp_cb;
 
@@ -221,7 +221,7 @@
     else
         SMP_TRACE_ERROR("Unexpected %s: num_pkt = %d", __func__,num_pkt);
 
-    UINT8 reason = SMP_SUCCESS;
+    uint8_t reason = SMP_SUCCESS;
     if (p_cb->total_tx_unacked == 0 && p_cb->wait_for_authorization_complete)
     {
         if (cid == L2CAP_SMP_CID)
@@ -237,11 +237,11 @@
 **
 ** Description      This callback function is called by L2CAP to indicate that
 **                  SMP BR channel is
-**                      connected (conn = TRUE)/disconnected (conn = FALSE).
+**                      connected (conn = true)/disconnected (conn = false).
 **
 *******************************************************************************/
-static void smp_br_connect_callback(UINT16 channel, BD_ADDR bd_addr, BOOLEAN connected,
-                                    UINT16 reason, tBT_TRANSPORT transport)
+static void smp_br_connect_callback(uint16_t channel, BD_ADDR bd_addr, bool    connected,
+                                    uint16_t reason, tBT_TRANSPORT transport)
 {
     tSMP_CB *p_cb = &smp_cb;
     tSMP_INT_DATA int_data;
@@ -268,7 +268,7 @@
     {
         if(!p_cb->connect_initialized)
         {
-            p_cb->connect_initialized = TRUE;
+            p_cb->connect_initialized = true;
             /* initialize local i/r key to be default keys */
             p_cb->local_r_key = p_cb->local_i_key =  SMP_BR_SEC_DEFAULT_KEY;
             p_cb->loc_auth_req = p_cb->peer_auth_req = 0;
@@ -294,11 +294,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void smp_br_data_received(UINT16 channel, BD_ADDR bd_addr, BT_HDR *p_buf)
+static void smp_br_data_received(uint16_t channel, BD_ADDR bd_addr, BT_HDR *p_buf)
 {
     tSMP_CB *p_cb = &smp_cb;
-    UINT8   *p = (UINT8 *)(p_buf + 1) + p_buf->offset;
-    UINT8   cmd ;
+    uint8_t *p = (uint8_t *)(p_buf + 1) + p_buf->offset;
+    uint8_t cmd ;
     SMP_TRACE_EVENT ("SMDBG l2c %s", __func__);
 
     STREAM_TO_UINT8(cmd, p);
@@ -317,7 +317,7 @@
         if ((p_cb->state == SMP_STATE_IDLE) && (p_cb->br_state == SMP_BR_STATE_IDLE))
         {
             p_cb->role = HCI_ROLE_SLAVE;
-            p_cb->smp_over_br = TRUE;
+            p_cb->smp_over_br = true;
             memcpy(&p_cb->pairing_bda[0], bd_addr, BD_ADDR_LEN);
         }
         else if (memcmp(&bd_addr[0], p_cb->pairing_bda, BD_ADDR_LEN))
@@ -336,7 +336,7 @@
                            btu_general_alarm_queue);
 
         p_cb->rcvd_cmd_code = cmd;
-        p_cb->rcvd_cmd_len = (UINT8) p_buf->len;
+        p_cb->rcvd_cmd_len = (uint8_t) p_buf->len;
         smp_br_state_machine_event(p_cb, cmd, p);
     }
 
diff --git a/stack/smp/smp_main.c b/stack/smp/smp_main.c
index c3709f8..67818b8 100644
--- a/stack/smp/smp_main.c
+++ b/stack/smp/smp_main.c
@@ -18,7 +18,7 @@
 
 #include "bt_target.h"
 
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
 
 #include <string.h>
 #include "smp_int.h"
@@ -98,7 +98,7 @@
 #define SMP_SME_NEXT_STATE  2
 #define SMP_SM_NUM_COLS     3
 
-typedef const UINT8(*tSMP_SM_TBL)[SMP_SM_NUM_COLS];
+typedef const uint8_t (*tSMP_SM_TBL)[SMP_SM_NUM_COLS];
 
 enum
 {
@@ -232,7 +232,7 @@
 };
 
 /************ SMP Master FSM State/Event Indirection Table **************/
-static const UINT8 smp_master_entry_map[][SMP_STATE_MAX] =
+static const uint8_t smp_master_entry_map[][SMP_STATE_MAX] =
 {
 /* state name:             Idle WaitApp SecReq Pair   Wait Confirm Rand PublKey SCPhs1  Wait  Wait  SCPhs2  Wait   DHKChk Enc   Bond  CrLocSc
                                  Rsp    Pend   ReqRsp Cfm               Exch    Strt    Cmtm  Nonce Strt    DHKChk        Pend  Pend  OobData   */
@@ -278,7 +278,7 @@
 /* CR_LOC_SC_OOB_DATA   */{ 5,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
 };
 
-static const UINT8 smp_all_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_all_table[][SMP_SM_NUM_COLS] =
 {
 /*                       Event                     Action                 Next State */
 /* PAIR_FAIL */          {SMP_PROC_PAIR_FAIL,      SMP_PAIRING_CMPL, SMP_STATE_IDLE},
@@ -286,7 +286,7 @@
 /* L2C_DISC  */          {SMP_PAIR_TERMINATE,      SMP_SM_NO_ACTION, SMP_STATE_IDLE}
 };
 
-static const UINT8 smp_master_idle_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_idle_table[][SMP_SM_NUM_COLS] =
 {
 /*                   Event                  Action               Next State */
 /* L2C_CONN */      {SMP_SEND_APP_CBACK,     SMP_SM_NO_ACTION,   SMP_STATE_WAIT_APP_RSP},
@@ -297,7 +297,7 @@
 
 };
 
-static const UINT8 smp_master_wait_for_app_response_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_wait_for_app_response_table[][SMP_SM_NUM_COLS] =
 {
 /*                            Event                Action               Next State */
 /* SEC_GRANT            */ {SMP_PROC_SEC_GRANT, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
@@ -318,7 +318,7 @@
 /* SC_OOB_DATA      */ { SMP_USE_OOB_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH}
 };
 
-static const UINT8 smp_master_pair_request_response_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_pair_request_response_table[][SMP_SM_NUM_COLS] =
 {
 /*               Event                  Action                  Next State */
 /* PAIR_RSP */ { SMP_PROC_PAIR_CMD,     SMP_SM_NO_ACTION, SMP_STATE_PAIR_REQ_RSP},
@@ -329,19 +329,19 @@
 /* PUBL_KEY_EXCH_REQ    */,{ SMP_CREATE_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH}
 };
 
-static const UINT8 smp_master_wait_for_confirm_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_wait_for_confirm_table[][SMP_SM_NUM_COLS] =
 {
 /*              Event                   Action          Next State */
 /* KEY_READY*/ {SMP_SEND_CONFIRM,     SMP_SM_NO_ACTION, SMP_STATE_CONFIRM}/* CONFIRM ready */
 };
 
-static const UINT8 smp_master_confirm_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_confirm_table[][SMP_SM_NUM_COLS] =
 {
 /*               Event                  Action                 Next State */
 /* CONFIRM  */ { SMP_PROC_CONFIRM, SMP_SEND_RAND, SMP_STATE_RAND}
 };
 
-static const UINT8 smp_master_rand_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_rand_table[][SMP_SM_NUM_COLS] =
 {
 /*               Event                  Action                   Next State */
 /* RAND     */ { SMP_PROC_RAND,         SMP_GENERATE_COMPARE, SMP_STATE_RAND},
@@ -349,7 +349,7 @@
 /* ENC_REQ  */ { SMP_GENERATE_STK,      SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING}
 };
 
-static const UINT8 smp_master_public_key_exchange_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_public_key_exchange_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                        Action              Next State */
 /* LOC_PUBL_KEY_CRTD    */{ SMP_SEND_PAIR_PUBLIC_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
@@ -357,7 +357,7 @@
 /* BOTH_PUBL_KEYS_RCVD  */{ SMP_HAVE_BOTH_PUBLIC_KEYS, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
 };
 
-static const UINT8 smp_master_sec_conn_phs1_start_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_sec_conn_phs1_start_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                Next State */
 /* SC_DHKEY_CMPLT       */{ SMP_START_SEC_CONN_PHASE1, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
@@ -370,14 +370,14 @@
 /* PAIR_COMMITM  */{ SMP_PROCESS_PAIRING_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
 };
 
-static const UINT8 smp_master_wait_commitment_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_wait_commitment_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* PAIR_COMMITM         */{ SMP_PROCESS_PAIRING_COMMITMENT, SMP_SEND_RAND, SMP_STATE_WAIT_NONCE},
 /* PAIR_KEYPR_NOTIF */{ SMP_PROCESS_KEYPRESS_NOTIFICATION, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_COMMITMENT},
 };
 
-static const UINT8 smp_master_wait_nonce_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_wait_nonce_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* peer nonce is received */
@@ -388,19 +388,19 @@
 /* SC_DSPL_NC           */{SMP_SEND_APP_CBACK, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
 };
 
-static const UINT8 smp_master_sec_conn_phs2_start_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_sec_conn_phs2_start_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* SC_PHASE1_CMPLT */{SMP_CALCULATE_LOCAL_DHKEY_CHECK, SMP_SEND_DHKEY_CHECK, SMP_STATE_WAIT_DHK_CHECK},
 };
 
-static const UINT8 smp_master_wait_dhk_check_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_wait_dhk_check_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* PAIR_DHKEY_CHCK  */{SMP_PROCESS_DHKEY_CHECK, SMP_CALCULATE_PEER_DHKEY_CHECK, SMP_STATE_DHK_CHECK},
 };
 
-static const UINT8 smp_master_dhk_check_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_dhk_check_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* locally calculated peer dhkey check is ready -> compare it withs DHKey Check actually received from peer */
@@ -410,7 +410,7 @@
 /* ENC_REQ              */{SMP_GENERATE_STK, SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
 };
 
-static const UINT8 smp_master_enc_pending_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_enc_pending_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* STK ready */
@@ -418,7 +418,7 @@
 /* ENCRYPTED */ { SMP_CHECK_AUTH_REQ,   SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
 /* BOND_REQ  */ { SMP_KEY_DISTRIBUTE,   SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING}
 };
-static const UINT8 smp_master_bond_pending_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_bond_pending_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* ENC_INFO */ { SMP_PROC_ENC_INFO,     SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
@@ -429,7 +429,7 @@
 /* KEY_READY */{SMP_SEND_ENC_INFO,      SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING} /* LTK ready */
 };
 
-static const UINT8 smp_master_create_local_sec_conn_oob_data[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_master_create_local_sec_conn_oob_data[][SMP_SM_NUM_COLS] =
 {
 /*                       Event                   Action            Next State */
 /* LOC_PUBL_KEY_CRTD */ {SMP_SET_LOCAL_OOB_KEYS,   SMP_SM_NO_ACTION, SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA},
@@ -438,7 +438,7 @@
 
 
 /************ SMP Slave FSM State/Event Indirection Table **************/
-static const UINT8 smp_slave_entry_map[][SMP_STATE_MAX] =
+static const uint8_t smp_slave_entry_map[][SMP_STATE_MAX] =
 {
 /* state name:             Idle WaitApp SecReq Pair   Wait Confirm Rand PublKey SCPhs1  Wait  Wait  SCPhs2  Wait   DHKChk Enc   Bond  CrLocSc
                                  Rsp    Pend   ReqRsp Cfm               Exch    Strt    Cmtm  Nonce Strt    DHKChk        Pend  Pend  OobData   */
@@ -484,7 +484,7 @@
 /* CR_LOC_SC_OOB_DATA   */{ 3,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
 };
 
-static const UINT8 smp_slave_idle_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_idle_table[][SMP_SM_NUM_COLS] =
 {
 /*                   Event                 Action                Next State */
 /* L2C_CONN */      {SMP_SEND_APP_CBACK,  SMP_SM_NO_ACTION,      SMP_STATE_WAIT_APP_RSP},
@@ -492,7 +492,7 @@
 /* CR_LOC_SC_OOB_DATA   */ ,{SMP_CREATE_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA}
 };
 
-static const UINT8 smp_slave_wait_for_app_response_table [][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_wait_for_app_response_table [][SMP_SM_NUM_COLS] =
 {
 /*               Event                   Action                 Next State */
 /* IO_RSP    */ {SMP_PROC_IO_RSP,       SMP_FAST_CONN_PARAM, SMP_STATE_PAIR_REQ_RSP},
@@ -513,14 +513,14 @@
 /* SC_OOB_DATA          */ {SMP_SEND_PAIR_RSP,    SMP_SM_NO_ACTION,    SMP_STATE_PAIR_REQ_RSP},
 };
 
-static const UINT8 smp_slave_sec_request_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_sec_request_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* PAIR_REQ */{SMP_PROC_PAIR_CMD,       SMP_SM_NO_ACTION,       SMP_STATE_PAIR_REQ_RSP},
 /* ENCRYPTED*/{SMP_ENC_CMPL,            SMP_SM_NO_ACTION,       SMP_STATE_PAIR_REQ_RSP},
 };
 
-static const UINT8 smp_slave_pair_request_response_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_pair_request_response_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* CONFIRM  */ {SMP_PROC_CONFIRM,       SMP_SM_NO_ACTION,   SMP_STATE_CONFIRM},
@@ -532,14 +532,14 @@
 /* PAIR_PUBLIC_KEY      */ { SMP_PROCESS_PAIR_PUBLIC_KEY, SMP_SM_NO_ACTION,   SMP_STATE_PAIR_REQ_RSP},
 };
 
-static const UINT8 smp_slave_wait_confirm_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_wait_confirm_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* CONFIRM  */ {SMP_PROC_CONFIRM,       SMP_SEND_CONFIRM,   SMP_STATE_CONFIRM},
 /* KEY_READY*/ {SMP_PROC_SL_KEY,        SMP_SM_NO_ACTION,   SMP_STATE_WAIT_CONFIRM}
 };
 
-static const UINT8 smp_slave_confirm_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_confirm_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* RAND     */ {SMP_PROC_RAND,          SMP_GENERATE_COMPARE,   SMP_STATE_RAND},
@@ -548,14 +548,14 @@
 /* KEY_READY*/ {SMP_PROC_SL_KEY,        SMP_SM_NO_ACTION,       SMP_STATE_CONFIRM}
 };
 
-static const UINT8 smp_slave_rand_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_rand_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* KEY_READY */ {SMP_PROC_COMPARE,      SMP_SM_NO_ACTION,   SMP_STATE_RAND}, /* compare match */
 /* RAND      */ {SMP_SEND_RAND,         SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING}
 };
 
-static const UINT8 smp_slave_public_key_exch_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_public_key_exch_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* LOC_PUBL_KEY_CRTD  */{ SMP_WAIT_FOR_BOTH_PUBLIC_KEYS, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
@@ -563,7 +563,7 @@
 /* BOTH_PUBL_KEYS_RCVD */{ SMP_HAVE_BOTH_PUBLIC_KEYS, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
 };
 
-static const UINT8 smp_slave_sec_conn_phs1_start_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_sec_conn_phs1_start_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* SC_DHKEY_CMPLT       */{ SMP_START_SEC_CONN_PHASE1, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
@@ -576,14 +576,14 @@
 /*COMMIT*/{SMP_PROCESS_PAIRING_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
 };
 
-static const UINT8 smp_slave_wait_commitment_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_wait_commitment_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* PAIR_COMMITM  */{SMP_PROCESS_PAIRING_COMMITMENT, SMP_SEND_COMMITMENT,  SMP_STATE_WAIT_NONCE},
 /* PAIR_KEYPR_NOTIF */{SMP_PROCESS_KEYPRESS_NOTIFICATION, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_COMMITMENT},
 };
 
-static const UINT8 smp_slave_wait_nonce_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_wait_nonce_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* peer nonce is received */
@@ -594,7 +594,7 @@
 /* SC_DSPL_NC   */{SMP_SEND_APP_CBACK, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
 };
 
-static const UINT8 smp_slave_sec_conn_phs2_start_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_sec_conn_phs2_start_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* SC_PHASE1_CMPLT */{SMP_CALCULATE_LOCAL_DHKEY_CHECK, SMP_PH2_DHKEY_CHECKS_ARE_PRESENT, SMP_STATE_WAIT_DHK_CHECK},
@@ -602,7 +602,7 @@
 /* PAIR_DHKEY_CHCK  */{SMP_PROCESS_DHKEY_CHECK, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS2_START},
 };
 
-static const UINT8 smp_slave_wait_dhk_check_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_wait_dhk_check_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* PAIR_DHKEY_CHCK      */{SMP_PROCESS_DHKEY_CHECK, SMP_CALCULATE_PEER_DHKEY_CHECK, SMP_STATE_DHK_CHECK},
@@ -610,7 +610,7 @@
 /* SC_2_DHCK_CHKS_PRES  */{SMP_CALCULATE_PEER_DHKEY_CHECK, SMP_SM_NO_ACTION, SMP_STATE_DHK_CHECK},
 };
 
-static const UINT8 smp_slave_dhk_check_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_dhk_check_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 
@@ -623,7 +623,7 @@
 /* PAIR_DHKEY_CHCK      */{SMP_SEND_DHKEY_CHECK, SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
 };
 
-static const UINT8 smp_slave_enc_pending_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_enc_pending_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* ENC_REQ   */ {SMP_GENERATE_STK,      SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
@@ -633,7 +633,7 @@
 /* ENCRYPTED */ {SMP_CHECK_AUTH_REQ,    SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
 /* BOND_REQ  */ {SMP_KEY_DISTRIBUTE,    SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING}
 };
-static const UINT8 smp_slave_bond_pending_table[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_bond_pending_table[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 
@@ -649,7 +649,7 @@
 
 };
 
-static const UINT8 smp_slave_create_local_sec_conn_oob_data[][SMP_SM_NUM_COLS] =
+static const uint8_t smp_slave_create_local_sec_conn_oob_data[][SMP_SM_NUM_COLS] =
 {
 /*                          Event                  Action                 Next State */
 /* LOC_PUBL_KEY_CRTD */ {SMP_SET_LOCAL_OOB_KEYS, SMP_SM_NO_ACTION, SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA},
@@ -710,14 +710,14 @@
     {smp_master_create_local_sec_conn_oob_data, smp_slave_create_local_sec_conn_oob_data}
 };
 
-typedef const UINT8 (*tSMP_ENTRY_TBL)[SMP_STATE_MAX];
+typedef const uint8_t (*tSMP_ENTRY_TBL)[SMP_STATE_MAX];
 static const tSMP_ENTRY_TBL smp_entry_table[] =
 {
     smp_master_entry_map,
     smp_slave_entry_map
 };
 
-#if SMP_DYNAMIC_MEMORY == FALSE
+#if (SMP_DYNAMIC_MEMORY == FALSE)
 tSMP_CB  smp_cb;
 #endif
 #define SMP_ALL_TBL_MASK        0x80
@@ -767,9 +767,9 @@
 *******************************************************************************/
 void smp_sm_event(tSMP_CB *p_cb, tSMP_EVENT event, void *p_data)
 {
-    UINT8           curr_state = p_cb->state;
+    uint8_t         curr_state = p_cb->state;
     tSMP_SM_TBL     state_table;
-    UINT8           action, entry, i;
+    uint8_t         action, entry, i;
     tSMP_ENTRY_TBL  entry_table =  smp_entry_table[p_cb->role];
 
     SMP_TRACE_EVENT("main smp_sm_event");
diff --git a/stack/smp/smp_utils.c b/stack/smp/smp_utils.c
index f098c30..201aceb 100644
--- a/stack/smp/smp_utils.c
+++ b/stack/smp/smp_utils.c
@@ -23,7 +23,7 @@
  ******************************************************************************/
 #include "bt_target.h"
 
-#if SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
 
 #include "bt_types.h"
 #include "bt_utils.h"
@@ -57,7 +57,7 @@
 #define SMP_PAIR_KEYPR_NOTIF_SIZE       (1 /* opcode */ + 1 /*Notif Type*/)
 
 /* SMP command sizes per spec */
-static const UINT8 smp_cmd_size_per_spec[] =
+static const uint8_t smp_cmd_size_per_spec[] =
 {
     0,
     SMP_PAIRING_REQ_SIZE,       /* 0x01: pairing request */
@@ -77,13 +77,13 @@
     SMP_PAIR_COMMITM_SIZE       /* 0x0F: pairing commitment */
 };
 
-static BOOLEAN smp_parameter_unconditionally_valid(tSMP_CB *p_cb);
-static BOOLEAN smp_parameter_unconditionally_invalid(tSMP_CB *p_cb);
+static bool    smp_parameter_unconditionally_valid(tSMP_CB *p_cb);
+static bool    smp_parameter_unconditionally_invalid(tSMP_CB *p_cb);
 
 /* type for SMP command length validation functions */
-typedef BOOLEAN (*tSMP_CMD_LEN_VALID)(tSMP_CB *p_cb);
+typedef bool    (*tSMP_CMD_LEN_VALID)(tSMP_CB *p_cb);
 
-static BOOLEAN smp_command_has_valid_fixed_length(tSMP_CB *p_cb);
+static bool    smp_command_has_valid_fixed_length(tSMP_CB *p_cb);
 
 static const tSMP_CMD_LEN_VALID smp_cmd_len_is_valid[] =
 {
@@ -106,10 +106,10 @@
 };
 
 /* type for SMP command parameter ranges validation functions */
-typedef BOOLEAN (*tSMP_CMD_PARAM_RANGES_VALID)(tSMP_CB *p_cb);
+typedef bool    (*tSMP_CMD_PARAM_RANGES_VALID)(tSMP_CB *p_cb);
 
-static BOOLEAN smp_pairing_request_response_parameters_are_valid(tSMP_CB *p_cb);
-static BOOLEAN smp_pairing_keypress_notification_is_valid(tSMP_CB *p_cb);
+static bool    smp_pairing_request_response_parameters_are_valid(tSMP_CB *p_cb);
+static bool    smp_pairing_keypress_notification_is_valid(tSMP_CB *p_cb);
 
 static const tSMP_CMD_PARAM_RANGES_VALID smp_cmd_param_ranges_are_valid[] =
 {
@@ -132,22 +132,22 @@
 };
 
 /* type for action functions */
-typedef BT_HDR * (*tSMP_CMD_ACT)(UINT8 cmd_code, tSMP_CB *p_cb);
+typedef BT_HDR * (*tSMP_CMD_ACT)(uint8_t cmd_code, tSMP_CB *p_cb);
 
-static BT_HDR *smp_build_pairing_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_confirm_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_rand_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_pairing_fail(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_identity_info_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_encrypt_info_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_security_request(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_signing_info_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_master_id_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_id_addr_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_pair_public_key_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_pairing_commitment_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_pair_dhkey_check_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
-static BT_HDR *smp_build_pairing_keypress_notification_cmd(UINT8 cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_pairing_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_confirm_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_rand_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_pairing_fail(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_identity_info_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_encrypt_info_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_security_request(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_signing_info_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_master_id_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_id_addr_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_pair_public_key_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_pairing_commitment_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_pair_dhkey_check_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
+static BT_HDR *smp_build_pairing_keypress_notification_cmd(uint8_t cmd_code, tSMP_CB *p_cb);
 
 static const tSMP_CMD_ACT smp_cmd_build_act[] =
 {
@@ -169,7 +169,7 @@
     smp_build_pairing_commitment_cmd /* 0x0F: pairing commitment */
 };
 
-static const UINT8 smp_association_table[2][SMP_IO_CAP_MAX][SMP_IO_CAP_MAX] =
+static const uint8_t smp_association_table[2][SMP_IO_CAP_MAX][SMP_IO_CAP_MAX] =
 {
     /* display only */    /* Display Yes/No */   /* keyboard only */
                        /* No Input/Output */ /* keyboard display */
@@ -219,7 +219,7 @@
                          SMP_MODEL_ENCRYPTION_ONLY, SMP_MODEL_PASSKEY}}
 };
 
-static const UINT8 smp_association_table_sc[2][SMP_IO_CAP_MAX][SMP_IO_CAP_MAX] =
+static const uint8_t smp_association_table_sc[2][SMP_IO_CAP_MAX][SMP_IO_CAP_MAX] =
 {
      /* display only */    /* Display Yes/No */   /* keyboard only */
                                              /* No InputOutput */  /* keyboard display */
@@ -281,28 +281,28 @@
 ** Description      Send message to L2CAP.
 **
 *******************************************************************************/
-BOOLEAN  smp_send_msg_to_L2CAP(BD_ADDR rem_bda, BT_HDR *p_toL2CAP)
+bool     smp_send_msg_to_L2CAP(BD_ADDR rem_bda, BT_HDR *p_toL2CAP)
 {
-    UINT16 l2cap_ret;
-    UINT16 fixed_cid = L2CAP_SMP_CID;
+    uint16_t l2cap_ret;
+    uint16_t fixed_cid = L2CAP_SMP_CID;
 
     if (smp_cb.smp_over_br)
     {
         fixed_cid = L2CAP_SMP_BR_CID;
     }
 
-    SMP_TRACE_EVENT("%s", __FUNCTION__);
+    SMP_TRACE_EVENT("%s", __func__);
     smp_cb.total_tx_unacked += 1;
 
     if ((l2cap_ret = L2CA_SendFixedChnlData (fixed_cid, rem_bda, p_toL2CAP)) == L2CAP_DW_FAILED)
     {
         smp_cb.total_tx_unacked -= 1;
         SMP_TRACE_ERROR("SMP   failed to pass msg:0x%0x to L2CAP",
-                         *((UINT8 *)(p_toL2CAP + 1) + p_toL2CAP->offset));
-        return FALSE;
+                         *((uint8_t *)(p_toL2CAP + 1) + p_toL2CAP->offset));
+        return false;
     }
     else
-        return TRUE;
+        return true;
 }
 
 /*******************************************************************************
@@ -312,11 +312,11 @@
 ** Description      send a SMP command on L2CAP channel.
 **
 *******************************************************************************/
-BOOLEAN smp_send_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+bool    smp_send_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
     BT_HDR *p_buf;
-    BOOLEAN sent = FALSE;
-    UINT8 failure = SMP_PAIR_INTERNAL_ERR;
+    bool    sent = false;
+    uint8_t failure = SMP_PAIR_INTERNAL_ERR;
     SMP_TRACE_EVENT("smp_send_cmd on l2cap cmd_code=0x%x", cmd_code);
     if ( cmd_code <= (SMP_OPCODE_MAX + 1 /* for SMP_OPCODE_PAIR_COMMITM */) &&
          smp_cmd_build_act[cmd_code] != NULL)
@@ -326,7 +326,7 @@
         if (p_buf != NULL &&
             smp_send_msg_to_L2CAP(p_cb->pairing_bda, p_buf))
         {
-            sent = TRUE;
+            sent = true;
             alarm_set_on_queue(p_cb->smp_rsp_timer_ent,
                                SMP_WAIT_FOR_RSP_TIMEOUT_MS, smp_rsp_timeout,
                                NULL, btu_general_alarm_queue);
@@ -359,9 +359,9 @@
 void smp_rsp_timeout(UNUSED_ATTR void *data)
 {
     tSMP_CB   *p_cb = &smp_cb;
-    UINT8 failure = SMP_RSP_TIMEOUT;
+    uint8_t failure = SMP_RSP_TIMEOUT;
 
-    SMP_TRACE_EVENT("%s state:%d br_state:%d", __FUNCTION__, p_cb->state, p_cb->br_state);
+    SMP_TRACE_EVENT("%s state:%d br_state:%d", __func__, p_cb->state, p_cb->br_state);
 
     if (p_cb->smp_over_br)
     {
@@ -391,7 +391,7 @@
      */
     if (smp_get_state() == SMP_STATE_BOND_PENDING)
     {
-        UINT8 reason = SMP_SUCCESS;
+        uint8_t reason = SMP_SUCCESS;
         SMP_TRACE_EVENT("%s sending delayed auth complete.", __func__);
         smp_sm_event(&smp_cb, SMP_AUTH_CMPL_EVT, &reason);
     }
@@ -404,15 +404,15 @@
 ** Description      Build pairing request command.
 **
 *******************************************************************************/
-BT_HDR * smp_build_pairing_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+BT_HDR * smp_build_pairing_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_PAIRING_REQ_SIZE + L2CAP_MIN_OFFSET);
 
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, cmd_code);
     UINT8_TO_STREAM(p, p_cb->local_io_capability);
     UINT8_TO_STREAM(p, p_cb->loc_oob_flag);
@@ -435,16 +435,16 @@
 ** Description      Build confirm request command.
 **
 *******************************************************************************/
-static BT_HDR * smp_build_confirm_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR * smp_build_confirm_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_CONFIRM_CMD_SIZE + L2CAP_MIN_OFFSET);
 
     UNUSED(cmd_code);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     UINT8_TO_STREAM(p, SMP_OPCODE_CONFIRM);
     ARRAY_TO_STREAM(p, p_cb->confirm, BT_OCTET16_LEN);
@@ -462,16 +462,16 @@
 ** Description      Build Random command.
 **
 *******************************************************************************/
-static BT_HDR * smp_build_rand_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR * smp_build_rand_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_RAND_CMD_SIZE + L2CAP_MIN_OFFSET);
 
     UNUSED(cmd_code);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_RAND);
     ARRAY_TO_STREAM(p, p_cb->rand, BT_OCTET16_LEN);
 
@@ -488,16 +488,16 @@
 ** Description      Build security information command.
 **
 *******************************************************************************/
-static BT_HDR * smp_build_encrypt_info_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR * smp_build_encrypt_info_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_ENC_INFO_SIZE + L2CAP_MIN_OFFSET);
 
     UNUSED(cmd_code);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_ENCRYPT_INFO);
     ARRAY_TO_STREAM(p, p_cb->ltk, BT_OCTET16_LEN);
 
@@ -514,16 +514,16 @@
 ** Description      Build security information command.
 **
 *******************************************************************************/
-static BT_HDR * smp_build_master_id_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR * smp_build_master_id_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_MASTER_ID_SIZE + L2CAP_MIN_OFFSET);
 
     UNUSED(cmd_code);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_MASTER_ID);
     UINT16_TO_STREAM(p, p_cb->ediv);
     ARRAY_TO_STREAM(p, p_cb->enc_rand, BT_OCTET8_LEN);
@@ -541,9 +541,9 @@
 ** Description      Build identity information command.
 **
 *******************************************************************************/
-static BT_HDR * smp_build_identity_info_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR * smp_build_identity_info_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_OCTET16 irk;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_ID_INFO_SIZE + L2CAP_MIN_OFFSET);
@@ -552,7 +552,7 @@
     UNUSED(p_cb);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
 
     BTM_GetDeviceIDRoot(irk);
 
@@ -572,9 +572,9 @@
 ** Description      Build identity address information command.
 **
 *******************************************************************************/
-static BT_HDR * smp_build_id_addr_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR * smp_build_id_addr_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_ID_ADDR_SIZE + L2CAP_MIN_OFFSET);
 
@@ -582,7 +582,7 @@
     UNUSED(p_cb);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_ID_ADDR);
     UINT8_TO_STREAM(p, 0);
     BDADDR_TO_STREAM(p, controller_get_interface()->get_address()->address);
@@ -600,16 +600,16 @@
 ** Description      Build signing information command.
 **
 *******************************************************************************/
-static BT_HDR * smp_build_signing_info_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR * smp_build_signing_info_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_SIGN_INFO_SIZE + L2CAP_MIN_OFFSET);
 
     UNUSED(cmd_code);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_SIGN_INFO);
     ARRAY_TO_STREAM(p, p_cb->csrk, BT_OCTET16_LEN);
 
@@ -626,16 +626,16 @@
 ** Description      Build Pairing Fail command.
 **
 *******************************************************************************/
-static BT_HDR * smp_build_pairing_fail(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR * smp_build_pairing_fail(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_PAIR_FAIL_SIZE + L2CAP_MIN_OFFSET);
 
     UNUSED(cmd_code);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_PAIRING_FAILED);
     UINT8_TO_STREAM(p, p_cb->failure);
 
@@ -652,16 +652,16 @@
 ** Description      Build security request command.
 **
 *******************************************************************************/
-static BT_HDR *smp_build_security_request(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR *smp_build_security_request(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         2 + L2CAP_MIN_OFFSET);
 
     UNUSED(cmd_code);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_SEC_REQ);
     UINT8_TO_STREAM(p, p_cb->loc_auth_req);
 
@@ -680,11 +680,11 @@
 ** Description      Build pairing public key command.
 **
 *******************************************************************************/
-static BT_HDR *smp_build_pair_public_key_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR *smp_build_pair_public_key_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8   *p;
-    UINT8   publ_key[2*BT_OCTET32_LEN];
-    UINT8   *p_publ_key = publ_key;
+    uint8_t *p;
+    uint8_t publ_key[2*BT_OCTET32_LEN];
+    uint8_t *p_publ_key = publ_key;
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_PAIR_PUBL_KEY_SIZE + L2CAP_MIN_OFFSET);
 
@@ -694,7 +694,7 @@
     memcpy(p_publ_key, p_cb->loc_publ_key.x, BT_OCTET32_LEN);
     memcpy(p_publ_key + BT_OCTET32_LEN, p_cb->loc_publ_key.y, BT_OCTET32_LEN);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_PAIR_PUBLIC_KEY);
     ARRAY_TO_STREAM(p, p_publ_key, 2*BT_OCTET32_LEN);
 
@@ -711,16 +711,16 @@
 ** Description      Build pairing commitment command.
 **
 *******************************************************************************/
-static BT_HDR *smp_build_pairing_commitment_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR *smp_build_pairing_commitment_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_PAIR_COMMITM_SIZE + L2CAP_MIN_OFFSET);
 
     UNUSED(cmd_code);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_CONFIRM);
     ARRAY_TO_STREAM(p, p_cb->commitment, BT_OCTET16_LEN);
 
@@ -737,16 +737,16 @@
 ** Description      Build pairing DHKey check command.
 **
 *******************************************************************************/
-static BT_HDR *smp_build_pair_dhkey_check_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR *smp_build_pair_dhkey_check_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_PAIR_DHKEY_CHECK_SIZE + L2CAP_MIN_OFFSET);
 
     UNUSED(cmd_code);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_PAIR_DHKEY_CHECK);
     ARRAY_TO_STREAM(p, p_cb->dhkey_check, BT_OCTET16_LEN);
 
@@ -763,16 +763,16 @@
 ** Description      Build keypress notification command.
 **
 *******************************************************************************/
-static BT_HDR * smp_build_pairing_keypress_notification_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
+static BT_HDR * smp_build_pairing_keypress_notification_cmd(uint8_t cmd_code, tSMP_CB *p_cb)
 {
-    UINT8       *p;
+    uint8_t     *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_PAIR_KEYPR_NOTIF_SIZE + L2CAP_MIN_OFFSET);
 
     UNUSED(cmd_code);
     SMP_TRACE_EVENT("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_PAIR_KEYPR_NOTIF);
     UINT8_TO_STREAM(p, p_cb->local_keypress_notification);
 
@@ -793,9 +793,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-void smp_convert_string_to_tk(BT_OCTET16 tk, UINT32 passkey)
+void smp_convert_string_to_tk(BT_OCTET16 tk, uint32_t passkey)
 {
-    UINT8   *p = tk;
+    uint8_t *p = tk;
     tSMP_KEY    key;
     SMP_TRACE_EVENT("smp_convert_string_to_tk");
     UINT32_TO_STREAM(p, passkey);
@@ -817,7 +817,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void smp_mask_enc_key(UINT8 loc_enc_size, UINT8 * p_data)
+void smp_mask_enc_key(uint8_t loc_enc_size, uint8_t * p_data)
 {
     SMP_TRACE_EVENT("smp_mask_enc_key");
     if (loc_enc_size < BT_OCTET16_LEN)
@@ -840,7 +840,7 @@
 *******************************************************************************/
 void smp_xor_128(BT_OCTET16 a, BT_OCTET16 b)
 {
-    UINT8 i, *aa = a, *bb = b;
+    uint8_t i, *aa = a, *bb = b;
 
     SMP_TRACE_EVENT("smp_xor_128");
     for (i = 0; i < BT_OCTET16_LEN; i++)
@@ -861,7 +861,7 @@
 void smp_cb_cleanup(tSMP_CB   *p_cb)
 {
     tSMP_CALLBACK   *p_callback = p_cb->p_callback;
-    UINT8           trace_level = p_cb->trace_level;
+    uint8_t         trace_level = p_cb->trace_level;
 
     SMP_TRACE_EVENT("smp_cb_cleanup");
 
@@ -945,10 +945,10 @@
     if (p_cb->status == SMP_SUCCESS)
         evt_data.cmplt.sec_level = p_cb->sec_level;
 
-    evt_data.cmplt.is_pair_cancel  = FALSE;
+    evt_data.cmplt.is_pair_cancel  = false;
 
     if (p_cb->is_pair_cancel)
-        evt_data.cmplt.is_pair_cancel = TRUE;
+        evt_data.cmplt.is_pair_cancel = true;
 
 
     SMP_TRACE_DEBUG ("send SMP_COMPLT_EVT reason=0x%0x sec_level=0x%0x",
@@ -970,14 +970,14 @@
 ** Description      Checks if the received SMP command has invalid parameters i.e.
 **                  if the command length is valid and the command parameters are
 **                  inside specified range.
-**                  It returns TRUE if the command has invalid parameters.
+**                  It returns true if the command has invalid parameters.
 **
-** Returns          TRUE if the command has invalid parameters, FALSE otherwise.
+** Returns          true if the command has invalid parameters, false otherwise.
 **
 *******************************************************************************/
-BOOLEAN smp_command_has_invalid_parameters(tSMP_CB *p_cb)
+bool    smp_command_has_invalid_parameters(tSMP_CB *p_cb)
 {
-    UINT8 cmd_code = p_cb->rcvd_cmd_code;
+    uint8_t cmd_code = p_cb->rcvd_cmd_code;
 
     SMP_TRACE_DEBUG("%s for cmd code 0x%02x", __func__, cmd_code);
 
@@ -985,16 +985,16 @@
         (cmd_code < SMP_OPCODE_MIN))
     {
         SMP_TRACE_WARNING("Somehow received command with the RESERVED code 0x%02x", cmd_code);
-        return TRUE;
+        return true;
     }
 
     if (!(*smp_cmd_len_is_valid[cmd_code])(p_cb))
-        return TRUE;
+        return true;
 
     if (!(*smp_cmd_param_ranges_are_valid[cmd_code])(p_cb))
-        return TRUE;
+        return true;
 
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -1004,13 +1004,13 @@
 ** Description      Checks if the received command size is equal to the size
 **                  according to specs.
 **
-** Returns          TRUE if the command size is as expected, FALSE otherwise.
+** Returns          true if the command size is as expected, false otherwise.
 **
 ** Note             The command is expected to have fixed length.
 *******************************************************************************/
-BOOLEAN smp_command_has_valid_fixed_length(tSMP_CB *p_cb)
+bool    smp_command_has_valid_fixed_length(tSMP_CB *p_cb)
 {
-    UINT8   cmd_code = p_cb->rcvd_cmd_code;
+    uint8_t cmd_code = p_cb->rcvd_cmd_code;
 
     SMP_TRACE_DEBUG("%s for cmd code 0x%02x", __func__, cmd_code);
 
@@ -1019,10 +1019,10 @@
         SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with invalid length\
             0x%02x (per spec the length is 0x%02x).",
             cmd_code, p_cb->rcvd_cmd_len, smp_cmd_size_per_spec[cmd_code]);
-        return FALSE;
+        return false;
     }
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -1036,15 +1036,15 @@
 **                  OOB data flag,
 **                  Bonding_flags in AuthReq
 **                  Maximum encryption key size.
-**                  Returns FALSE if at least one of these parameters is out of range.
+**                  Returns false if at least one of these parameters is out of range.
 **
 *******************************************************************************/
-BOOLEAN smp_pairing_request_response_parameters_are_valid(tSMP_CB *p_cb)
+bool    smp_pairing_request_response_parameters_are_valid(tSMP_CB *p_cb)
 {
-    UINT8   io_caps = p_cb->peer_io_caps;
-    UINT8   oob_flag = p_cb->peer_oob_flag;
-    UINT8   bond_flag = p_cb->peer_auth_req & 0x03; //0x03 is gen bond with appropriate mask
-    UINT8   enc_size = p_cb->peer_enc_size;
+    uint8_t io_caps = p_cb->peer_io_caps;
+    uint8_t oob_flag = p_cb->peer_oob_flag;
+    uint8_t bond_flag = p_cb->peer_auth_req & 0x03; //0x03 is gen bond with appropriate mask
+    uint8_t enc_size = p_cb->peer_enc_size;
 
     SMP_TRACE_DEBUG("%s for cmd code 0x%02x", __func__, p_cb->rcvd_cmd_code);
 
@@ -1053,7 +1053,7 @@
         SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with IO Capabilty \
             value (0x%02x) out of range).",
             p_cb->rcvd_cmd_code, io_caps);
-        return FALSE;
+        return false;
     }
 
     if (!((oob_flag == SMP_OOB_NONE) || (oob_flag == SMP_OOB_PRESENT)))
@@ -1061,7 +1061,7 @@
         SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with OOB data flag value \
             (0x%02x) out of range).",
              p_cb->rcvd_cmd_code, oob_flag);
-        return FALSE;
+        return false;
     }
 
     if (!((bond_flag == SMP_AUTH_NO_BOND) || (bond_flag == SMP_AUTH_BOND)))
@@ -1069,7 +1069,7 @@
         SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with Bonding_Flags value (0x%02x)\
                            out of range).",
                            p_cb->rcvd_cmd_code, bond_flag);
-        return FALSE;
+        return false;
     }
 
     if ((enc_size < SMP_ENCR_KEY_SIZE_MIN) || (enc_size > SMP_ENCR_KEY_SIZE_MAX))
@@ -1077,10 +1077,10 @@
         SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with Maximum Encryption \
             Key value (0x%02x) out of range).",
             p_cb->rcvd_cmd_code, enc_size);
-        return FALSE;
+        return false;
     }
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -1089,10 +1089,10 @@
 **
 ** Description      Validates Notification Type parameter range in the received SMP command
 **                  pairing keypress notification.
-**                  Returns FALSE if this parameter is out of range.
+**                  Returns false if this parameter is out of range.
 **
 *******************************************************************************/
-BOOLEAN smp_pairing_keypress_notification_is_valid(tSMP_CB *p_cb)
+bool    smp_pairing_keypress_notification_is_valid(tSMP_CB *p_cb)
 {
     tBTM_SP_KEY_TYPE keypress_notification = p_cb->peer_keypress_notification;
 
@@ -1103,34 +1103,34 @@
         SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with Pairing Keypress \
             Notification value (0x%02x) out of range).",
             p_cb->rcvd_cmd_code, keypress_notification);
-        return FALSE;
+        return false;
     }
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
 **
 ** Function         smp_parameter_unconditionally_valid
 **
-** Description      Always returns TRUE.
+** Description      Always returns true.
 **
 *******************************************************************************/
-BOOLEAN smp_parameter_unconditionally_valid(UNUSED_ATTR tSMP_CB *p_cb)
+bool    smp_parameter_unconditionally_valid(UNUSED_ATTR tSMP_CB *p_cb)
 {
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
 **
 ** Function         smp_parameter_unconditionally_invalid
 **
-** Description      Always returns FALSE.
+** Description      Always returns false.
 **
 *******************************************************************************/
-BOOLEAN smp_parameter_unconditionally_invalid(UNUSED_ATTR tSMP_CB *p_cb)
+bool    smp_parameter_unconditionally_invalid(UNUSED_ATTR tSMP_CB *p_cb)
 {
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -1145,13 +1145,13 @@
 *******************************************************************************/
 void smp_reject_unexpected_pairing_command(BD_ADDR bd_addr)
 {
-    UINT8 *p;
+    uint8_t *p;
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR) +
                         SMP_PAIR_FAIL_SIZE + L2CAP_MIN_OFFSET);
 
     SMP_TRACE_DEBUG("%s", __func__);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_MIN_OFFSET;
     UINT8_TO_STREAM(p, SMP_OPCODE_PAIRING_FAILED);
     UINT8_TO_STREAM(p, SMP_PAIR_NOT_SUPPORT);
 
@@ -1170,7 +1170,7 @@
 **
 ** Note             If Secure Connections Only mode is required locally then we
 **                  come to this point only if both sides support Secure Connections
-**                  mode, i.e. if p_cb->secure_connections_only_mode_required = TRUE then we come
+**                  mode, i.e. if p_cb->secure_connections_only_mode_required = true then we come
 **                  to this point only if
 **                      (p_cb->peer_auth_req & SMP_SC_SUPPORT_BIT) ==
 **                      (p_cb->loc_auth_req & SMP_SC_SUPPORT_BIT) ==
@@ -1180,22 +1180,22 @@
 tSMP_ASSO_MODEL smp_select_association_model(tSMP_CB *p_cb)
 {
     tSMP_ASSO_MODEL model = SMP_MODEL_OUT_OF_RANGE;
-    p_cb->le_secure_connections_mode_is_used = FALSE;
+    p_cb->le_secure_connections_mode_is_used = false;
 
-    SMP_TRACE_EVENT("%s", __FUNCTION__);
+    SMP_TRACE_EVENT("%s", __func__);
     SMP_TRACE_DEBUG("%s p_cb->peer_io_caps = %d p_cb->local_io_capability = %d",
-                       __FUNCTION__, p_cb->peer_io_caps, p_cb->local_io_capability);
+                       __func__, p_cb->peer_io_caps, p_cb->local_io_capability);
     SMP_TRACE_DEBUG("%s p_cb->peer_oob_flag = %d p_cb->loc_oob_flag = %d",
-                       __FUNCTION__, p_cb->peer_oob_flag, p_cb->loc_oob_flag);
+                       __func__, p_cb->peer_oob_flag, p_cb->loc_oob_flag);
     SMP_TRACE_DEBUG("%s p_cb->peer_auth_req = 0x%02x p_cb->loc_auth_req = 0x%02x",
-                       __FUNCTION__, p_cb->peer_auth_req, p_cb->loc_auth_req);
+                       __func__, p_cb->peer_auth_req, p_cb->loc_auth_req);
     SMP_TRACE_DEBUG("%s p_cb->secure_connections_only_mode_required = %s",
-                       __FUNCTION__, p_cb->secure_connections_only_mode_required ?
-                                    "TRUE" : "FALSE");
+                       __func__, p_cb->secure_connections_only_mode_required ?
+                                    "true" : "false");
 
     if ((p_cb->peer_auth_req & SMP_SC_SUPPORT_BIT) && (p_cb->loc_auth_req & SMP_SC_SUPPORT_BIT))
     {
-        p_cb->le_secure_connections_mode_is_used = TRUE;
+        p_cb->le_secure_connections_mode_is_used = true;
     }
 
     SMP_TRACE_DEBUG("use_sc_process = %d", p_cb->le_secure_connections_mode_is_used);
@@ -1293,9 +1293,9 @@
 ** Description      This function reverses array bytes
 **
 *******************************************************************************/
-void smp_reverse_array(UINT8 *arr, UINT8 len)
+void smp_reverse_array(uint8_t *arr, uint8_t len)
 {
-    UINT8 i =0, tmp;
+    uint8_t i =0, tmp;
 
     SMP_TRACE_DEBUG("smp_reverse_array");
 
@@ -1318,11 +1318,11 @@
 ** Returns          ri value
 **
 *******************************************************************************/
-UINT8 smp_calculate_random_input(UINT8 *random, UINT8 round)
+uint8_t smp_calculate_random_input(uint8_t *random, uint8_t round)
 {
-    UINT8 i = round/8;
-    UINT8 j = round%8;
-    UINT8 ri;
+    uint8_t i = round/8;
+    uint8_t j = round%8;
+    uint8_t ri;
 
     SMP_TRACE_DEBUG("random: 0x%02x, round: %d, i: %d, j: %d", random[i], round, i, j);
     ri = ((random[i] >> j) & 1) | 0x80;
@@ -1339,7 +1339,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void smp_collect_local_io_capabilities(UINT8 *iocap, tSMP_CB *p_cb)
+void smp_collect_local_io_capabilities(uint8_t *iocap, tSMP_CB *p_cb)
 {
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -1357,7 +1357,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void smp_collect_peer_io_capabilities(UINT8 *iocap, tSMP_CB *p_cb)
+void smp_collect_peer_io_capabilities(uint8_t *iocap, tSMP_CB *p_cb)
 {
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -1376,11 +1376,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void smp_collect_local_ble_address(UINT8 *le_addr, tSMP_CB *p_cb)
+void smp_collect_local_ble_address(uint8_t *le_addr, tSMP_CB *p_cb)
 {
     tBLE_ADDR_TYPE  addr_type = 0;
     BD_ADDR         bda;
-    UINT8           *p = le_addr;
+    uint8_t         *p = le_addr;
 
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -1399,11 +1399,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void smp_collect_peer_ble_address(UINT8 *le_addr, tSMP_CB *p_cb)
+void smp_collect_peer_ble_address(uint8_t *le_addr, tSMP_CB *p_cb)
 {
     tBLE_ADDR_TYPE  addr_type = 0;
     BD_ADDR         bda;
-    UINT8           *p = le_addr;
+    uint8_t         *p = le_addr;
 
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -1424,28 +1424,28 @@
 **                  - expected (i.e. calculated locally),
 **                  - received from the peer.
 **
-** Returns          TRUE  if the values are the same
-**                  FALSE otherwise
+** Returns          true  if the values are the same
+**                  false otherwise
 **
 *******************************************************************************/
-BOOLEAN smp_check_commitment(tSMP_CB *p_cb)
+bool    smp_check_commitment(tSMP_CB *p_cb)
 {
     BT_OCTET16 expected;
 
     SMP_TRACE_DEBUG("%s", __func__);
 
     smp_calculate_peer_commitment(p_cb, expected);
-    print128(expected, (const UINT8 *)"calculated peer commitment");
-    print128(p_cb->remote_commitment, (const UINT8 *)"received peer commitment");
+    print128(expected, (const uint8_t *)"calculated peer commitment");
+    print128(p_cb->remote_commitment, (const uint8_t *)"received peer commitment");
 
     if (memcmp(p_cb->remote_commitment, expected, BT_OCTET16_LEN))
     {
         SMP_TRACE_WARNING("%s: Commitment check fails", __func__);
-        return FALSE;
+        return false;
     }
 
     SMP_TRACE_DEBUG("%s: Commitment check succeeds", __func__);
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -1468,7 +1468,7 @@
     lle_key.div = 0;
     lle_key.key_size = p_cb->loc_enc_size;
     lle_key.sec_level = p_cb->sec_level;
-    btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LENC, (tBTM_LE_KEY_VALUE *)&lle_key, TRUE);
+    btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LENC, (tBTM_LE_KEY_VALUE *)&lle_key, true);
 
     SMP_TRACE_DEBUG("%s-Save LTK as peer LTK key", __func__);
     ple_key.ediv = 0;
@@ -1476,7 +1476,7 @@
     memcpy(ple_key.ltk, p_cb->ltk, BT_OCTET16_LEN);
     ple_key.sec_level = p_cb->sec_level;
     ple_key.key_size  = p_cb->loc_enc_size;
-    btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_PENC, (tBTM_LE_KEY_VALUE *)&ple_key, TRUE);
+    btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_PENC, (tBTM_LE_KEY_VALUE *)&ple_key, true);
 }
 
 /*******************************************************************************
@@ -1488,15 +1488,15 @@
 **                  MacKey is used in dhkey calculation, LTK is used to encrypt
 **                  the link.
 **
-** Returns          FALSE if out of resources, TRUE otherwise.
+** Returns          false if out of resources, true otherwise.
 **
 *******************************************************************************/
-BOOLEAN smp_calculate_f5_mackey_and_long_term_key(tSMP_CB *p_cb)
+bool    smp_calculate_f5_mackey_and_long_term_key(tSMP_CB *p_cb)
 {
-    UINT8 a[7];
-    UINT8 b[7];
-    UINT8 *p_na;
-    UINT8 *p_nb;
+    uint8_t a[7];
+    uint8_t b[7];
+    uint8_t *p_na;
+    uint8_t *p_nb;
 
     SMP_TRACE_DEBUG("%s", __func__);
 
@@ -1518,11 +1518,11 @@
     if(!smp_calculate_f5(p_cb->dhkey, p_na, p_nb, a, b, p_cb->mac_key, p_cb->ltk))
     {
         SMP_TRACE_ERROR("%s failed", __func__);
-        return FALSE;
+        return false;
     }
 
     SMP_TRACE_EVENT ("%s is completed", __func__);
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -1531,11 +1531,11 @@
 **
 ** Description      Requests application to provide OOB data.
 **
-** Returns          TRUE - OOB data has to be provided by application
-**                  FALSE - otherwise (unexpected)
+** Returns          true - OOB data has to be provided by application
+**                  false - otherwise (unexpected)
 **
 *******************************************************************************/
-BOOLEAN smp_request_oob_data(tSMP_CB *p_cb)
+bool    smp_request_oob_data(tSMP_CB *p_cb)
 {
     tSMP_OOB_DATA_TYPE req_oob_type = SMP_OOB_INVALID_TYPE;
 
@@ -1559,13 +1559,13 @@
     SMP_TRACE_DEBUG("req_oob_type = %d", req_oob_type);
 
     if (req_oob_type == SMP_OOB_INVALID_TYPE)
-        return FALSE;
+        return false;
 
     p_cb->req_oob_type = req_oob_type;
     p_cb->cb_evt = SMP_SC_OOB_REQ_EVT;
     smp_sm_event(p_cb, SMP_TK_REQ_EVT, &req_oob_type);
 
-    return TRUE;
+    return true;
 }
 
 
diff --git a/stack/srvc/srvc_battery.c b/stack/srvc/srvc_battery.c
index 56151d5..33d7ffd 100644
--- a/stack/srvc/srvc_battery.c
+++ b/stack/srvc/srvc_battery.c
@@ -24,7 +24,7 @@
 #include "srvc_battery_int.h"
 #include "btcore/include/uuid.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
 #define BA_MAX_CHAR_NUM          1
 #define BA_MAX_ATTR_NUM          (BA_MAX_CHAR_NUM * 5 + 1) /* max 3 descriptors, 1 desclration and 1 value */
@@ -46,9 +46,9 @@
 **
 **   validate a handle to be a DIS attribute handle or not.
 *******************************************************************************/
-BOOLEAN battery_valid_handle_range(UINT16 handle)
+bool    battery_valid_handle_range(uint16_t handle)
 {
-    UINT8       i = 0;
+    uint8_t     i = 0;
     tBA_INST    *p_inst = &battery_cb.battery_inst[0];
 
     for (;i < BA_MAX_INT_NUM; i ++, p_inst++)
@@ -58,25 +58,25 @@
             handle == p_inst->rpt_ref_hdl ||
             handle == p_inst->pres_fmt_hdl )
         {
-            return TRUE;
+            return true;
         }
     }
-    return FALSE;
+    return false;
 }
 /*******************************************************************************
 **   battery_s_write_attr_value
 **
 **   Process write DIS attribute request.
 *******************************************************************************/
-UINT8 battery_s_write_attr_value(UINT8 clcb_idx, tGATT_WRITE_REQ * p_value,
+uint8_t battery_s_write_attr_value(uint8_t clcb_idx, tGATT_WRITE_REQ * p_value,
                                  tGATT_STATUS *p_status)
 {
-    UINT8       *p = p_value->value, i;
-    UINT16      handle = p_value->handle;
+    uint8_t     *p = p_value->value, i;
+    uint16_t    handle = p_value->handle;
     tBA_INST    *p_inst = &battery_cb.battery_inst[0];
     tGATT_STATUS    st = GATT_NOT_FOUND;
     tBA_WRITE_DATA   cfg;
-    UINT8       act = SRVC_ACT_RSP;
+    uint8_t     act = SRVC_ACT_RSP;
 
     for (i = 0; i < BA_MAX_INT_NUM; i ++, p_inst ++)
     {
@@ -110,12 +110,12 @@
 /*******************************************************************************
 **   BA Attributes Database Server Request callback
 *******************************************************************************/
-UINT8 battery_s_read_attr_value (UINT8 clcb_idx, UINT16 handle, tGATT_VALUE *p_value, BOOLEAN is_long, tGATT_STATUS* p_status)
+uint8_t battery_s_read_attr_value (uint8_t clcb_idx, uint16_t handle, tGATT_VALUE *p_value, bool    is_long, tGATT_STATUS* p_status)
 {
-    UINT8       i;
+    uint8_t     i;
     tBA_INST    *p_inst = &battery_cb.battery_inst[0];
     tGATT_STATUS    st = GATT_NOT_FOUND;
-    UINT8       act = SRVC_ACT_RSP;
+    uint8_t     act = SRVC_ACT_RSP;
     UNUSED(p_value);
 
     for (i = 0; i < BA_MAX_INT_NUM; i ++, p_inst ++)
@@ -164,10 +164,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN battery_gatt_c_read_ba_req(UINT16 conn_id)
+bool    battery_gatt_c_read_ba_req(uint16_t conn_id)
 {
     UNUSED(conn_id);
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -196,9 +196,9 @@
 ** Description      Instantiate a Battery service
 **
 *******************************************************************************/
-UINT16 Battery_Instantiate (UINT8 app_id, tBA_REG_INFO *p_reg_info)
+uint16_t Battery_Instantiate (uint8_t app_id, tBA_REG_INFO *p_reg_info)
 {
-    UINT16              srvc_hdl = 0;
+    uint16_t            srvc_hdl = 0;
     tGATT_STATUS        status = GATT_ERROR;
     tBA_INST            *p_inst;
 
@@ -298,13 +298,13 @@
 ** Description      Respond to a battery service request
 **
 *******************************************************************************/
-void Battery_Rsp (UINT8 app_id, tGATT_STATUS st, UINT8 event, tBA_RSP_DATA *p_rsp)
+void Battery_Rsp (uint8_t app_id, tGATT_STATUS st, uint8_t event, tBA_RSP_DATA *p_rsp)
 {
     tBA_INST *p_inst = &battery_cb.battery_inst[0];
     tGATTS_RSP  rsp;
-    UINT8   *pp;
+    uint8_t *pp;
 
-    UINT8   i = 0;
+    uint8_t i = 0;
     while (i < BA_MAX_INT_NUM)
     {
         if (p_inst->app_id == app_id && p_inst->ba_level_hdl != 0)
@@ -366,10 +366,10 @@
 ** Description      Send battery level notification
 **
 *******************************************************************************/
-void Battery_Notify (UINT8 app_id, BD_ADDR remote_bda, UINT8 battery_level)
+void Battery_Notify (uint8_t app_id, BD_ADDR remote_bda, uint8_t battery_level)
 {
     tBA_INST *p_inst = &battery_cb.battery_inst[0];
-    UINT8    i = 0;
+    uint8_t  i = 0;
 
     while (i < BA_MAX_INT_NUM)
     {
@@ -393,10 +393,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN Battery_ReadBatteryLevel(BD_ADDR peer_bda)
+bool    Battery_ReadBatteryLevel(BD_ADDR peer_bda)
 {
     UNUSED(peer_bda);
     /* to be implemented */
-    return TRUE;
+    return true;
 }
 #endif  /* BLE_INCLUDED */
diff --git a/stack/srvc/srvc_battery_int.h b/stack/srvc/srvc_battery_int.h
index 298113e..12cbcd4 100644
--- a/stack/srvc/srvc_battery_int.h
+++ b/stack/srvc/srvc_battery_int.h
@@ -36,30 +36,30 @@
 
 typedef struct
 {
-    UINT8           app_id;
-    UINT16          ba_level_hdl;
-    UINT16          clt_cfg_hdl;
-    UINT16          rpt_ref_hdl;
-    UINT16          pres_fmt_hdl;
+    uint8_t         app_id;
+    uint16_t        ba_level_hdl;
+    uint16_t        clt_cfg_hdl;
+    uint16_t        rpt_ref_hdl;
+    uint16_t        pres_fmt_hdl;
 
     tBA_CBACK       *p_cback;
 
-    UINT16          pending_handle;
-    UINT8           pending_clcb_idx;
-    UINT8           pending_evt;
+    uint16_t        pending_handle;
+    uint8_t         pending_clcb_idx;
+    uint8_t         pending_evt;
 
 }tBA_INST;
 
 typedef struct
 {
     tBA_INST                battery_inst[BA_MAX_INT_NUM];
-    UINT8                   inst_id;
-    BOOLEAN                 enabled;
+    uint8_t                 inst_id;
+    bool                    enabled;
 
 }tBATTERY_CB;
 
 /* Global GATT data */
-#if GATT_DYNAMIC_MEMORY == FALSE
+#if (GATT_DYNAMIC_MEMORY == FALSE)
 extern tBATTERY_CB battery_cb;
 #else
 extern tBATTERY_CB *battery_cb_ptr;
@@ -67,11 +67,11 @@
 #endif
 
 
-extern BOOLEAN battery_valid_handle_range(UINT16 handle);
+extern bool    battery_valid_handle_range(uint16_t handle);
 
-extern UINT8 battery_s_write_attr_value(UINT8 clcb_idx, tGATT_WRITE_REQ * p_value,
+extern uint8_t battery_s_write_attr_value(uint8_t clcb_idx, tGATT_WRITE_REQ * p_value,
                                  tGATT_STATUS *p_status);
-extern UINT8 battery_s_read_attr_value (UINT8 clcb_idx, UINT16 handle, tGATT_VALUE *p_value, BOOLEAN is_long, tGATT_STATUS* p_status);
+extern uint8_t battery_s_read_attr_value (uint8_t clcb_idx, uint16_t handle, tGATT_VALUE *p_value, bool    is_long, tGATT_STATUS* p_status);
 
 
 
diff --git a/stack/srvc/srvc_dis.c b/stack/srvc/srvc_dis.c
index 9fb5af2..cacf701 100644
--- a/stack/srvc/srvc_dis.c
+++ b/stack/srvc/srvc_dis.c
@@ -27,7 +27,7 @@
 #include "srvc_eng_int.h"
 #include "btcore/include/uuid.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
 #define DIS_MAX_NUM_INC_SVR       0
 #define DIS_MAX_CHAR_NUM          9
@@ -37,13 +37,13 @@
 #define DIS_ATTR_DB_SIZE      GATT_DB_MEM_SIZE(DIS_MAX_NUM_INC_SVR, DIS_MAX_CHAR_NUM, 0)
 #endif
 
-#define UINT64_TO_STREAM(p, u64) {*(p)++ = (UINT8)(u64);       *(p)++ = (UINT8)((u64) >> 8);*(p)++ = (UINT8)((u64) >> 16); *(p)++ = (UINT8)((u64) >> 24); \
-                                    *(p)++ = (UINT8)((u64) >> 32); *(p)++ = (UINT8)((u64) >> 40);*(p)++ = (UINT8)((u64) >> 48); *(p)++ = (UINT8)((u64) >> 56);}
+#define uint64_t_TO_STREAM(p, u64) {*(p)++ = (uint8_t)(u64);       *(p)++ = (uint8_t)((u64) >> 8);*(p)++ = (uint8_t)((u64) >> 16); *(p)++ = (uint8_t)((u64) >> 24); \
+                                    *(p)++ = (uint8_t)((u64) >> 32); *(p)++ = (uint8_t)((u64) >> 40);*(p)++ = (uint8_t)((u64) >> 48); *(p)++ = (uint8_t)((u64) >> 56);}
 
-#define STREAM_TO_UINT64(u64, p) {(u64) = (((UINT64)(*(p))) + ((((UINT64)(*((p) + 1)))) << 8) + ((((UINT64)(*((p) + 2)))) << 16) + ((((UINT64)(*((p) + 3)))) << 24) \
-                                  + ((((UINT64)(*((p) + 4)))) << 32) + ((((UINT64)(*((p) + 5)))) << 40) + ((((UINT64)(*((p) + 6)))) << 48) + ((((UINT64)(*((p) + 7)))) << 56)); (p) += 8;}
+#define STREAM_TO_UINT64(u64, p) {(u64) = (((uint64_t)(*(p))) + ((((uint64_t)(*((p) + 1)))) << 8) + ((((uint64_t)(*((p) + 2)))) << 16) + ((((uint64_t)(*((p) + 3)))) << 24) \
+                                  + ((((uint64_t)(*((p) + 4)))) << 32) + ((((uint64_t)(*((p) + 5)))) << 40) + ((((uint64_t)(*((p) + 6)))) << 48) + ((((uint64_t)(*((p) + 7)))) << 56)); (p) += 8;}
 
-static const UINT16  dis_attr_uuid[DIS_MAX_CHAR_NUM] =
+static const uint16_t dis_attr_uuid[DIS_MAX_CHAR_NUM] =
 {
     GATT_UUID_SYSTEM_ID,
     GATT_UUID_MODEL_NUMBER_STR,
@@ -58,7 +58,7 @@
 
 tDIS_CB dis_cb;
 
-static tDIS_ATTR_MASK dis_uuid_to_attr(UINT16 uuid)
+static tDIS_ATTR_MASK dis_uuid_to_attr(uint16_t uuid)
 {
     switch (uuid)
     {
@@ -90,19 +90,19 @@
 **
 **   validate a handle to be a DIS attribute handle or not.
 *******************************************************************************/
-BOOLEAN dis_valid_handle_range(UINT16 handle)
+bool    dis_valid_handle_range(uint16_t handle)
 {
     if (handle >= dis_cb.service_handle && handle <= dis_cb.max_handle)
-        return TRUE;
+        return true;
     else
-        return FALSE;
+        return false;
 }
 /*******************************************************************************
 **   dis_write_attr_value
 **
 **   Process write DIS attribute request.
 *******************************************************************************/
-UINT8 dis_write_attr_value(tGATT_WRITE_REQ * p_data, tGATT_STATUS *p_status)
+uint8_t dis_write_attr_value(tGATT_WRITE_REQ * p_data, tGATT_STATUS *p_status)
 {
     UNUSED(p_data);
 
@@ -112,13 +112,13 @@
 /*******************************************************************************
 **   DIS Attributes Database Server Request callback
 *******************************************************************************/
-UINT8 dis_read_attr_value (UINT8 clcb_idx, UINT16 handle, tGATT_VALUE *p_value,
-                           BOOLEAN is_long, tGATT_STATUS *p_status)
+uint8_t dis_read_attr_value (uint8_t clcb_idx, uint16_t handle, tGATT_VALUE *p_value,
+                           bool    is_long, tGATT_STATUS *p_status)
 {
     tDIS_DB_ENTRY   *p_db_attr = dis_cb.dis_attr;
-    UINT8           *p = p_value->value, i, *pp;
-    UINT16          offset = p_value->offset;
-    UINT8           act = SRVC_ACT_RSP;
+    uint8_t         *p = p_value->value, i, *pp;
+    uint16_t        offset = p_value->offset;
+    uint8_t         act = SRVC_ACT_RSP;
     tGATT_STATUS    st = GATT_NOT_FOUND;
     UNUSED(clcb_idx);
 
@@ -127,7 +127,7 @@
         if (handle == p_db_attr->handle)
         {
             if ((p_db_attr->uuid == GATT_UUID_PNP_ID || p_db_attr->uuid == GATT_UUID_SYSTEM_ID)&&
-                is_long == TRUE)
+                is_long == true)
             {
                 st = GATT_NOT_LONG;
                 break;
@@ -149,7 +149,7 @@
                         if (strlen ((char *)pp) > GATT_MAX_ATTR_LEN)
                             p_value->len = GATT_MAX_ATTR_LEN;
                         else
-                            p_value->len = (UINT16)strlen ((char *)pp);
+                            p_value->len = (uint16_t)strlen ((char *)pp);
                     }
                     else
                         p_value->len = 0;
@@ -169,7 +169,7 @@
                     break;
 
                 case GATT_UUID_SYSTEM_ID:
-                    UINT64_TO_STREAM(p, dis_cb.dis_value.system_id); /* int_min */
+                    uint64_t_TO_STREAM(p, dis_cb.dis_value.system_id); /* int_min */
                     p_value->len = DIS_SYSTEM_ID_SIZE;
                     break;
 
@@ -198,7 +198,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void dis_gatt_c_read_dis_value_cmpl(UINT16 conn_id)
+static void dis_gatt_c_read_dis_value_cmpl(uint16_t conn_id)
 {
     tSRVC_CLCB *p_clcb = srvc_eng_find_clcb_by_conn_id(conn_id);
 
@@ -225,7 +225,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN dis_gatt_c_read_dis_req(UINT16 conn_id)
+bool    dis_gatt_c_read_dis_req(uint16_t conn_id)
 {
     tGATT_READ_PARAM   param;
 
@@ -244,7 +244,7 @@
              param.service.uuid.uu.uuid16 = dis_attr_uuid[dis_cb.dis_read_uuid_idx];
 
              if (GATTC_Read(conn_id, GATT_READ_BY_TYPE, &param) == GATT_SUCCESS)
-                 return TRUE;
+                 return true;
 
             GATT_TRACE_ERROR ("Read DISInfo: 0x%04x GATT_Read Failed", param.service.uuid.uu.uuid16);
         }
@@ -254,7 +254,7 @@
 
     dis_gatt_c_read_dis_value_cmpl(conn_id);
 
-    return(FALSE);
+    return(false);
 }
 
 /*******************************************************************************
@@ -269,9 +269,9 @@
 void dis_c_cmpl_cback (tSRVC_CLCB *p_clcb, tGATTC_OPTYPE op,
                               tGATT_STATUS status, tGATT_CL_COMPLETE *p_data)
 {
-    UINT16      read_type = dis_attr_uuid[dis_cb.dis_read_uuid_idx];
-    UINT8       *pp = NULL, *p_str;
-    UINT16      conn_id = p_clcb->conn_id;
+    uint16_t    read_type = dis_attr_uuid[dis_cb.dis_read_uuid_idx];
+    uint8_t     *pp = NULL, *p_str;
+    uint16_t    conn_id = p_clcb->conn_id;
 
     GATT_TRACE_EVENT ("dis_c_cmpl_cback() - op_code: 0x%02x  status: 0x%02x  \
                         read_type: 0x%04x", op, status, read_type);
@@ -315,7 +315,7 @@
             case GATT_UUID_IEEE_DATA:
                 p_str = p_clcb->dis_value.data_string[read_type - GATT_UUID_MODEL_NUMBER_STR];
                 osi_free(p_str);
-                p_str = (UINT8 *)osi_malloc(p_data->att_value.len + 1);
+                p_str = (uint8_t *)osi_malloc(p_data->att_value.len + 1);
                 p_clcb->dis_value.attr_mask |= dis_uuid_to_attr(read_type);
                 memcpy(p_str, p_data->att_value.value, p_data->att_value.len);
                 p_str[p_data->att_value.len] = 0;
@@ -390,7 +390,7 @@
             dis_cb.dis_attr[i].uuid, dis_cb.dis_attr[i].handle);
     }
 
-    dis_cb.enabled = TRUE;
+    dis_cb.enabled = true;
     return (tDIS_STATUS) status;
 }
 /*******************************************************************************
@@ -402,7 +402,7 @@
 *******************************************************************************/
 tDIS_STATUS DIS_SrUpdate(tDIS_ATTR_BIT dis_attr_bit, tDIS_ATTR *p_info)
 {
-    UINT8           i = 1;
+    uint8_t         i = 1;
     tDIS_STATUS     st = DIS_SUCCESS;
 
     if (dis_attr_bit & DIS_ATTR_SYS_ID_BIT)
@@ -422,14 +422,14 @@
 
         while (dis_attr_bit && i < (DIS_MAX_CHAR_NUM -1 ))
         {
-            if (dis_attr_bit & (UINT16)(1 << i))
+            if (dis_attr_bit & (uint16_t)(1 << i))
             {
                 osi_free(dis_cb.dis_value.data_string[i - 1]);
 /* coverity[OVERRUN-STATIC] False-positive : when i = 8, (1 << i) == DIS_ATTR_PNP_ID_BIT, and it will never come down here
 CID 49902: Out-of-bounds read (OVERRUN_STATIC)
 Overrunning static array "dis_cb.dis_value.data_string", with 7 elements, at position 7 with index variable "i".
 */
-                dis_cb.dis_value.data_string[i - 1] = (UINT8 *)osi_malloc(p_info->data_str.len + 1);
+                dis_cb.dis_value.data_string[i - 1] = (uint8_t *)osi_malloc(p_info->data_str.len + 1);
                 memcpy(dis_cb.dis_value.data_string[i - 1], p_info->data_str.p_data, p_info->data_str.len);
                 dis_cb.dis_value.data_string[i - 1][p_info->data_str.len] = 0; /* make sure null terminate */
                 st = DIS_SUCCESS;
@@ -450,19 +450,19 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN DIS_ReadDISInfo(BD_ADDR peer_bda, tDIS_READ_CBACK *p_cback, tDIS_ATTR_MASK mask)
+bool    DIS_ReadDISInfo(BD_ADDR peer_bda, tDIS_READ_CBACK *p_cback, tDIS_ATTR_MASK mask)
 {
-    UINT16             conn_id;
+    uint16_t           conn_id;
 
     /* Initialize the DIS client if it hasn't been initialized already. */
     srvc_eng_init();
 
     /* For now we only handle one at a time */
     if (dis_cb.dis_read_uuid_idx != 0xff)
-        return(FALSE);
+        return(false);
 
     if (p_cback == NULL)
-        return(FALSE);
+        return(false);
 
     dis_cb.p_read_dis_cback = p_cback;
     /* Mark currently active operation */
@@ -481,7 +481,7 @@
 
     if (conn_id == GATT_INVALID_CONN_ID)
     {
-        return GATT_Connect(srvc_eng_cb.gatt_if, peer_bda, TRUE, BT_TRANSPORT_LE);
+        return GATT_Connect(srvc_eng_cb.gatt_if, peer_bda, true, BT_TRANSPORT_LE);
     }
 
     return dis_gatt_c_read_dis_req(conn_id);
diff --git a/stack/srvc/srvc_dis_int.h b/stack/srvc/srvc_dis_int.h
index b34855e..c4a9fcd 100644
--- a/stack/srvc/srvc_dis_int.h
+++ b/stack/srvc/srvc_dis_int.h
@@ -32,8 +32,8 @@
 
 typedef struct
 {
-    UINT16      uuid;
-    UINT16      handle;
+    uint16_t    uuid;
+    uint16_t    handle;
 }tDIS_DB_ENTRY;
 
 #define DIS_SYSTEM_ID_SIZE      8
@@ -46,28 +46,28 @@
 
     tDIS_READ_CBACK         *p_read_dis_cback;
 
-    UINT16                  service_handle;
-    UINT16                  max_handle;
+    uint16_t                service_handle;
+    uint16_t                max_handle;
 
-    BOOLEAN                 enabled;
+    bool                    enabled;
 
-    UINT8                   dis_read_uuid_idx;
+    uint8_t                 dis_read_uuid_idx;
 
     tDIS_ATTR_MASK          request_mask;
 }tDIS_CB;
 
 /* Global GATT data */
-#if GATT_DYNAMIC_MEMORY == FALSE
+#if (GATT_DYNAMIC_MEMORY == FALSE)
 extern tDIS_CB dis_cb;
 #else
 extern tDIS_CB *dis_cb_ptr;
 #define dis_cb (*dis_cb_ptr)
 #endif
 
-extern BOOLEAN dis_valid_handle_range(UINT16 handle);
-extern UINT8 dis_read_attr_value (UINT8 clcb_idx, UINT16 handle, tGATT_VALUE *p_value,
-                           BOOLEAN is_long, tGATT_STATUS *p_status);
-extern UINT8 dis_write_attr_value(tGATT_WRITE_REQ * p_data, tGATT_STATUS *p_status);
+extern bool    dis_valid_handle_range(uint16_t handle);
+extern uint8_t dis_read_attr_value (uint8_t clcb_idx, uint16_t handle, tGATT_VALUE *p_value,
+                           bool    is_long, tGATT_STATUS *p_status);
+extern uint8_t dis_write_attr_value(tGATT_WRITE_REQ * p_data, tGATT_STATUS *p_status);
 
 extern void dis_c_cmpl_cback (tSRVC_CLCB *p_clcb, tGATTC_OPTYPE op,
                                     tGATT_STATUS status, tGATT_CL_COMPLETE *p_data);
diff --git a/stack/srvc/srvc_eng.c b/stack/srvc/srvc_eng.c
index 6ded138..5d95fc3 100644
--- a/stack/srvc/srvc_eng.c
+++ b/stack/srvc/srvc_eng.c
@@ -23,17 +23,15 @@
 #include "osi/include/osi.h"
 #include "srvc_eng_int.h"
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
 
-//#if DIS_INCLUDED == TRUE
 #include "srvc_dis_int.h"
-//#endif
 #include "srvc_battery_int.h"
 
-static void srvc_eng_s_request_cback (UINT16 conn_id, UINT32 trans_id, UINT8 op_code, tGATTS_DATA *p_data);
-static void srvc_eng_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id, BOOLEAN connected,
+static void srvc_eng_s_request_cback (uint16_t conn_id, uint32_t trans_id, uint8_t op_code, tGATTS_DATA *p_data);
+static void srvc_eng_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, uint16_t conn_id, bool    connected,
                                           tGATT_DISCONN_REASON reason, tBT_TRANSPORT transport);
-static void srvc_eng_c_cmpl_cback (UINT16 conn_id, tGATTC_OPTYPE op, tGATT_STATUS status, tGATT_CL_COMPLETE *p_data);
+static void srvc_eng_c_cmpl_cback (uint16_t conn_id, tGATTC_OPTYPE op, tGATT_STATUS status, tGATT_CL_COMPLETE *p_data);
 
 static tGATT_CBACK srvc_gatt_cback =
 {
@@ -65,9 +63,9 @@
 ** Returns          total number of clcb found.
 **
 *******************************************************************************/
-UINT16 srvc_eng_find_conn_id_by_bd_addr(BD_ADDR bda)
+uint16_t srvc_eng_find_conn_id_by_bd_addr(BD_ADDR bda)
 {
-    UINT8 i_clcb;
+    uint8_t i_clcb;
     tSRVC_CLCB    *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= srvc_eng_cb.clcb; i_clcb < SRVC_MAX_APPS; i_clcb++, p_clcb++)
@@ -92,7 +90,7 @@
 *******************************************************************************/
 tSRVC_CLCB *srvc_eng_find_clcb_by_bd_addr(BD_ADDR bda)
 {
-    UINT8 i_clcb;
+    uint8_t i_clcb;
     tSRVC_CLCB    *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= srvc_eng_cb.clcb; i_clcb < SRVC_MAX_APPS; i_clcb++, p_clcb++)
@@ -114,9 +112,9 @@
 ** Returns          Pointer to the found link conenction control block.
 **
 *******************************************************************************/
-tSRVC_CLCB *srvc_eng_find_clcb_by_conn_id(UINT16 conn_id)
+tSRVC_CLCB *srvc_eng_find_clcb_by_conn_id(uint16_t conn_id)
 {
-    UINT8 i_clcb;
+    uint8_t i_clcb;
     tSRVC_CLCB    *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= srvc_eng_cb.clcb; i_clcb < SRVC_MAX_APPS; i_clcb++, p_clcb++)
@@ -138,9 +136,9 @@
 ** Returns          Pointer to the found link conenction control block.
 **
 *******************************************************************************/
-UINT8 srvc_eng_find_clcb_idx_by_conn_id(UINT16 conn_id)
+uint8_t srvc_eng_find_clcb_idx_by_conn_id(uint16_t conn_id)
 {
-    UINT8 i_clcb;
+    uint8_t i_clcb;
     tSRVC_CLCB    *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= srvc_eng_cb.clcb; i_clcb < SRVC_MAX_APPS; i_clcb++, p_clcb++)
@@ -162,18 +160,18 @@
 ** Returns           NULL if not found. Otherwise pointer to the connection link block.
 **
 *******************************************************************************/
-tSRVC_CLCB *srvc_eng_clcb_alloc (UINT16 conn_id, BD_ADDR bda)
+tSRVC_CLCB *srvc_eng_clcb_alloc (uint16_t conn_id, BD_ADDR bda)
 {
-    UINT8                   i_clcb = 0;
+    uint8_t                 i_clcb = 0;
     tSRVC_CLCB      *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= srvc_eng_cb.clcb; i_clcb < SRVC_MAX_APPS; i_clcb++, p_clcb++)
     {
         if (!p_clcb->in_use)
         {
-            p_clcb->in_use      = TRUE;
+            p_clcb->in_use      = true;
             p_clcb->conn_id     = conn_id;
-            p_clcb->connected   = TRUE;
+            p_clcb->connected   = true;
             memcpy (p_clcb->bda, bda, BD_ADDR_LEN);
             break;
         }
@@ -189,9 +187,9 @@
 ** Returns           True the deallocation is successful
 **
 *******************************************************************************/
-BOOLEAN srvc_eng_clcb_dealloc (UINT16 conn_id)
+bool    srvc_eng_clcb_dealloc (uint16_t conn_id)
 {
-    UINT8                   i_clcb = 0;
+    uint8_t                 i_clcb = 0;
     tSRVC_CLCB      *p_clcb = NULL;
 
     for (i_clcb = 0, p_clcb= srvc_eng_cb.clcb; i_clcb < SRVC_MAX_APPS; i_clcb++, p_clcb++)
@@ -203,18 +201,18 @@
                 osi_free(p_clcb->dis_value.data_string[j]);
 
             memset(p_clcb, 0, sizeof(tSRVC_CLCB));
-            return TRUE;
+            return true;
         }
     }
-    return FALSE;
+    return false;
 }
 /*******************************************************************************
 **   Service Engine Server Attributes Database Read/Read Blob Request process
 *******************************************************************************/
-UINT8 srvc_eng_process_read_req (UINT8 clcb_idx, tGATT_READ_REQ *p_data, tGATTS_RSP *p_rsp, tGATT_STATUS *p_status)
+uint8_t srvc_eng_process_read_req (uint8_t clcb_idx, tGATT_READ_REQ *p_data, tGATTS_RSP *p_rsp, tGATT_STATUS *p_status)
 {
     tGATT_STATUS    status = GATT_NOT_FOUND;
-    UINT8       act = SRVC_ACT_RSP;
+    uint8_t     act = SRVC_ACT_RSP;
 
     if (p_data->is_long)
         p_rsp->attr_value.offset = p_data->offset;
@@ -234,9 +232,9 @@
 /*******************************************************************************
 **   Service Engine Server Attributes Database write Request process
 *******************************************************************************/
-UINT8 srvc_eng_process_write_req (UINT8 clcb_idx, tGATT_WRITE_REQ *p_data, tGATTS_RSP *p_rsp, tGATT_STATUS *p_status)
+uint8_t srvc_eng_process_write_req (uint8_t clcb_idx, tGATT_WRITE_REQ *p_data, tGATTS_RSP *p_rsp, tGATT_STATUS *p_status)
 {
-    UINT8       act = SRVC_ACT_RSP;
+    uint8_t     act = SRVC_ACT_RSP;
     UNUSED(p_rsp);
 
     if (dis_valid_handle_range(p_data->handle))
@@ -262,13 +260,13 @@
 ** Returns          void.
 **
 *******************************************************************************/
-static void srvc_eng_s_request_cback (UINT16 conn_id, UINT32 trans_id, tGATTS_REQ_TYPE type,
+static void srvc_eng_s_request_cback (uint16_t conn_id, uint32_t trans_id, tGATTS_REQ_TYPE type,
                                         tGATTS_DATA *p_data)
 {
-    UINT8       status = GATT_INVALID_PDU;
+    uint8_t     status = GATT_INVALID_PDU;
     tGATTS_RSP  rsp_msg ;
-    UINT8       act = SRVC_ACT_IGNORE;
-    UINT8   clcb_idx = srvc_eng_find_clcb_idx_by_conn_id(conn_id);
+    uint8_t     act = SRVC_ACT_IGNORE;
+    uint8_t clcb_idx = srvc_eng_find_clcb_idx_by_conn_id(conn_id);
 
     GATT_TRACE_EVENT("srvc_eng_s_request_cback : recv type (0x%02x)", type);
 
@@ -321,7 +319,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void srvc_eng_c_cmpl_cback (UINT16 conn_id, tGATTC_OPTYPE op, tGATT_STATUS status,
+static void srvc_eng_c_cmpl_cback (uint16_t conn_id, tGATTC_OPTYPE op, tGATT_STATUS status,
                                    tGATT_CL_COMPLETE *p_data)
 {
     tSRVC_CLCB   *p_clcb = srvc_eng_find_clcb_by_conn_id(conn_id);
@@ -349,8 +347,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void srvc_eng_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
-                                        BOOLEAN connected, tGATT_DISCONN_REASON reason,  tBT_TRANSPORT transport)
+static void srvc_eng_connect_cback (tGATT_IF gatt_if, BD_ADDR bda, uint16_t conn_id,
+                                        bool    connected, tGATT_DISCONN_REASON reason,  tBT_TRANSPORT transport)
 {
     UNUSED(gatt_if);
     UNUSED (transport);
@@ -382,9 +380,9 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN srvc_eng_request_channel (BD_ADDR remote_bda, UINT8 srvc_id )
+bool    srvc_eng_request_channel (BD_ADDR remote_bda, uint8_t srvc_id )
 {
-    BOOLEAN set = TRUE;
+    bool    set = true;
     tSRVC_CLCB  *p_clcb = srvc_eng_find_clcb_by_bd_addr(remote_bda);
 
     if (p_clcb == NULL)
@@ -393,7 +391,7 @@
     if (p_clcb && p_clcb->cur_srvc_id == SRVC_ID_NONE)
         p_clcb->cur_srvc_id = srvc_id;
     else
-        set = FALSE;
+        set = false;
 
     return set;
 }
@@ -406,13 +404,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void srvc_eng_release_channel (UINT16 conn_id)
+void srvc_eng_release_channel (uint16_t conn_id)
 {
     tSRVC_CLCB *p_clcb =  srvc_eng_find_clcb_by_conn_id(conn_id);
 
     if (p_clcb == NULL)
     {
-        GATT_TRACE_ERROR("%s: invalid connection id %d", __FUNCTION__, conn_id);
+        GATT_TRACE_ERROR("%s: invalid connection id %d", __func__, conn_id);
         return;
     }
 
@@ -446,15 +444,13 @@
 
         GATT_TRACE_DEBUG ("Srvc_Init:  gatt_if=%d  ", srvc_eng_cb.gatt_if);
 
-        srvc_eng_cb.enabled = TRUE;
-//#if DIS_INCLUDED == TRUE
+        srvc_eng_cb.enabled = true;
         dis_cb.dis_read_uuid_idx = 0xff;
-//#endif
     }
     return GATT_SUCCESS;
 }
 
-void srvc_sr_rsp(UINT8 clcb_idx, tGATT_STATUS st, tGATTS_RSP *p_rsp)
+void srvc_sr_rsp(uint8_t clcb_idx, tGATT_STATUS st, tGATTS_RSP *p_rsp)
 {
     if (srvc_eng_cb.clcb[clcb_idx].trans_id != 0)
     {
@@ -466,9 +462,9 @@
         srvc_eng_cb.clcb[clcb_idx].trans_id = 0;
     }
 }
-void srvc_sr_notify(BD_ADDR remote_bda, UINT16 handle, UINT16 len, UINT8 *p_value)
+void srvc_sr_notify(BD_ADDR remote_bda, uint16_t handle, uint16_t len, uint8_t *p_value)
 {
-    UINT16 conn_id = srvc_eng_find_conn_id_by_bd_addr(remote_bda);
+    uint16_t conn_id = srvc_eng_find_conn_id_by_bd_addr(remote_bda);
 
     if (conn_id != GATT_INVALID_CONN_ID)
     {
diff --git a/stack/srvc/srvc_eng_int.h b/stack/srvc/srvc_eng_int.h
index 9bb24ff..3586f2b 100644
--- a/stack/srvc/srvc_eng_int.h
+++ b/stack/srvc/srvc_eng_int.h
@@ -39,12 +39,12 @@
 
 typedef struct
 {
-    BOOLEAN         in_use;
-    UINT16          conn_id;
-    BOOLEAN         connected;
+    bool            in_use;
+    uint16_t        conn_id;
+    bool            connected;
     BD_ADDR         bda;
-    UINT32          trans_id;
-    UINT8           cur_srvc_id;
+    uint32_t        trans_id;
+    uint8_t         cur_srvc_id;
 
     tDIS_VALUE      dis_value;
 
@@ -56,12 +56,12 @@
 {
     tSRVC_CLCB              clcb[SRVC_MAX_APPS]; /* connection link*/
     tGATT_IF                gatt_if;
-    BOOLEAN                 enabled;
+    bool                    enabled;
 
 }tSRVC_ENG_CB;
 
 /* Global GATT data */
-#if GATT_DYNAMIC_MEMORY == FALSE
+#if (GATT_DYNAMIC_MEMORY == FALSE)
 extern tSRVC_ENG_CB srvc_eng_cb;
 #else
 extern tSRVC_ENG_CB srvc_eng_cb_ptr;
@@ -69,15 +69,15 @@
 
 #endif
 
-extern tSRVC_CLCB *srvc_eng_find_clcb_by_conn_id(UINT16 conn_id);
+extern tSRVC_CLCB *srvc_eng_find_clcb_by_conn_id(uint16_t conn_id);
 extern tSRVC_CLCB *srvc_eng_find_clcb_by_bd_addr(BD_ADDR bda);
-extern UINT16 srvc_eng_find_conn_id_by_bd_addr(BD_ADDR bda);
+extern uint16_t srvc_eng_find_conn_id_by_bd_addr(BD_ADDR bda);
 
 
-extern void srvc_eng_release_channel (UINT16 conn_id) ;
-extern BOOLEAN srvc_eng_request_channel (BD_ADDR remote_bda, UINT8 srvc_id );
-extern void srvc_sr_rsp(UINT8 clcb_idx, tGATT_STATUS st, tGATTS_RSP *p_rsp);
-extern void srvc_sr_notify(BD_ADDR remote_bda, UINT16 handle, UINT16 len, UINT8 *p_value);
+extern void srvc_eng_release_channel (uint16_t conn_id) ;
+extern bool    srvc_eng_request_channel (BD_ADDR remote_bda, uint8_t srvc_id );
+extern void srvc_sr_rsp(uint8_t clcb_idx, tGATT_STATUS st, tGATTS_RSP *p_rsp);
+extern void srvc_sr_notify(BD_ADDR remote_bda, uint16_t handle, uint16_t len, uint8_t *p_value);
 
 
 #ifdef __cplusplus