diff options
author | Paul Chaisson <chaisson@broadcom.com> | 2013-11-09 00:08:43 -0500 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2014-05-19 13:28:24 -0700 |
commit | eecdc2f8c53010e74fb4953acbed6249580fef97 (patch) | |
tree | 5edc60319b981a9fc7fe6f5a8981617f849a7158 | |
parent | 43ef645f118877526ae57eebe35229eb52492211 (diff) | |
download | libnfc-nci-eecdc2f8c53010e74fb4953acbed6249580fef97.tar.gz |
Only reset first-boot after EE has been initialized.
The original implementation reset the flag anytime we initialized
the HAL (e.g. even to just check/download the firmware). We moved
the reset of the flag to HaiGetMaxNfcee, which will only get called
when the stack is to initialize the EE for the first time.
Change-Id: I2cfbbf30be02fced5f942dae90fd9a1b6cd0bdf1
-rw-r--r-- | halimpl/bcm2079x/adaptation/HalAdaptation.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/halimpl/bcm2079x/adaptation/HalAdaptation.cpp b/halimpl/bcm2079x/adaptation/HalAdaptation.cpp index fbeedc7..5a09874 100644 --- a/halimpl/bcm2079x/adaptation/HalAdaptation.cpp +++ b/halimpl/bcm2079x/adaptation/HalAdaptation.cpp @@ -58,6 +58,8 @@ UINT32 ScrProtocolTraceFlag = SCR_PROTO_TRACE_ALL; //0x017F00; static void BroadcomHalCallback (UINT8 event, tHAL_NFC_STATUS status); static void BroadcomHalDataCallback (UINT16 data_len, UINT8* p_data); +static bool isColdBoot = true; + extern tNFC_HAL_CFG *p_nfc_hal_cfg; extern const UINT8 nfca_version_string []; extern const UINT8 nfa_version_string []; @@ -74,7 +76,6 @@ int HaiInitializeLibrary (const bcm2079x_dev_t* device) unsigned long num = 0; char temp[120]; UINT8 logLevel = 0; - static bool isColdBoot = true; logLevel = InitializeGlobalAppLogLevel (); @@ -183,13 +184,9 @@ int HaiInitializeLibrary (const bcm2079x_dev_t* device) p_nfc_hal_cfg->nfc_hal_hci_uicc_support = 0; } - if (isColdBoot) - { - isColdBoot = false; - p_nfc_hal_cfg->nfc_hal_first_boot = TRUE; - } - else - p_nfc_hal_cfg->nfc_hal_first_boot = FALSE; + // Set 'first boot' flag based on static variable that will get set to false + // after the stack has first initialized the EE. + p_nfc_hal_cfg->nfc_hal_first_boot = isColdBoot ? TRUE : FALSE; HAL_NfcInitialize (); HAL_NfcSetTraceLevel (logLevel); // Initialize HAL's logging level @@ -372,6 +369,10 @@ int HaiGetMaxNfcee (const bcm2079x_dev_t* device, uint8_t* maxNfcee) ALOGD ("%s: enter", __FUNCTION__); int retval = EACCES; + // This function is a clear indication that the stack is initializing + // EE. So we can reset the cold-boot flag here. + isColdBoot = false; + if ( maxNfcee ) { *maxNfcee = HAL_NfcGetMaxNfcee (); |