Initial version of BLE support for Bluedroid

Change-Id: I9825a5cef9be2559c34c2a529b211b7d471147cf
diff --git a/include/bt_target.h b/include/bt_target.h
old mode 100755
new mode 100644
index 836868e..98968f5
--- a/include/bt_target.h
+++ b/include/bt_target.h
@@ -260,7 +260,7 @@
 #endif
 
 #ifndef BTA_GATT_INCLUDED
-#define BTA_GATT_INCLUDED FALSE
+#define BTA_GATT_INCLUDED TRUE
 #endif
 
 #ifndef BTA_DISABLE_DELAY
@@ -555,11 +555,6 @@
 #define BTM_CMD_POOL_ID             GKI_POOL_ID_2
 #endif
 
-/* Sends TCS messages. */
-#ifndef TCS_MSG_POOL_ID
-#define TCS_MSG_POOL_ID             GKI_POOL_ID_2
-#endif
-
 #ifndef OBX_CMD_POOL_SIZE
 #define OBX_CMD_POOL_SIZE           GKI_BUF2_SIZE
 #endif
@@ -577,11 +572,6 @@
 #define CTP_SDP_DB_POOL_ID          GKI_POOL_ID_3
 #endif
 
-/* Used for CTP data exchange feature. */
-#ifndef CTP_DATA_EXCHG_POOL_ID
-#define CTP_DATA_EXCHG_POOL_ID      GKI_POOL_ID_2
-#endif
-
 /* Used to send data to L2CAP. */
 #ifndef GAP_DATA_POOL_ID
 #define GAP_DATA_POOL_ID            GKI_POOL_ID_3
@@ -596,24 +586,6 @@
 #define SPP_DB_SIZE                 GKI_BUF3_SIZE
 #endif
 
-/* HCRP protocol and internal commands. */
-#ifndef HCRP_CMD_POOL_ID
-#define HCRP_CMD_POOL_ID            GKI_POOL_ID_2
-#endif
-
-#ifndef HCRP_CMD_POOL_SIZE
-#define HCRP_CMD_POOL_SIZE          GKI_BUF2_SIZE
-#endif
-
-#ifndef BIP_EVT_POOL_SIZE
-#define BIP_EVT_POOL_SIZE           GKI_BUF3_SIZE
-#endif
-
-#ifndef BIP_DB_SIZE
-#define BIP_DB_SIZE                 GKI_BUF3_SIZE
-#endif
-
-
 /* BNEP data and protocol messages. */
 #ifndef BNEP_POOL_ID
 #define BNEP_POOL_ID                GKI_POOL_ID_3
@@ -1245,7 +1217,7 @@
 
 /* The maximum number of simultaneous channels that L2CAP can support. */
 #ifndef MAX_L2CAP_CHANNELS
-#define MAX_L2CAP_CHANNELS          10
+#define MAX_L2CAP_CHANNELS          16
 #endif
 
 /* The maximum number of simultaneous applications that can register with L2CAP. */
@@ -1417,8 +1389,8 @@
 **
 ******************************************************************************/
 
-#ifndef BLE_INCLUDED
-#define BLE_INCLUDED            FALSE
+#ifndef _cac
+#define BLE_INCLUDED            TRUE
 #endif
 
 #ifndef LOCAL_BLE_CONTROLLER_ID
@@ -1431,19 +1403,19 @@
 **
 ******************************************************************************/
 #ifndef ATT_INCLUDED
-#define ATT_INCLUDED         FALSE
+#define ATT_INCLUDED         TRUE
 #endif
 
 #ifndef ATT_DEBUG
-#define ATT_DEBUG           FALSE
+#define ATT_DEBUG           TRUE
 #endif
 
 #ifndef GATT_SERVER_ENABLED
-#define GATT_SERVER_ENABLED          FALSE
+#define GATT_SERVER_ENABLED          TRUE
 #endif
 
 #ifndef GATT_CLIENT_ENABLED
