diff options
author | Evan Chu <evanchu@broadcom.com> | 2012-09-18 17:07:13 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-09-18 17:07:13 -0700 |
commit | f0d8db6acc4b186360bbd092de40a3a0c8f8d86f (patch) | |
tree | 8ccf241b72233ec061d32c21541a9f25d52ff0d2 | |
parent | eecb57f35b060bda1b2e1acb709a513d8941b576 (diff) | |
parent | c6cf8e45c27d8a43d09b997cc223e8068d140edd (diff) | |
download | packages_apps_nfc-f0d8db6acc4b186360bbd092de40a3a0c8f8d86f.zip packages_apps_nfc-f0d8db6acc4b186360bbd092de40a3a0c8f8d86f.tar.gz packages_apps_nfc-f0d8db6acc4b186360bbd092de40a3a0c8f8d86f.tar.bz2 |
am c6cf8e45: Integrate NFC Hardware Abstraction Layer.
* commit 'c6cf8e45c27d8a43d09b997cc223e8068d140edd':
Integrate NFC Hardware Abstraction Layer.
-rw-r--r-- | nci/jni/Android.mk | 2 | ||||
-rwxr-xr-x | nci/jni/NativeNfcManager.cpp | 65 | ||||
-rwxr-xr-x | nci/jni/NativeSecureElement.cpp | 1 | ||||
-rwxr-xr-x | nci/jni/PowerSwitch.cpp | 12 | ||||
-rwxr-xr-x | nci/jni/SecureElement.cpp | 2 |
5 files changed, 6 insertions, 76 deletions
diff --git a/nci/jni/Android.mk b/nci/jni/Android.mk index 335e5f1..414f827 100644 --- a/nci/jni/Android.mk +++ b/nci/jni/Android.mk @@ -30,6 +30,8 @@ LOCAL_C_INCLUDES += \ $(NFC)/include \ $(NFC)/brcm \ $(NFC)/int \ + $(VOB_COMPONENTS)/hal/include \ + $(VOB_COMPONENTS)/hal/int \ $(VOB_COMPONENTS)/include \ $(VOB_COMPONENTS)/gki/ulinux \ $(VOB_COMPONENTS)/gki/common diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp index b97a20f..fcab063 100755 --- a/nci/jni/NativeNfcManager.cpp +++ b/nci/jni/NativeNfcManager.cpp @@ -32,17 +32,16 @@ extern "C" { #include "nfa_api.h" #include "nfa_p2p_api.h" - #include "nfa_dta_api.h" #include "rw_api.h" #include "nfa_ee_api.h" - #include "nfa_brcm_api.h" + #include "nfc_brcm_defs.h" #include "nfa_cho_api.h" + #include "ce_api.h" } extern UINT8 *p_nfa_dm_lptd_cfg; extern UINT8 *p_nfa_dm_start_up_cfg; extern const UINT8 nfca_version_string []; -extern "C" void downloadFirmwarePatchFile (UINT32 brcm_hw_id); namespace android { extern bool gIsTagDeactivating; @@ -106,7 +105,6 @@ static SyncEvent sNfaEnableEvent; //event for NFA_Enable() static SyncEvent sNfaDisableEvent; //event for NFA_Disable() static SyncEvent sNfaEnableDisablePollingEvent; //event for NFA_EnablePolling(), NFA_DisablePolling() static SyncEvent sNfaSetConfigEvent; // event for Set_Config.... -static SyncEvent sNfaBuildInfoEvent; static bool sIsNfaEnabled = false; static bool sDiscoveryEnabled = false; //is polling for tag? static bool sIsDisabling = false; @@ -133,7 +131,6 @@ static void nfaConnectionCallback (UINT8 event, tNFA_CONN_EVT_DATA *eventData); static void nfaDeviceManagementCallback (UINT8 event, tNFA_DM_CBACK_DATA *eventData); static bool isPeerToPeer (tNFA_ACTIVATED& activated); static void startRfDiscovery (bool isStart); -static void nfaBrcmInitCallback (UINT32 brcm_hw_id, UINT8 nvm_type); ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// @@ -616,19 +613,6 @@ void nfaDeviceManagementCallback (UINT8 dmEvent, tNFA_DM_CBACK_DATA* eventData) PowerSwitch::getInstance ().deviceManagementCallback (dmEvent, eventData); break; - case NFA_DM_FIRMWARE_BUILD_INFO_EVT: - { - tNFA_BRCM_FW_BUILD_INFO* bldInfo = - (tNFA_BRCM_FW_BUILD_INFO*) eventData->p_vs_evt_data; - if (bldInfo != NULL) { - ALOGE("BCM2079x NFC FW version %d.%d", bldInfo->patch.major_ver, - bldInfo->patch.minor_ver); - } - SyncEventGuard versionGuard (sNfaBuildInfoEvent); - sNfaBuildInfoEvent.notifyOne(); - } - break; - default: ALOGD ("%s: unhandled event", __FUNCTION__); break; @@ -662,24 +646,15 @@ static jboolean nfcManager_doInitialize (JNIEnv* e, jobject o) { unsigned long num = 0; - tBRCM_DEV_INIT_CONFIG devInitConfig; - memset (&devInitConfig, 0, sizeof(devInitConfig)); NfcAdaptation& theInstance = NfcAdaptation::GetInstance(); theInstance.Initialize(); //start GKI, NCI task, NFC task { SyncEventGuard guard (sNfaEnableEvent); - NFA_Init(); - - // Initialize the Crystal Frequency if configured. - if (GetNumValue((char*)NAME_XTAL_FREQUENCY, &devInitConfig.xtal_freq, sizeof(devInitConfig.xtal_freq))) - { - ALOGD("%s: setting XTAL Frequency=%d", __FUNCTION__, devInitConfig.xtal_freq); - devInitConfig.flags |= BRCM_DEV_INIT_FLAGS_SET_XTAL_FREQ; - } + tHAL_NFC_ENTRY* halFuncEntries = theInstance.GetHalEntryFuncs (); - NFA_BrcmInit (&devInitConfig, nfaBrcmInitCallback); + NFA_Init (halFuncEntries); stat = NFA_Enable (nfaDeviceManagementCallback, nfaConnectionCallback); if (stat == NFA_STATUS_OK) @@ -688,7 +663,6 @@ static jboolean nfcManager_doInitialize (JNIEnv* e, jobject o) CE_SetTraceLevel (num); LLCP_SetTraceLevel (num); NFC_SetTraceLevel (num); - NCI_SetTraceLevel (num); RW_SetTraceLevel (num); NFA_SetTraceLevel (num); NFA_ChoSetTraceLevel (num); @@ -703,14 +677,6 @@ static jboolean nfcManager_doInitialize (JNIEnv* e, jobject o) //sIsNfaEnabled indicates whether stack started successfully if (sIsNfaEnabled) { - { - SyncEventGuard versionGuard (sNfaBuildInfoEvent); - stat = NFA_BrcmGetFirmwareBuildInfo(); - if (stat == NFA_STATUS_OK) { - sNfaBuildInfoEvent.wait(); - } - } - SecureElement::getInstance().initialize (getNative(e, o)); nativeNfcTag_registerNdefTypeHandler (); NfcTag::getInstance().initialize (getNative(e, o)); @@ -736,11 +702,6 @@ static jboolean nfcManager_doInitialize (JNIEnv* e, jobject o) if (sOriginalLptdCfg != NULL) p_nfa_dm_lptd_cfg = sOriginalLptdCfg; - - // if this value is not set or set and non-zero, enable multi-technology responses. - if (!GetNumValue(NAME_NFA_DM_MULTI_TECH_RESP, &num, sizeof(num)) || (num != 0)) - NFA_SetMultiTechRsp(TRUE); - // if this value exists, set polling interval. if (GetNumValue(NAME_NFA_DM_DISC_DURATION_POLL, &num, sizeof(num))) NFA_SetRfDiscoveryDuration(num); @@ -1716,23 +1677,5 @@ bool nfcManager_isNfcActive() } -/******************************************************************************* -** -** Function: nfaBrcmInitCallback -** -** Description: Callback function for application to start device initialization. -** When platform-specific initialization is completed, -** NCI_BrcmDevInitDone() must be called to proceed with stack start up. -** -** Returns: None. -** -*******************************************************************************/ -void nfaBrcmInitCallback (UINT32 brcm_hw_id, UINT8 nvm_type) -{ - ALOGD ("%s: enter; brcm_hw_id=0x%lX; nvm_type=0x%X", __FUNCTION__, brcm_hw_id, nvm_type); - downloadFirmwarePatchFile (brcm_hw_id); -} - - } /* namespace android */ diff --git a/nci/jni/NativeSecureElement.cpp b/nci/jni/NativeSecureElement.cpp index 7054b26..9fa27e3 100755 --- a/nci/jni/NativeSecureElement.cpp +++ b/nci/jni/NativeSecureElement.cpp @@ -17,7 +17,6 @@ #include "OverrideLog.h" #include "SecureElement.h" #include "JavaClassConstants.h" -#include "nfa_brcm_api.h" namespace android diff --git a/nci/jni/PowerSwitch.cpp b/nci/jni/PowerSwitch.cpp index ba1a96b..11d1abe 100755 --- a/nci/jni/PowerSwitch.cpp +++ b/nci/jni/PowerSwitch.cpp @@ -13,7 +13,6 @@ #include "NfcJniUtil.h" #include "config.h" #include "SecureElement.h" -#include "userial.h" namespace android @@ -226,17 +225,6 @@ bool PowerSwitch::setPowerOffSleepState (bool sleep) { mPowerStateEvent.wait (); mCurrLevel = LOW_POWER; - ALOGD ("%s: wait for userial close", fn); - int count = 0; - while (USERIAL_IsClosed() == FALSE) - { - //must wait for userial to close completely; - //otherwise there is a race condition when the next operation - //wants to go to full-power again; - count++; - usleep (5000); //5 milliseconds = 5 000 microseconds - } - ALOGD ("%s: userial close ok; count=%d", fn, count); } else { diff --git a/nci/jni/SecureElement.cpp b/nci/jni/SecureElement.cpp index 57c33bb..5008998 100755 --- a/nci/jni/SecureElement.cpp +++ b/nci/jni/SecureElement.cpp @@ -16,8 +16,6 @@ #include "config.h" #include "PowerSwitch.h" #include "HostAidRouter.h" -#include "nfa_vs_brcm_api.h" -#include "nfa_brcm_api.h" #include "JavaClassConstants.h" |