Allow HAL side to configure nfa_ee_max_ee_cfg.

Upgrade stack to allow JNI to control whether
to enable stack's secure element features.

Change-Id: Id4162d0a97a031fb1a0625f64faef90091282b3f
diff --git a/halimpl/bcm2079x/adaptation/patchram.cpp b/halimpl/bcm2079x/adaptation/patchram.cpp
old mode 100755
new mode 100644
index 2363292..7b693ca
--- a/halimpl/bcm2079x/adaptation/patchram.cpp
+++ b/halimpl/bcm2079x/adaptation/patchram.cpp
@@ -78,9 +78,6 @@
 
     /* Default tNFC_HAL_DEV_INIT_CFG (flags, num_xtal_cfg, {brcm_hw_id, xtal-freq, xtal-index} ) */
     {
-#if (NFC_BRCM_NOT_OPEN_INCLUDED == TRUE)
-        0,
-#endif
         2, /* number of valid entries */
         {
             {0x43341000, 37400, NFC_HAL_XTAL_INDEX_37400},      // All revisions of 43341 use 37,400
diff --git a/halimpl/bcm2079x/hal/hal/nfc_hal_api.c b/halimpl/bcm2079x/hal/hal/nfc_hal_api.c
index 2cd95b2..896234b 100644
--- a/halimpl/bcm2079x/hal/hal/nfc_hal_api.c
+++ b/halimpl/bcm2079x/hal/hal/nfc_hal_api.c
@@ -308,4 +308,19 @@
     }
 }
 
+/*******************************************************************************
+**
+** Function         HAL_NfcGetMaxNfcee
+**
+** Description      Retrieve the maximum number of NFCEEs supported by NFCC
+**
+** Returns          the maximum number of NFCEEs supported by NFCC
+**
+*******************************************************************************/
+UINT8 HAL_NfcGetMaxNfcee (void)
+{
+    HAL_TRACE_API1 ("HAL_NfcGetMaxNfcee: %d",nfc_hal_cb.max_ee);
+    return nfc_hal_cb.max_ee;
+}
+
 
diff --git a/src/hal/include/nfc_hal_api.h b/src/hal/include/nfc_hal_api.h
index f73873b..ab12efb 100644
--- a/src/hal/include/nfc_hal_api.h
+++ b/src/hal/include/nfc_hal_api.h
@@ -90,6 +90,7 @@
 typedef BOOLEAN (tHAL_API_PREDISCOVER) (void);
 typedef void (tHAL_API_CONTROL_GRANTED) (void);
 typedef void (tHAL_API_POWER_CYCLE) (void);
+typedef UINT8 (tHAL_API_GET_MAX_NFCEE) (void);
 
 
 /* data members for NFC_HAL-HCI */
@@ -112,6 +113,7 @@
     tHAL_API_PREDISCOVER *prediscover;
     tHAL_API_CONTROL_GRANTED *control_granted;
     tHAL_API_POWER_CYCLE *power_cycle;
+    tHAL_API_GET_MAX_NFCEE *get_max_ee;
 
 
 } tHAL_NFC_ENTRY;
@@ -257,6 +259,17 @@
 *******************************************************************************/
 EXPORT_HAL_API void HAL_NfcPowerCycle (void);
 
+/*******************************************************************************
+**
+** Function         HAL_NfcGetMaxNfcee
+**
+** Description      Retrieve the maximum number of NFCEEs supported by NFCC
+**
+** Returns          the maximum number of NFCEEs supported by NFCC
+**
+*******************************************************************************/
+EXPORT_HAL_API UINT8 HAL_NfcGetMaxNfcee (void);
+
 
 #ifdef __cplusplus
 }
diff --git a/src/hal/int/nfc_hal_int.h b/src/hal/int/nfc_hal_int.h
index 4f72eff..f4b6df4 100644
--- a/src/hal/int/nfc_hal_int.h
+++ b/src/hal/int/nfc_hal_int.h
@@ -425,6 +425,7 @@
     UINT8                   pre_discover_done;  /* TRUE, when the prediscover config is complete */
 
     UINT8                   max_rf_credits;     /* NFC Max RF data credits */
+    UINT8                   max_ee;             /* NFC Max number of NFCEE supported by NFCC */
     UINT8                   trace_level;        /* NFC HAL trace level */
 } tNFC_HAL_CB;
 
diff --git a/src/nfa/dm/nfa_dm_act.c b/src/nfa/dm/nfa_dm_act.c
index bdaec3a..9af6117 100644
--- a/src/nfa/dm/nfa_dm_act.c
+++ b/src/nfa/dm/nfa_dm_act.c
@@ -250,6 +250,7 @@
     tNFA_GET_CONFIG   *p_nfa_get_confg;
     tNFA_CONN_EVT_DATA conn_evt;
     UINT8 dm_cback_evt;
+    UINT8 max_ee = 0;
 
 #if (BT_TRACE_VERBOSE == TRUE)
     NFA_TRACE_DEBUG2 ("nfa_dm_nfc_response_cback () %s(0x%x)", nfa_dm_nfc_revt_2_str (event), event);
@@ -264,6 +265,17 @@
         /* NFC stack enabled. Enable nfa sub-systems */
         if (p_data->enable.status == NFC_STATUS_OK)
         {
+            if (nfa_ee_max_ee_cfg != 0)
+            {
+                if (nfa_dm_cb.get_max_ee)
+                {
+                    max_ee = nfa_dm_cb.get_max_ee ();
+                    if (max_ee)
+                    {
+                        nfa_ee_max_ee_cfg = max_ee;
+                    }
+                }
+            }
             /* Initialize NFA subsystems */
             nfa_sys_enable_subsystems ();
         }
diff --git a/src/nfa/dm/nfa_dm_api.c b/src/nfa/dm/nfa_dm_api.c
index 9fce1ef..4d65e4a 100644
--- a/src/nfa/dm/nfa_dm_api.c
+++ b/src/nfa/dm/nfa_dm_api.c
@@ -63,6 +63,7 @@
     nfa_ce_init();
     if (nfa_ee_max_ee_cfg != 0)
     {
+        nfa_dm_cb.get_max_ee    = p_hal_entry_tbl->get_max_ee;
         nfa_ee_init();
         nfa_hci_init();
     }
diff --git a/src/nfa/int/nfa_dm_int.h b/src/nfa/int/nfa_dm_int.h
index 8a002ca..09d6118 100644
--- a/src/nfa/int/nfa_dm_int.h
+++ b/src/nfa/int/nfa_dm_int.h
@@ -471,6 +471,7 @@
     tNFA_HANDLE                 poll_disc_handle;   /* discovery handle for polling         */
 
     UINT8                      *p_activate_ntf;     /* temp holding activation notfication  */
+    tHAL_API_GET_MAX_NFCEE     *get_max_ee;
 
     tNFC_RF_TECH_N_MODE         activated_tech_mode;/* previous activated technology and mode */
     UINT8                       activated_nfcid[NFC_KOVIO_MAX_LEN]; /* NFCID 0/1/2 or UID of ISO15694/Kovio  */