-#define GATT_CLIENT_ENABLED          FALSE
+#define GATT_CLIENT_ENABLED          TRUE
 #endif
 
 #ifndef GATT_MAX_SR_PROFILES
@@ -1479,11 +1451,11 @@
 **
 ******************************************************************************/
 #ifndef SMP_INCLUDED
-#define SMP_INCLUDED         FALSE
+#define SMP_INCLUDED         TRUE
 #endif
 
 #ifndef SMP_DEBUG
-#define SMP_DEBUG            FALSE
+#define SMP_DEBUG            TRUE
 #endif
 
 #ifndef SMP_DEFAULT_AUTH_REQ
@@ -2189,7 +2161,7 @@
 ******************************************************************************/
 
 #ifndef GAP_INCLUDED
-#define GAP_INCLUDED                FALSE
+#define GAP_INCLUDED                TRUE
 #endif
 
 /* This is set to enable use of GAP L2CAP connections. */
@@ -3749,9 +3721,6 @@
 #define L2CAP_FEATURE_RSP_ID     173
 
 
-#define L2CAP_ENHANCED_FEATURES   0
-
-
 /******************************************************************************
 **
 ** BTA
diff --git a/include/bt_trace.h b/include/bt_trace.h
index 6c3e7b1..e6a0b71 100644
--- a/include/bt_trace.h
+++ b/include/bt_trace.h
@@ -4668,6 +4668,28 @@
                                                         (m), (UINT32)(p1), (UINT32)(p2), (UINT32)(p3), (UINT32)(p4), (UINT32)(p5));}
 #define APPL_TRACE_DEBUG6(m,p1,p2,p3,p4,p5,p6)  {if (appl_trace_level >= BT_TRACE_LEVEL_DEBUG) LogMsg_6(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | TRACE_TYPE_DEBUG, \
                                                         (m), (UINT32)(p1), (UINT32)(p2), (UINT32)(p3), (UINT32)(p4), (UINT32)(p5), (UINT32)(p6));}
+
+#define APPL_TRACE_VERBOSE0(m)                    {if (appl_trace_level >= BT_TRACE_LEVEL_VERBOSE)\
+    LogMsg_0(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | TRACE_TYPE_DEBUG, (m));}
+#define APPL_TRACE_VERBOSE1(m,p1)                 {if (appl_trace_level >= BT_TRACE_LEVEL_VERBOSE)\
+    LogMsg_1(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | TRACE_TYPE_DEBUG, (m), \
+    (UINT32)(p1));}
+#define APPL_TRACE_VERBOSE2(m,p1,p2)              {if (appl_trace_level >= BT_TRACE_LEVEL_VERBOSE)\
+    LogMsg_2(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | TRACE_TYPE_DEBUG, (m), \
+    (UINT32)(p1), (UINT32)(p2));}
+#define APPL_TRACE_VERBOSE3(m,p1,p2,p3)           {if (appl_trace_level >= BT_TRACE_LEVEL_VERBOSE)\
+    LogMsg_3(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | TRACE_TYPE_DEBUG, (m), \
+    (UINT32)(p1), (UINT32)(p2), (UINT32)(p3));}
+#define APPL_TRACE_VERBOSE4(m,p1,p2,p3,p4)        {if (appl_trace_level >= BT_TRACE_LEVEL_VERBOSE)\
+    LogMsg_4(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | TRACE_TYPE_DEBUG, (m), \
+    (UINT32)(p1), (UINT32)(p2), (UINT32)(p3), (UINT32)(p4));}
+#define APPL_TRACE_VERBOSE5(m,p1,p2,p3,p4,p5)     {if (appl_trace_level >= BT_TRACE_LEVEL_VERBOSE)\
+    LogMsg_5(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | TRACE_TYPE_DEBUG, (m), \
+    (UINT32)(p1), (UINT32)(p2), (UINT32)(p3), (UINT32)(p4), (UINT32)(p5));}
+#define APPL_TRACE_VERBOSE6(m,p1,p2,p3,p4,p5,p6)  {if (appl_trace_level >= BT_TRACE_LEVEL_VERBOSE)\
+    LogMsg_6(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | TRACE_TYPE_DEBUG, (m), \
+    (UINT32)(p1), (UINT32)(p2), (UINT32)(p3), (UINT32)(p4), (UINT32)(p5), (UINT32)(p6));}
+
 #else
 /* define traces for Application */
 
