summaryrefslogtreecommitdiffstats
path: root/src/phHal4Nfc.c
diff options
context:
space:
mode:
authordaniel_Tomas <daniel.tomas@trusted-logic.com>2010-12-09 10:46:12 -0800
committerNick Pelly <npelly@google.com>2010-12-09 12:41:48 -0800
commit5e97605ca8d83414b122bae72e65ea388b66718a (patch)
treee3398ab19408f0ce0dd67c23569a8bce60d4d341 /src/phHal4Nfc.c
parentea7a513aa8474d6b26716b23555f4d77bc030d0e (diff)
downloadexternal_libnfc-nxp-5e97605ca8d83414b122bae72e65ea388b66718a.zip
external_libnfc-nxp-5e97605ca8d83414b122bae72e65ea388b66718a.tar.gz
external_libnfc-nxp-5e97605ca8d83414b122bae72e65ea388b66718a.tar.bz2
Download feature added in the libnfc
Change-Id: Idfed8c90453a0acc7fa632f62a1e20617b4ae7f6
Diffstat (limited to 'src/phHal4Nfc.c')
-rw-r--r--src/phHal4Nfc.c54
1 files changed, 51 insertions, 3 deletions
diff --git a/src/phHal4Nfc.c b/src/phHal4Nfc.c
index e69bb7a..ebd447f 100644
--- a/src/phHal4Nfc.c
+++ b/src/phHal4Nfc.c
@@ -27,17 +27,16 @@
*/
/* ---------------------------Include files ---------------------------------*/
+
#include <phHal4Nfc.h>
#include <phHal4Nfc_Internal.h>
#include <phOsalNfc.h>
#include <phHciNfc.h>
#include <phLlcNfc.h>
#include <phDal4Nfc.h>
-//#include <phDnldNfc.h>
+#include <phDnldNfc.h>
#include <phOsalNfc_Timer.h>
-
-
/* ------------------------------- Macros -----------------------------------*/
#ifndef HAL_UNIT_TEST
#define STATIC static
@@ -79,6 +78,13 @@ static void phHal4Nfc_CloseComplete(
void *pInfo
);
+static void phHal4Nfc_DownloadComplete(
+ void *pContext,
+ void *pHwRef,
+ uint8_t type,
+ void *pInfo
+ );
+
static NFCSTATUS phHal4Nfc_Configure_Layers(
phNfcLayer_sCfg_t **pphLayer
);
@@ -288,6 +294,44 @@ phHal4Nfc_Configure_Layers(
}
+
+#ifdef ANDROID
+
+#define LOG_TAG "NFC-HCI"
+
+#include <utils/Log.h>
+#include <dlfcn.h>
+
+const unsigned char *nxp_nfc_full_version;
+const unsigned char *nxp_nfc_fw;
+
+int dlopen_firmware() {
+ void *p;
+
+ void *handle = dlopen("/system/lib/libpn544_fw.so", RTLD_NOW);
+ if (handle == NULL) {
+ LOGE("Could not open libpn544.so");
+ return -1;
+ }
+
+ p = dlsym(handle, "nxp_nfc_full_version");
+ if (p == NULL) {
+ LOGE("Could not link nxp_nfc_full_version");
+ return -1;
+ }
+ nxp_nfc_full_version = (unsigned char *)p;
+
+ p = dlsym(handle, "nxp_nfc_fw");
+ if (p == NULL) {
+ LOGE("Could not link nxp_nfc_fw");
+ return -1;
+ }
+ nxp_nfc_fw = (unsigned char *)p;
+
+ return 0;
+}
+#endif
+
/**
* The open function called by the upper HAL when HAL4 is to be opened
* (initialized).
@@ -322,6 +366,10 @@ NFCSTATUS phHal4Nfc_Open(
}
else/*Do an initialization*/
{
+#ifdef ANDROID
+ dlopen_firmware();
+#endif
+
/*If hal4 ctxt in Hwreference is NULL create a new context*/
if(NULL == ((phHal_sHwReference_t *)psHwReference)->hal_context)
{