summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2012-12-27 12:53:20 -0800
committerSteve Kondik <shade@chemlab.org>2012-12-27 12:53:20 -0800
commitdd55580a6f3d72175f0cb78c9fc4fac59cf9be09 (patch)
tree39bb820cbe6d2a093abb72cc837c52c95039c9c7
parent5199e59069db67d4f3bb2a466adab2e4647e8e70 (diff)
parent68c93f6f41998fbff40a3396a633faee4d595695 (diff)
downloadexternal_libnfc-nxp-dd55580a6f3d72175f0cb78c9fc4fac59cf9be09.zip
external_libnfc-nxp-dd55580a6f3d72175f0cb78c9fc4fac59cf9be09.tar.gz
external_libnfc-nxp-dd55580a6f3d72175f0cb78c9fc4fac59cf9be09.tar.bz2
Merge branch 'jb-mr1-release' of https://android.googlesource.com/platform/external/libnfc-nxp into aosp
Conflicts: src/phHal4Nfc_ADD.c Change-Id: I950a66598954d21b49f723da2c58bff2ba719239
-rwxr-xr-xAndroid.mk5
-rw-r--r--Linux_x86/phOsalNfc.c1
-rw-r--r--inc/nfc_custom_config_example.h (renamed from inc/nfc_custom_config.h)37
-rw-r--r--src/phFriNfc_OvrHal.c5
-rw-r--r--src/phFriNfc_TopazDynamicMap.c5
-rwxr-xr-xsrc/phHal4Nfc_ADD.c15
-rwxr-xr-xsrc/phHciNfc_AdminMgmt.c1
7 files changed, 42 insertions, 27 deletions
diff --git a/Android.mk b/Android.mk
index 9294807..d566b15 100755
--- a/Android.mk
+++ b/Android.mk
@@ -107,6 +107,11 @@ LOCAL_SRC_FILES += Linux_x86/phDal4Nfc_messageQueueLib.c
LOCAL_CFLAGS += -DNXP_MESSAGING -DANDROID -DNFC_TIMER_CONTEXT -fno-strict-aliasing
+ifeq ($(TARGET_HAS_NFC_CUSTOM_CONFIG),true)
+LOCAL_CFLAGS += -DNFC_CUSTOM_CONFIG_INCLUDE
+LOCAL_CFLAGS += -I$(TARGET_OUT_HEADERS)/libnfc-nxp
+endif
+
# Uncomment for Chipset command/responses
# Or use "setprop debug.nfc.LOW_LEVEL_TRACES" at run-time
# LOCAL_CFLAGS += -DLOW_LEVEL_TRACES
diff --git a/Linux_x86/phOsalNfc.c b/Linux_x86/phOsalNfc.c
index a158415..e906b0d 100644
--- a/Linux_x86/phOsalNfc.c
+++ b/Linux_x86/phOsalNfc.c
@@ -144,6 +144,7 @@ void phOsalNfc_RaiseException(phOsalNfc_ExceptionType_t eExceptionType, uint16_t
{
if(eExceptionType == phOsalNfc_e_UnrecovFirmwareErr)
{
+ ALOGE("HCI Timeout - Exception raised - Force restart of NFC service");
phLibNfc_Mgt_Recovery();
abort();
} else {
diff --git a/inc/nfc_custom_config.h b/inc/nfc_custom_config_example.h
index 0b4455a..d400bcc 100644
--- a/inc/nfc_custom_config.h
+++ b/inc/nfc_custom_config_example.h
@@ -20,7 +20,7 @@
* \brief HAL Custom Configurations
*
*
-* \note This is the configuration header file of the HAL 4.0. custom configurable
+* \note This is the configuration header file of the HAL 4.0. custom configurable
* parameters of the HAL 4.0 are provided in this file
*
* Project: NFC-FRI-1.1 / HAL4.0
@@ -39,7 +39,7 @@
/*@}*/
-/**
+/**
* \name Hal
*
* File: \ref nfc_custom_config.h
@@ -60,15 +60,15 @@
/**< Default Session ID for Initialisation */
#define DEFAULT_SESSION "NXP-NFC2"
-/** Resolution value for the timer, here the
+/** Resolution value for the timer, here the
timer resolution is 100 milliseconds */
#define TIMER_RESOLUTION 100U
-/**< Defines connection time out value for LLC timer,
+/**< Defines connection time out value for LLC timer,
500 is in milliseconds */
#define LINK_CONNECTION_TIMEOUT 500U
-/**< Defines guard time out value for LLC timer,
+/**< Defines guard time out value for LLC timer,
250 is in milliseconds */
#define LINK_GUARD_TIMEOUT 250U
@@ -76,14 +76,14 @@
* Initialisation */
-/* PLEASE NOTE: This Macro should be only enabled if there is a SMART_MX
+/* PLEASE NOTE: This Macro should be only enabled if there is a SMART_MX
* Chip attached to the PN544.
*/
/* #define NXP_HAL_ENABLE_SMX */
-/* PLEASE NOTE: Kindly change the DEFAULT_SESSION Macro for each of the
+/* PLEASE NOTE: Kindly change the DEFAULT_SESSION Macro for each of the
* configuration change done for the below Macros
*/
@@ -108,12 +108,12 @@
#define NFC_DEV_HWCONF_DEFAULT 0xBCU
-/**< TX LDO Configuration
+/**< TX LDO Configuration
0x00 -> 00b 3.0 V,
0x01 -> 01b 3.0 V,
0x02 -> 10b 2.7 V,
0x03 -> 11b 3.3 V,
-
+
*/
#define NXP_DEFAULT_TX_LDO 0x00U
@@ -134,17 +134,17 @@
#define NXP_UICC_BIT_RATE 0x08U
/**< Indicates PN544 Power Modes Configuration for the NFC Device,
- 0x00U -> PN544 stays in active bat mode
+ 0x00U -> PN544 stays in active bat mode
(except when generating RF field)
- 0x01U -> PN544 goes in standby when possible otherwise
+ 0x01U -> PN544 goes in standby when possible otherwise
stays in active bat mode
- 0x02U -> PN544 goes in idle mode as soon as it can
+ 0x02U -> PN544 goes in idle mode as soon as it can
(otherwise it is in active bat except when generating RF field)
- 0x03U -> PN544 goes in standby when possible otherwise goes in idle mode
- as soon as it can (otherwise it is in active bat except when
+ 0x03U -> PN544 goes in standby when possible otherwise goes in idle mode
+ as soon as it can (otherwise it is in active bat except when
generating RF field)
*/
-
+
#define NXP_SYSTEM_PWR_STATUS 0x01U
@@ -169,10 +169,10 @@
/* Reset the Default values of Host Link Timers */
-/* Macro to Enable the Host Side Link Timeout Configuration
+/* Macro to Enable the Host Side Link Timeout Configuration
* 0x00 ----> Default Pre-defined Configuration;
* 0x01 ----> Update only the Host Link Guard Timeout Configuration;
- * 0x03 ----> Update Both the Host Link Guard Timeout
+ * 0x03 ----> Update Both the Host Link Guard Timeout
and ACK Timeout Configuration;
*/
#define HOST_LINK_TIMEOUT 0x00U
@@ -184,7 +184,7 @@
#define NXP_NFC_LINK_ACK_CFG_DEFAULT 0x0005U
-/* Macro to Enable the Interface Character Timeout Configuration
+/* Macro to Enable the Interface Character Timeout Configuration
* 0x00 ----> Default Pre-defined Configuration;
* 0x01 ----> Update the IFC Timeout Default Configuration;
*/
@@ -198,4 +198,3 @@
#endif /* NFC_CUSTOM_CONFIG_H */
-
diff --git a/src/phFriNfc_OvrHal.c b/src/phFriNfc_OvrHal.c
index 539210e..9efff94 100644
--- a/src/phFriNfc_OvrHal.c
+++ b/src/phFriNfc_OvrHal.c
@@ -323,7 +323,10 @@ static void phFriNfc_OvrHal_CB_Transceive(void *context,
if(NULL != pRecvdata && OvrHal->TranceiveInfo.sRecvData.buffer != NULL && pRecvdata->buffer != NULL)
{
/* Work-around for the NFCIP Tranceive API */
- memcpy(OvrHal->TranceiveInfo.sRecvData.buffer, pRecvdata->buffer, pRecvdata->length);
+ if (OvrHal->TranceiveInfo.sRecvData.buffer != pRecvdata->buffer)
+ {
+ memcpy(OvrHal->TranceiveInfo.sRecvData.buffer, pRecvdata->buffer, pRecvdata->length);
+ }
if (OvrHal->pndef_recv_length != NULL)
{
*OvrHal->pndef_recv_length = (uint16_t) pRecvdata->length;
diff --git a/src/phFriNfc_TopazDynamicMap.c b/src/phFriNfc_TopazDynamicMap.c
index 2aa29ea..e9d1529 100644
--- a/src/phFriNfc_TopazDynamicMap.c
+++ b/src/phFriNfc_TopazDynamicMap.c
@@ -199,6 +199,9 @@ so there are 4 segements in the card */
((((block_no) + 1) == TOPAZ_STATIC_LOCK_FIRST_BLOCK_NO) ? \
(((block_no) + 1) + TOPAZ_STATIC_LOCK_BLOCK_AREAS) : \
((block_no) + 1))
+/* Check topaz spec version number */
+#define TOPAZ_COMPARE_VERSION(device_ver, tag_ver) \
+ ((device_ver & 0xF0) >= (tag_ver & 0xF0))
#ifdef FRINFC_READONLY_NDEF
@@ -2368,7 +2371,7 @@ phFriNfc_Tpz_H_CheckCCBytesForWrite (
{
check_index = (uint8_t)(check_index + 1);
- if ((check_cc_rw[0] != ps_tpz_info->CCByteBuf[1]) ||
+ if ((!TOPAZ_COMPARE_VERSION(check_cc_rw[0], ps_tpz_info->CCByteBuf[1])) ||
(check_cc_rw[1] != ps_tpz_info->CCByteBuf[2]) ||
(check_cc_rw[2] != ps_tpz_info->CCByteBuf[3]))
{
diff --git a/src/phHal4Nfc_ADD.c b/src/phHal4Nfc_ADD.c
index 54dd1c1..9461e43 100755
--- a/src/phHal4Nfc_ADD.c
+++ b/src/phHal4Nfc_ADD.c
@@ -671,12 +671,15 @@ void phHal4Nfc_TargetDiscoveryComplete(
if(phHal_eNfcIP1_Target ==
Hal4Ctxt->rem_dev_list[Count-1]->RemDevType)
{
- (void)memcpy(
- (void *)Hal4Ctxt->rem_dev_list[0],
- (void *)Hal4Ctxt->rem_dev_list[Count-1],
- sizeof(phHal_sRemoteDevInformation_t)
- );
- NfcIpDeviceCount = 1;
+ if (Count != 1)
+ {
+ (void)memcpy(
+ (void *)Hal4Ctxt->rem_dev_list[0],
+ (void *)Hal4Ctxt->rem_dev_list[Count-1],
+ sizeof(phHal_sRemoteDevInformation_t)
+ );
+ }
+ NfcIpDeviceCount = 1;
break;
}
}
diff --git a/src/phHciNfc_AdminMgmt.c b/src/phHciNfc_AdminMgmt.c
index ba8a023..312aa66 100755
--- a/src/phHciNfc_AdminMgmt.c
+++ b/src/phHciNfc_AdminMgmt.c
@@ -1006,6 +1006,7 @@ static
pipe_id = hcp_message->payload[RESPONSE_PIPEID_OFFSET];
p_pipe_info = (phHciNfc_Pipe_Info_t *)
phOsalNfc_GetMemory(sizeof(phHciNfc_Pipe_Info_t));
+ memset(p_pipe_info, 0, sizeof(phHciNfc_Pipe_Info_t));
if(NULL != p_pipe_info)
{
/* The Source Host is the UICC Host */