@@ -4711,6 +4733,14 @@
 #define APPL_TRACE_DEBUG5(m,p1,p2,p3,p4,p5)
 #define APPL_TRACE_DEBUG6(m,p1,p2,p3,p4,p5,p6)
 
+#define APPL_TRACE_VERBOSE0(m)
+#define APPL_TRACE_VERBOSE1(m,p1)
+#define APPL_TRACE_VERBOSE2(m,p1,p2)
+#define APPL_TRACE_VERBOSE3(m,p1,p2,p3)
+#define APPL_TRACE_VERBOSE4(m,p1,p2,p3,p4)
+#define APPL_TRACE_VERBOSE5(m,p1,p2,p3,p4,p5)
+#define APPL_TRACE_VERBOSE6(m,p1,p2,p3,p4,p5,p6)
+
 #endif
 
 #if ((MMI_INCLUDED == TRUE) && (!defined(HID_MSKB_INCLUDED) || (HID_MSKB_INCLUDED == FALSE)))
diff --git a/include/bte.h b/include/bte.h
index 103b660..968b68a 100644
--- a/include/bte.h
+++ b/include/bte.h
@@ -100,9 +100,12 @@
 /* Protocol trace mask */
 extern UINT32 bte_proto_trace_mask;
 
-/* Version string */
+/* BTE version string */
 extern const UINT8 bte_version_string[];
 
+/* BTIF version string */
+extern const UINT8 btif_version_string[];
+
 typedef struct tBAUD_REG_tag {
     UINT8 DHBR;
     UINT8 DLBR;
diff --git a/include/bte_appl.h b/include/bte_appl.h
index 63689da..cf0baed 100644
--- a/include/bte_appl.h
+++ b/include/bte_appl.h
@@ -70,25 +70,12 @@
 #define BTE_APPL_CONTACTS_DB_PATH       256
 
 typedef struct {
-    char    patchram_path[BTE_APPL_PATCHRAM_PATH_MAXLEN+1];
-    UINT32  patchram_addr;
-    UINT32  reconfig_baud;
-    UINT32  clock_rate;             /* clock rate (for uart baud calculation) */
-    BD_ADDR local_addr;             /* local bd addr */
-    BD_ADDR rem_addr;
-    UINT8   lpm_enabled;
-    UINT8   bt_wake_polarity;
-    UINT8   host_wake_polarity;
-    BOOLEAN ag_enable_3way_conf;
-    UINT16  ag_voice_settings;
-    UINT8   ag_vsc_pcm_config[5];
-    UINT8   ag_vsc_sco_pcm[5];
-    /*tBTM_CMPL_CB*/ tBTM_DEV_STATUS_CB *p_reset_cplt_cb;  /* Current reset_cplt_cb */
-    char    contacts_db[BTE_APPL_CONTACTS_DB_PATH+1];
-    UINT32  bta_module_state[BTAPP_NUM_ID_BLOCKS]; /* state of enabled bta modules */
-#if (BTAPP_AHF_API_SUPPORT==TRUE)
-    UINT8   afh_first;
-    UINT8   afh_last;
+#if ((BLE_INCLUDED == TRUE) && (SMP_INCLUDED == TRUE))
+    UINT8   ble_auth_req;
+    UINT8   ble_io_cap;
+    UINT8   ble_init_key;
+    UINT8   ble_resp_key;
+    UINT8   ble_max_key_size;
 #endif
 } tBTE_APPL_CFG;