NFC: Fix compile errors
Fix compile errors and enable compilation for NQ440 chip.
Change-Id: I90afc7fb85a81ed14f2ff97f75409637da10f0cc
diff --git a/Android.bp b/Android.bp
deleted file mode 100644
index 803fefd..0000000
--- a/Android.bp
+++ /dev/null
@@ -1,74 +0,0 @@
-subdirs = ["src"]
-cc_library_shared {
- name: "nfc_nci.pn54x",
- proprietary: true,
- relative_install_path: "hw",
- srcs: [
- "halimpl/pn54x/common/*.c",
- "halimpl/pn54x/dnld/*.c",
- "halimpl/pn54x/hal/*.c",
- "halimpl/pn54x/log/*.c",
- "halimpl/pn54x/self-test/*.c",
- "halimpl/pn54x/tml/*.c",
- "halimpl/pn54x/utils/*.c",
- "halimpl/pn54x/utils/*.cpp",
- "halimpl/pn54x/nfc_nci.c"
- ],
- shared_libs: [
- "liblog",
- "libcutils",
- "libhwbinder",
- "libbase",
- "libutils",
- "libhardware",
- ],
- local_include_dirs: [
- "halimpl/pn54x/inc",
- "halimpl/pn54x/common",
- "halimpl/pn54x/dnld",
- "halimpl/pn54x/hal",
- "halimpl/pn54x/log",
- "halimpl/pn54x/self-test",
- "halimpl/pn54x/tml",
- "halimpl/pn54x/utils",
- "src/hal/include",
- "src/hal/int",
- "src/nfc/include",
- "src/nfa/include",
- "src/udrv/include",
- "src/include",
- "src/gki/ulinux/",
- "src/gki/common/",
- ],
- include_dirs: [
- "vendor/nxp/opensource/hardware/interfaces/nxpnfc/1.0/default/",
- ],
- cflags: [
- "-DBUILDCFG=1",
- "-Wno-deprecated-register",
- "-Wno-unused-parameter",
- "-Wno-missing-field-initializers",
- "-DNFC_HAL_TARGET=TRUE",
- "-DNFC_RW_ONLY=TRUE",
- "-DPN547C2=1",
- "-DPN548C2=2",
- "-DPN551=3",
- "-DPN553=4",
- "-DPN557=5",
- "-DNFC_NXP_CHIP_TYPE=5",
- "-DNXP_EXTNS=TRUE",
- "-DNFC_NXP_AID_MAX_SIZE_DYN=TRUE",
- "-DNXP_NFCC_HCE_F=TRUE",
- "-DNFC_NXP_ESE=TRUE",
- "-DJCOP_VER_3_1=1",
- "-DJCOP_VER_3_2=2",
- "-DJCOP_VER_3_3=3",
- "-DJCOP_VER_4_0=4",
- "-DNFC_NXP_ESE_VER=4",
- "-DNFC_NXP_LISTEN_ROUTE_TBL_OPTIMIZATION=TRUE",
- "-DNFC_NXP_HFO_SETTINGS=FALSE",
- "-DJCOP_WA_ENABLE=FALSE",
- "-DANDROID",
- "-DNXP_HW_SELF_TEST"
- ],
-}
diff --git a/Android.mk b/Android.mk
index 3f639ae..e0cdb8f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -23,6 +23,7 @@
PN548C2 := 2
PN551 := 3
PN553 := 4
+PN557 := 5
ifeq ($(PN547C2),1)
D_CFLAGS += -DPN547C2=1
@@ -36,6 +37,9 @@
ifeq ($(PN553),4)
D_CFLAGS += -DPN553=4
endif
+ifeq ($(PN557),5)
+D_CFLAGS += -DPN557=5
+endif
#### Select the JCOP OS Version ####
JCOP_VER_3_1 := 1
@@ -58,7 +62,7 @@
#### Select the CHIP ####
ifeq ($(strip $(NQ3XX_PRESENT)),true)
-NXP_CHIP_TYPE := $(PN553)
+NXP_CHIP_TYPE := $(PN557)
else
NXP_CHIP_TYPE := $(PN548C2)
endif
@@ -71,6 +75,8 @@
D_CFLAGS += -DNFC_NXP_CHIP_TYPE=PN551
else ifeq ($(NXP_CHIP_TYPE),$(PN553))
D_CFLAGS += -DNFC_NXP_CHIP_TYPE=PN553
+else ifeq ($(NXP_CHIP_TYPE),$(PN557))
+D_CFLAGS += -DNFC_NXP_CHIP_TYPE=PN557
endif
#Gemalto SE support
diff --git a/halimpl/pn54x/Android.bp b/halimpl/pn54x/Android.bp
deleted file mode 100644
index e69de29..0000000
--- a/halimpl/pn54x/Android.bp
+++ /dev/null
diff --git a/halimpl/pn54x/Android.mk b/halimpl/pn54x/Android.mk
index d91f4e5..14e8ffa 100644
--- a/halimpl/pn54x/Android.mk
+++ b/halimpl/pn54x/Android.mk
@@ -26,6 +26,7 @@
PN548C2 := 2
PN551 := 3
PN553 := 4
+PN557 := 5
NQ110 := $PN547C2
NQ120 := $PN547C2
@@ -48,10 +49,13 @@
ifeq ($(PN553),4)
D_CFLAGS += -DPN553=4
endif
+ifeq ($(PN557),5)
+D_CFLAGS += -DPN557=5
+endif
#### Select the CHIP ####
ifeq ($(strip $(NQ3XX_PRESENT)),true)
-NXP_CHIP_TYPE := $(PN553)
+NXP_CHIP_TYPE := $(PN557)
else
NXP_CHIP_TYPE := $(PN548C2)
endif
@@ -64,6 +68,8 @@
D_CFLAGS += -DNFC_NXP_CHIP_TYPE=PN551
else ifeq ($(NXP_CHIP_TYPE),$(PN553))
D_CFLAGS += -DNFC_NXP_CHIP_TYPE=PN553
+else ifeq ($(NXP_CHIP_TYPE),$(PN557))
+D_CFLAGS += -DNFC_NXP_CHIP_TYPE=PN557
endif
LOCAL_PATH := $(call my-dir)
@@ -76,6 +82,8 @@
LOCAL_MODULE := nfc_nci.nqx.default
else ifeq ($(NXP_CHIP_TYPE),$(PN553))
LOCAL_MODULE := nfc_nci.nqx.default
+else ifeq ($(NXP_CHIP_TYPE),$(PN557))
+LOCAL_MODULE := nfc_nci.nqx.default
endif
ifeq (true,$(TARGET_IS_64_BIT))
LOCAL_MULTILIB := 64
diff --git a/halimpl/pn54x/Android.mk.orig b/halimpl/pn54x/Android.mk.orig
deleted file mode 100644
index e47bde8..0000000
--- a/halimpl/pn54x/Android.mk.orig
+++ /dev/null
@@ -1,115 +0,0 @@
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-HAL_SUFFIX := $(TARGET_DEVICE)
-ifeq ($(TARGET_DEVICE),crespo)
- HAL_SUFFIX := herring
-endif
-
-#Enable NXP Specific
-D_CFLAGS += -DNXP_EXTNS=TRUE
-
-#variables for NFC_NXP_CHIP_TYPE
-PN547C2 := 1
-PN548C2 := 2
-PN551 := 3
-PN553 := 4
-
-NQ110 := $PN547C2
-NQ120 := $PN547C2
-NQ210 := $PN548C2
-NQ220 := $PN548C2
-
-#Enable HCE-F specific
-D_CFLAGS += -DNXP_NFCC_HCE_F=TRUE
-
-#NXP PN547 Enable
-ifeq ($(PN547C2),1)
-D_CFLAGS += -DPN547C2=1
-endif
-ifeq ($(PN548C2),2)
-D_CFLAGS += -DPN548C2=2
-endif
-ifeq ($(PN551),3)
-D_CFLAGS += -DPN551=3
-endif
-ifeq ($(PN553),4)
-D_CFLAGS += -DPN553=4
-endif
-
-#### Select the CHIP ####
-NXP_CHIP_TYPE := $(PN553)
-
-ifeq ($(NXP_CHIP_TYPE),$(PN547C2))
-D_CFLAGS += -DNFC_NXP_CHIP_TYPE=PN547C2
-else ifeq ($(NXP_CHIP_TYPE),$(PN548C2))
-D_CFLAGS += -DNFC_NXP_CHIP_TYPE=PN548C2
-else ifeq ($(NXP_CHIP_TYPE),$(PN551))
-D_CFLAGS += -DNFC_NXP_CHIP_TYPE=PN551
-else ifeq ($(NXP_CHIP_TYPE),$(PN553))
-D_CFLAGS += -DNFC_NXP_CHIP_TYPE=PN553
-endif
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-ifeq ($(NXP_CHIP_TYPE),$(PN547C2))
-LOCAL_MODULE := nfc_nci_pn547.grouper
-else ifeq ($(NXP_CHIP_TYPE),$(PN548C2))
-LOCAL_MODULE := nfc_nci.pn54x.default
-else ifeq ($(NXP_CHIP_TYPE),$(PN551))
-LOCAL_MODULE := nfc_nci.pn54x.default
-else ifeq ($(NXP_CHIP_TYPE),$(PN553))
-LOCAL_MODULE := nfc_nci.pn54x.default
-endif
-ifeq (true,$(TARGET_IS_64_BIT))
-LOCAL_MULTILIB := 64
-else
-LOCAL_MULTILIB := 32
-endif
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := $(call all-subdir-c-files) $(call all-subdir-cpp-files)
-LOCAL_SHARED_LIBRARIES := liblog libcutils libhardware_legacy libdl
-
-LOCAL_CFLAGS := $(D_CFLAGS)
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/utils \
- $(LOCAL_PATH)/inc \
- $(LOCAL_PATH)/common \
- $(LOCAL_PATH)/dnld \
- $(LOCAL_PATH)/hal \
- $(LOCAL_PATH)/log \
- $(LOCAL_PATH)/tml \
- $(LOCAL_PATH)/configs \
- $(LOCAL_PATH)/self-test
-
-LOCAL_CFLAGS += -DANDROID \
- -DNXP_HW_SELF_TEST
-LOCAL_CFLAGS += -DNFC_NXP_HFO_SETTINGS=FALSE
-NFC_NXP_ESE:= TRUE
-ifeq ($(NFC_NXP_ESE),TRUE)
-D_CFLAGS += -DNFC_NXP_ESE=TRUE
-ifeq ($(NXP_CHIP_TYPE),$(PN553))
-D_CFLAGS += -DJCOP_WA_ENABLE=FALSE
-else
-D_CFLAGS += -DJCOP_WA_ENABLE=TRUE
-endif
-else
-D_CFLAGS += -DNFC_NXP_ESE=FALSE
-endif
-LOCAL_CFLAGS += $(D_CFLAGS)
-#LOCAL_CFLAGS += -DFELICA_CLT_ENABLE
-#-DNXP_PN547C1_DOWNLOAD
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/halimpl/pn54x/hal/phNxpNciHal.h b/halimpl/pn54x/hal/phNxpNciHal.h
index fe6d183..9cd784a 100644
--- a/halimpl/pn54x/hal/phNxpNciHal.h
+++ b/halimpl/pn54x/hal/phNxpNciHal.h
@@ -30,7 +30,6 @@
#define MAX_RETRY_COUNT 5
#define NCI_MAX_DATA_LEN 300
#define NCI_POLL_DURATION 500
-#define HAL_NFC_ENABLE_I2C_FRAGMENTATION_EVT 0x07
#define NXP_STAG_TIMEOUT_BUF_LEN 0x04 /*FIXME:TODO:remove*/
#define NXP_WIREDMODE_RESUME_TIMEOUT_LEN 0x04
#define NFCC_DECIDES 00
@@ -38,6 +37,33 @@
#define LINK_ALWAYS_ON 02
#undef P2P_PRIO_LOGIC_HAL_IMP
+enum {
+ HAL_NFC_ENABLE_I2C_FRAGMENTATION_EVT = 0x07,
+ HAL_NFC_POST_MIN_INIT_CPLT_EVT = 0x08
+};
+
+enum {
+ HAL_NFC_IOCTL_P61_IDLE_MODE = 0,
+ HAL_NFC_IOCTL_P61_WIRED_MODE,
+ HAL_NFC_IOCTL_P61_PWR_MODE,
+ HAL_NFC_IOCTL_P61_DISABLE_MODE,
+ HAL_NFC_IOCTL_P61_ENABLE_MODE,
+ HAL_NFC_IOCTL_SET_BOOT_MODE,
+ HAL_NFC_IOCTL_GET_CONFIG_INFO,
+ HAL_NFC_IOCTL_CHECK_FLASH_REQ,
+ HAL_NFC_IOCTL_FW_DWNLD,
+ HAL_NFC_IOCTL_FW_MW_VER_CHECK,
+ HAL_NFC_IOCTL_DISABLE_HAL_LOG,
+ HAL_NFC_IOCTL_NCI_TRANSCEIVE,
+ HAL_NFC_IOCTL_P61_GET_ACCESS,
+ HAL_NFC_IOCTL_P61_REL_ACCESS,
+ HAL_NFC_IOCTL_ESE_CHIP_RST,
+ HAL_NFC_IOCTL_REL_SVDD_WAIT,
+ HAL_NFC_IOCTL_SET_JCP_DWNLD_ENABLE,
+ HAL_NFC_IOCTL_SET_JCP_DWNLD_DISABLE,
+ HAL_NFC_IOCTL_SET_NFC_SERVICE_PID
+};
+
#define NCI_VERSION_2_0 0x20
#define NCI_VERSION_1_1 0x11
#define NCI_VERSION_1_0 0x10
diff --git a/halimpl/pn54x/inc/phNxpNciHal_Adaptation.h b/halimpl/pn54x/inc/phNxpNciHal_Adaptation.h
index 6fb24c3..cbba8b2 100644
--- a/halimpl/pn54x/inc/phNxpNciHal_Adaptation.h
+++ b/halimpl/pn54x/inc/phNxpNciHal_Adaptation.h
@@ -67,6 +67,7 @@
uint8_t halType;
nfc_nci_ExtnCmd_t nciCmd;
uint32_t timeoutMilliSec;
+ long nfcServicePid;
}InputData_t;
/*
* nfc_nci_ExtnInputData_t :Apart from InputData_t, there are context data
diff --git a/halimpl/pn54x/libnfc-brcm.conf b/halimpl/pn54x/libnfc-brcm.conf
index 26be34d..0eca62c 100644
--- a/halimpl/pn54x/libnfc-brcm.conf
+++ b/halimpl/pn54x/libnfc-brcm.conf
@@ -1,149 +1,149 @@
-###################### Start of libnfc-common.conf #######################
+######################Start of libnfc-brcm.conf#######################
###############################################################################
-# Application options
+#Application options
APPL_TRACE_LEVEL=0xFF
PROTOCOL_TRACE_LEVEL=0xFFFFFFFF
###############################################################################
-# performance measurement
-# Change this setting to control how often USERIAL log the performance (throughput)
-# data on read/write/poll
-# defailt is to log performance dara for every 100 read or write
+#performance measurement
+#Change this setting to control how often USERIAL log the performance(throughput)
+#data on read / write / poll
+#defailt is to log performance dara for every 100 read or write
#REPORT_PERFORMANCE_MEASURE=100
###############################################################################
-# File used for NFA storage
+#File used for NFA storage
NFA_STORAGE="/data/nfc"
###############################################################################
-# Snooze Mode Settings
+#Snooze Mode Settings
#
-# By default snooze mode is enabled. Set SNOOZE_MODE_CFG byte[0] to 0
-# to disable.
+#By default snooze mode is enabled.Set SNOOZE_MODE_CFG byte[0] to 0
+#to disable.
#
-# If SNOOZE_MODE_CFG is not provided, the default settings are used:
-# They are as follows:
-# 8 Sleep Mode (0=Disabled 1=UART 8=SPI/I2C)
-# 0 Idle Threshold Host
-# 0 Idle Threshold HC
-# 0 NFC Wake active mode (0=ActiveLow 1=ActiveHigh)
-# 1 Host Wake active mode (0=ActiveLow 1=ActiveHigh)
+#If SNOOZE_MODE_CFG is not provided, the default settings are used:
+#They are as follows:
+# 8 Sleep Mode(0 = Disabled 1 = UART 8 = SPI / I2C)
+# 0 Idle Threshold Host
+# 0 Idle Threshold HC
+# 0 NFC Wake active mode(0 = ActiveLow 1 = ActiveHigh)
+# 1 Host Wake active mode(0 = ActiveLow 1 = ActiveHigh)
#
-#SNOOZE_MODE_CFG={08:00:00:00:01}
+#SNOOZE_MODE_CFG={08 : 00 : 00 : 00 : 01 }
###############################################################################
-# Insert a delay in milliseconds after NFC_WAKE and before write to NFCC
+#Insert a delay in milliseconds after NFC_WAKE and before write to NFCC
#NFC_WAKE_DELAY=20
###############################################################################
-# Various Delay settings (in ms) used in USERIAL
-# POWER_ON_DELAY
-# Delay after turning on chip, before writing to transport (default 300)
-# PRE_POWER_OFF_DELAY
-# Delay after deasserting NFC-Wake before turn off chip (default 0)
-# POST_POWER_OFF_DELAY
-# Delay after turning off chip, before USERIAL_close returns (default 0)
+#Various Delay settings(in ms) used in USERIAL
+#POWER_ON_DELAY
+#Delay after turning on chip, before writing to transport(default 300)
+#PRE_POWER_OFF_DELAY
+#Delay after deasserting NFC - Wake before turn off chip(default 0)
+#POST_POWER_OFF_DELAY
+#Delay after turning off chip, before USERIAL_close returns(default 0)
#
#POWER_ON_DELAY=300
#PRE_POWER_OFF_DELAY=0
#POST_POWER_OFF_DELAY=0
###############################################################################
-# Maximum time (ms) to wait for RESET NTF after setting REG_PU to high
-# The default is 1000.
+#Maximum time(ms) to wait for RESET NTF after setting REG_PU to high
+#The default is 1000.
#NFCC_ENABLE_TIMEOUT=0
###############################################################################
-# LPTD mode configuration
-# byte[0] is the length of the remaining bytes in this value
-# if set to 0, LPTD params will NOT be sent to NFCC (i.e. disabled).
-# byte[1] is the param id it should be set to B9.
-# byte[2] is the length of the LPTD parameters
-# byte[3] indicates if LPTD is enabled
-# if set to 0, LPTD will be disabled (parameters will still be sent).
-# byte[4-n] are the LPTD parameters.
-# By default, LPTD is enabled and default settings are used.
-# See nfc_hal_dm_cfg.c for defaults
-#LPTD_CFG={23:B9:21:01:02:FF:FF:04:A0:0F:40:00:80:02:02:10:00:00:00:31:0C:30:00:00:00:00:00:00:00:00:00:00:00:00:00:00}
+#LPTD mode configuration
+#byte[0] is the length of the remaining bytes in this value
+#if set to 0, LPTD params will NOT be sent to NFCC(i.e.disabled).
+#byte[1] is the param id it should be set to B9.
+#byte[2] is the length of the LPTD parameters
+#byte[3] indicates if LPTD is enabled
+#if set to 0, LPTD will be disabled(parameters will still be sent).
+#byte[4 - n] are the LPTD parameters.
+#By default, LPTD is enabled and default settings are used.
+#See nfc_hal_dm_cfg.c for defaults
+#LPTD_CFG={23 : B9 : 21 : 01 : 02 : FF : FF : 04 : A0 : 0F : 40 : 00 : 80 : 02 : 02 : 10 : 00 : 00 : 00 : 31 : 0C : 30 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 }
###############################################################################
-# Startup Configuration (100 bytes maximum)
+#Startup Configuration(100 bytes maximum)
#
-# For the 0xCA parameter, byte[9] (marked by 'AA') is for UICC0, and byte[10] (marked by BB) is
-# for UICC1. The values are defined as:
-# 0 : UICCx only supports ISO_DEP in low power mode.
-# 2 : UICCx only supports Mifare in low power mode.
-# 3 : UICCx supports both ISO_DEP and Mifare in low power mode.
+#For the 0xCA parameter, byte[9](marked by 'AA') is for UICC0, and byte[10](marked by BB) is
+#for UICC1.The values are defined as:
+# 0 : UICCx only supports ISO_DEP in low power mode.
+# 2 : UICCx only supports Mifare in low power mode.
+# 3 : UICCx supports both ISO_DEP and Mifare in low power mode.
#
-# AA BB
-#NFA_DM_START_UP_CFG={1F:CB:01:01:A5:01:01:CA:14:00:00:00:00:06:E8:03:00:00:00:00:00:00:00:00:00:00:00:00:00:80:01:01}
+# AA BB
+#NFA_DM_START_UP_CFG={1F : CB : 01 : 01 : A5 : 01 : 01 : CA : 14 : 00 : 00 : 00 : 00 : 06 : E8 : 03 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 00 : 80 : 01 : 01 }
###############################################################################
-# Startup Vendor Specific Configuration (100 bytes maximum);
-# byte[0] TLV total len = 0x5
-# byte[1] NCI_MTS_CMD|NCI_GID_PROP = 0x2f
-# byte[2] NCI_MSG_FRAME_LOG = 0x9
-# byte[3] 2
-# byte[4] 0=turn off RF frame logging; 1=turn on
-# byte[5] 0=turn off SWP frame logging; 1=turn on
-# NFA_DM_START_UP_VSC_CFG={05:2F:09:02:01:01}
+#Startup Vendor Specific Configuration(100 bytes maximum);
+#byte[0] TLV total len = 0x5
+#byte[1] NCI_MTS_CMD | NCI_GID_PROP = 0x2f
+#byte[2] NCI_MSG_FRAME_LOG = 0x9
+#byte[3] 2
+#byte[4] 0 = turn off RF frame logging; 1 = turn on
+#byte[5] 0 = turn off SWP frame logging; 1 = turn on
+#NFA_DM_START_UP_VSC_CFG={05 : 2F : 09 : 02 : 01 : 01 }
###############################################################################
-# Antenna Configuration - This data is used when setting 0xC8 config item
-# at startup (before discovery is started). If not used, no value is sent.
+#Antenna Configuration - This data is used when setting 0xC8 config item
+#at startup(before discovery is started).If not used, no value is sent.
#
-# The settings for this value are documented here:
-# http://wcgbu.broadcom.com/wpan/PM/Project%20Document%20Library/bcm20791B0/
-# Design/Doc/PHY%20register%20settings/BCM20791-B2-1027-02_PHY_Recommended_Reg_Settings.xlsx
-# This document is maintained by Paul Forshaw.
+#The settings for this value are documented here:
+#http: // wcgbu.broadcom.com/wpan/PM/Project%20Document%20Library/bcm20791B0/
+#Design / Doc / PHY % 20register % 20settings / BCM20791 - B2 - 1027 - \02_PHY_Recommended_Reg_Settings.xlsx
+#This document is maintained by Paul Forshaw.
#
-# The values marked as ?? should be tweaked per antenna or customer/app:
-# {20:C8:1E:06:??:00:??:??:??:00:??:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:??:01:00:00:40:04}
-# array[0] = 0x20 is length of the payload from array[1] to the end
-# array[1] = 0xC8 is PREINIT_DSP_CFG
-#PREINIT_DSP_CFG={20:C8:1E:06:1F:00:0F:03:3C:00:04:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:48:01:00:00:40:04}
+#The values marked as ? ? should be tweaked per antenna or customer / app:
+#{20 : C8 : 1E : 06 : ? ?: 00 : ? ?: ? ?: ? ?: 00 : ??: 24 : 00 : 1C : 00 : 75 : 00 : 77 : 00 : 76 : 00 : 1C : 00 : 03 : 00 : 0A : 00 : ? ?: 01 : 00 : 00 : 40 : 04 }
+#array[0] = 0x20 is length of the payload from array[1] to the end
+#array[1] = 0xC8 is PREINIT_DSP_CFG
+#PREINIT_DSP_CFG={20 : C8 : 1E : 06 : 1F : 00 : 0F : 03 : 3C : 00 : 04 : 24 : 00 : 1C : 00 : 75 : 00 : 77 : 00 : 76 : 00 : 1C : 00 : 03 : 00 : 0A : 00 : 48 : 01 : 00 : 00 : 40 : 04 }
###############################################################################
-# Configure crystal frequency when internal LPO can't detect the frequency.
+#Configure crystal frequency when internal LPO can't detect the frequency.
#XTAL_FREQUENCY=0
###############################################################################
-# Configure the default Destination Gate used by HCI (the default is 4, which
-# is the ETSI loopback gate.
+#Configure the default Destination Gate used by HCI(the default is 4, which
+#is the ETSI loopback gate.
NFA_HCI_DEFAULT_DEST_GATE=0xF0
###############################################################################
-# Configure the single default SE to use. The default is to use the first
-# SE that is detected by the stack. This value might be used when the phone
-# supports multiple SE (e.g. 0xF3 and 0xF4) but you want to force it to use
-# one of them (e.g. 0xF4).
+#Configure the single default SE to use.The default is to use the first
+#SE that is detected by the stack.This value might be used when the phone
+#supports multiple SE(e.g .0xF3 and 0xF4) but you want to force it to use
+#one of them(e.g .0xF4).
#ACTIVE_SE=0xF3
###############################################################################
-# Configure the default NfcA/IsoDep techology and protocol route. Can be
-# either a secure element (e.g. 0xF4) or the host (0x00)
+#Configure the default NfcA / IsoDep techology and protocol route.Can be
+#either a secure element(e.g .0xF4) or the host(0x00)
#DEFAULT_ISODEP_ROUTE=0x00
###############################################################################
-# Configure the NFC Extras to open and use a static pipe. If the value is
-# not set or set to 0, then the default is use a dynamic pipe based on a
-# destination gate (see NFA_HCI_DEFAULT_DEST_GATE). Note there is a value
-# for each UICC (where F3="UICC0" and F4="UICC1")
+#Configure the NFC Extras to open and use a static pipe.If the value is
+#not set or set to 0, then the default is use a dynamic pipe based on a
+#destination gate(see NFA_HCI_DEFAULT_DEST_GATE).Note there is a value
+#for each UICC(where F3 = "UICC0" and F4 = "UICC1")
#NFA_HCI_STATIC_PIPE_ID_F3=0x70
#NFA_HCI_STATIC_PIPE_ID_01=0x19
NFA_HCI_STATIC_PIPE_ID_C0=0x19
NFA_HCI_STATIC_PIPE_ID_02=0x20
###############################################################################
-# When disconnecting from Oberthur secure element, perform a warm-reset of
-# the secure element to deselect the applet.
-# The default hex value of the command is 0x3. If this variable is undefined,
-# then this feature is not used.
+#When disconnecting from Oberthur secure element, perform a warm - reset of
+#the secure element to deselect the applet.
+#The default hex value of the command is 0x3. If this variable is undefined,
+#then this feature is not used.
#OBERTHUR_WARM_RESET_COMMAND=0x03
###############################################################################
-# Force UICC to only listen to the following technology(s).
-# The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
-# Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B | NFA_TECHNOLOGY_MASK_F
+#Force UICC to only listen to the following technology(s).
+#The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
+#Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B | NFA_TECHNOLOGY_MASK_F
UICC_LISTEN_TECH_MASK=0x07
###############################################################################
@@ -156,118 +156,118 @@
HOST_LISTEN_TECH_MASK=0x07
###############################################################################
-# Enabling/Disabling Forward functionality
-# Disable 0x00
-# Enable 0x01
+#Enabling / Disabling Forward functionality
+#Disable 0x00
+#Enable 0x01
NXP_FWD_FUNCTIONALITY_ENABLE=0x01
###############################################################################
-# Allow UICC to be powered off if there is no traffic.
-# Timeout is in ms. If set to 0, then UICC will not be powered off.
+#Allow UICC to be powered off if there is no traffic.
+#Timeout is in ms.If set to 0, then UICC will not be powered off.
#UICC_IDLE_TIMEOUT=30000
UICC_IDLE_TIMEOUT=0
###############################################################################
-# AID for Empty Select command
-# If specified, this AID will be substituted when an Empty SELECT command is
-# detected. The first byte is the length of the AID. Maximum length is 16.
-AID_FOR_EMPTY_SELECT={08:A0:00:00:01:51:00:00:00}
+#AID for Empty Select command
+#If specified, this AID will be substituted when an Empty SELECT command is
+#detected.The first byte is the length of the AID.Maximum length is 16.
+AID_FOR_EMPTY_SELECT={08 : A0 : 00 : 00 : 01 : 51 : 00 : 00 : 00}
###############################################################################
-# Maximum Number of Credits to be allowed by the NFCC
-# This value overrides what the NFCC specifices allowing the host to have
-# the control to work-around transport limitations. If this value does
-# not exist or is set to 0, the NFCC will provide the number of credits.
+#Maximum Number of Credits to be allowed by the NFCC
+#This value overrides what the NFCC specifices allowing the host to have
+#the control to work - around transport limitations.If this value does
+#not exist or is set to 0, the NFCC will provide the number of credits.
MAX_RF_DATA_CREDITS=1
###############################################################################
-# This setting allows you to disable registering the T4t Virtual SE that causes
-# the NFCC to send PPSE requests to the DH.
-# The default setting is enabled (i.e. T4t Virtual SE is registered).
+#This setting allows you to disable registering the T4t Virtual SE that causes
+#the NFCC to send PPSE requests to the DH.
+#The default setting is enabled(i.e.T4t Virtual SE is registered).
#REGISTER_VIRTUAL_SE=1
###############################################################################
-# When screen is turned off, specify the desired power state of the controller.
-# 0: power-off-sleep state; DEFAULT
-# 1: full-power state
-# 2: screen-off card-emulation (CE4/CE3/CE1 modes are used)
+#When screen is turned off, specify the desired power state of the controller.
+# 0 : power - off - sleep state; DEFAULT
+# 1 : full - power state
+# 2 : screen - off card - emulation(CE4 / CE3 / CE1 modes are used)
SCREEN_OFF_POWER_STATE=1
###############################################################################
-# Firmware patch file
-# If the value is not set then patch download is disabled.
+#Firmware patch file
+#If the value is not set then patch download is disabled.
#FW_PATCH="/vendor/firmware/bcm2079x_firmware.ncd"
-###############################################################################
-# Firmware pre-patch file (sent before the above patch file)
-# If the value is not set then pre-patch is not used.
+############################################################################# #
+#Firmware pre - patch file(sent before the above patch file)
+#If the value is not set then pre - patch is not used.
#FW_PRE_PATCH="/vendor/firmware/bcm2079x_pre_firmware.ncd"
###############################################################################
-# Firmware patch format
-# 1 = HCD
-# 2 = NCD (default)
+#Firmware patch format
+# 1 = HCD
+# 2 = NCD(default)
#NFA_CONFIG_FORMAT=2
###############################################################################
-# SPD Debug mode
-# If set to 1, any failure of downloading a patch will trigger a hard-stop
+#SPD Debug mode
+#If set to 1, any failure of downloading a patch will trigger a hard - stop
#SPD_DEBUG=0
###############################################################################
-# SPD Max Retry Count
-# The number of attempts to download a patch before giving up (defualt is 3).
-# Note, this resets after a power-cycle.
+#SPD Max Retry Count
+#The number of attempts to download a patch before giving up(defualt is 3).
+#Note, this resets after a power - cycle.
#SPD_MAX_RETRY_COUNT=3
###############################################################################
-# transport driver
+#transport driver
#
-# TRANSPORT_DRIVER=<driver>
+#TRANSPORT_DRIVER = < driver >
#
-# where <driver> can be, for example:
-# "/dev/ttyS" (UART)
-# "/dev/bcmi2cnfc" (I2C)
-# "hwtun" (HW Tunnel)
-# "/dev/bcmspinfc" (SPI)
-# "/dev/btusb0" (BT USB)
+#where < driver > can be, for example:
+#"/dev/ttyS"(UART)
+#"/dev/bcmi2cnfc"(I2C)
+#"hwtun"(HW Tunnel)
+#"/dev/bcmspinfc"(SPI)
+#"/dev/btusb0"(BT USB)
#TRANSPORT_DRIVER="/dev/bcm2079x-i2c"
###############################################################################
-# power control driver
-# Specify a kernel driver that support ioctl commands to control NFC_EN and
-# NFC_WAKE gpio signals.
+#power control driver
+#Specify a kernel driver that support ioctl commands to control NFC_EN and
+#NFC_WAKE gpio signals.
#
-# POWER_CONTRL_DRIVER=<driver>
-# where <driver> can be, for example:
-# "/dev/nfcpower"
-# "/dev/bcmi2cnfc" (I2C)
-# "/dev/bcmspinfc" (SPI)
-# i2c and spi driver may be used to control NFC_EN and NFC_WAKE signal
+#POWER_CONTRL_DRIVER = < driver >
+#where < driver > can be, for example:
+#"/dev/nfcpower"
+#"/dev/bcmi2cnfc"(I2C)
+#"/dev/bcmspinfc"(SPI)
+#i2c and spi driver may be used to control NFC_EN and NFC_WAKE signal
#POWER_CONTROL_DRIVER="/dev/bcm2079x-i2c"
###############################################################################
-# I2C transport driver options
-# Mako does not support 10-bit I2C addresses
-# Revert to 7-bit address
+#I2C transport driver options
+#Mako does not support 10 - bit I2C addresses
+#Revert to 7 - bit address
#BCMI2CNFC_ADDRESS=0x77
###############################################################################
-# I2C transport driver try to read multiple packets in read() if data is available
-# remove the comment below to enable this feature
+#I2C transport driver try to read multiple packets in read() if data is available
+#remove the comment below to enable this feature
#READ_MULTIPLE_PACKETS=1
###############################################################################
-# SPI transport driver options
-#SPI_NEGOTIATION={0A:F0:00:01:00:00:00:FF:FF:00:00}
+#SPI transport driver options
+#SPI_NEGOTIATION={0A : F0 : 00 : 01 : 00 : 00 : 00 : FF : FF : 00 : 00 }
###############################################################################
-# UART transport driver options
+#UART transport driver options
#
-# PORT=1,2,3,...
-# BAUD=115200, 19200, 9600, 4800,
-# DATABITS=8, 7, 6, 5
-# PARITY="even" | "odd" | "none"
-# STOPBITS="0" | "1" | "1.5" | "2"
+#PORT=1, 2, 3, ...
+#BAUD=115200, 19200, 9600, 4800,
+#DATABITS=8, 7, 6, 5
+#PARITY="even" | "odd" | "none"
+#STOPBITS="0" | "1" | "1.5" | "2"
#UART_PORT=2
#UART_BAUD=115200
@@ -276,48 +276,48 @@
#UART_STOPBITS="1"
###############################################################################
-# Insert a delay in microseconds per byte after a write to NFCC.
-# after writing a block of data to the NFCC, delay this an amopunt of time before
-# writing next block of data. the delay is calculated as below
-# NFC_WRITE_DELAY * (number of byte written) / 1000 milliseconds
-# e.g. after 259 bytes is written, delay (259 * 20 / 1000) 5 ms before next write
+#Insert a delay in microseconds per byte after a write to NFCC.
+#after writing a block of data to the NFCC, delay this an amopunt of time before
+#writing next block of data.the delay is calculated as below
+#NFC_WRITE_DELAY*(number of byte written) / 1000 milliseconds
+#e.g.after 259 bytes is written, delay(259 * 20 / 1000) 5 ms before next write
#NFC_WRITE_DELAY=20
###############################################################################
-# Maximum Number of Credits to be allowed by the NFCC
-# This value overrides what the NFCC specifices allowing the host to have
-# the control to work-around transport limitations. If this value does
-# not exist or is set to 0, the NFCC will provide the number of credits.
+#Maximum Number of Credits to be allowed by the NFCC
+#This value overrides what the NFCC specifices allowing the host to have
+#the control to work - around transport limitations.If this value does
+#not exist or is set to 0, the NFCC will provide the number of credits.
MAX_RF_DATA_CREDITS=1
###############################################################################
-# Default poll duration (in ms)
-# The defualt is 500ms if not set (see nfc_target.h)
+#Default poll duration(in ms)
+#The defualt is 500ms if not set(see nfc_target.h)
#NFA_DM_DISC_DURATION_POLL=333
###############################################################################
-# Antenna Configuration - This data is used when setting 0xC8 config item
-# at startup (before discovery is started). If not used, no value is sent.
+#Antenna Configuration - This data is used when setting 0xC8 config item
+#at startup(before discovery is started).If not used, no value is sent.
#
-# The settings for this value are documented here:
-# http://wcgbu.broadcom.com/wpan/PM/Project%20Document%20Library/bcm20791B0/
-# Design/Doc/PHY%20register%20settings/BCM20791-B2-1027-02_PHY_Recommended_Reg_Settings.xlsx
-# This document is maintained by Paul Forshaw.
+#The settings for this value are documented here:
+#http: // wcgbu.broadcom.com/wpan/PM/Project%20Document%20Library/bcm20791B0/
+#Design / Doc / PHY % 20register % 20settings / BCM20791 - B2 - 1027 - \02_PHY_Recommended_Reg_Settings.xlsx
+#This document is maintained by Paul Forshaw.
#
-# The values marked as ?? should be tweaked per antenna or customer/app:
-# {20:C8:1E:06:??:00:??:??:??:00:??:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:??:01:00:00:40:04}
-# array[0] = 0x20 is length of the payload from array[1] to the end
-# array[1] = 0xC8 is PREINIT_DSP_CFG
-#PREINIT_DSP_CFG={20:C8:1E:06:1F:00:0F:03:3C:00:04:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:48:01:00:00:40:04}
-
+#The values marked as ? ? should be tweaked per antenna or customer / app:
+#{20 : C8 : 1E : 06 : ? ?: 00 : ? ?: ? ?: ? ?: 00 : ? ?: 24 : 00 : 1C : 00 : 75 : 00 : 77 : 00 : 76 : 00 : 1C : 00 : 03 : 00 : 0A : 00 : ? ?: 01 : 00 : 00 : 40 : 04 }
+#array[0] = 0x20 is length of the payload from array[1] to the end
+#array[1] = 0xC8 is PREINIT_DSP_CFG
+#PREINIT_DSP_CFG={20 : C8 : 1E : 06 : 1F : 00 : 0F : 03 : 3C : 00 : 04 : 24 : 00 : 1C : 00 : 75 : 00 : 77 : 00 : 76 : 00 : 1C : 00 : 03 : 00 : 0A : 00 : 48 : 01 : 00 : 00 : 40 : 04 }
###############################################################################
-# Choose the presence-check algorithm for type-4 tag. If not defined, the default value is 1.
-# 0 NFA_RW_PRES_CHK_DEFAULT; Let stack selects an algorithm
-# 1 NFA_RW_PRES_CHK_I_BLOCK; ISO-DEP protocol's empty I-block
-# 2 NFA_RW_PRES_CHK_RESET; Deactivate to Sleep, then re-activate
-# 3 NFA_RW_PRES_CHK_RB_CH0; Type-4 tag protocol's ReadBinary command on channel 0
-# 4 NFA_RW_PRES_CHK_RB_CH3; Type-4 tag protocol's ReadBinary command on channel 3
-PRESENCE_CHECK_ALGORITHM=1
+#Choose the presence - check algorithm for type - 4 tag.If not defined, the default value is 1.
+# 0 NFA_RW_PRES_CHK_DEFAULT; Let stack selects an algorithm
+# 1 NFA_RW_PRES_CHK_I_BLOCK; ISO - DEP protocol's empty I-block
+# 2 NFA_RW_PRES_CHK_RESET; Deactivate to Sleep, then re - activate
+# 3 NFA_RW_PRES_CHK_RB_CH0; Type - 4 tag protocol's ReadBinary command on channel 0
+# 4 NFA_RW_PRES_CHK_RB_CH3; Type - 4 tag protocol's ReadBinary command on channel 3
+# 5 NFA_RW_PRES_CHK_ISO_DEP_NAK; Type - 4 tag protocol iso-dep nak presence check command is sent waiting for rsp and ntf.
+PRESENCE_CHECK_ALGORITHM=5
###############################################################################
# Force tag polling for the following technology(s).
@@ -327,15 +327,15 @@
# NFA_TECHNOLOGY_MASK_B_PRIME | NFA_TECHNOLOGY_MASK_KOVIO |
# NFA_TECHNOLOGY_MASK_A_ACTIVE | NFA_TECHNOLOGY_MASK_F_ACTIVE.
#
-# Notable bits:
-# NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
-# NFA_TECHNOLOGY_MASK_B 0x02 /* NFC Technology B */
-# NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
-# NFA_TECHNOLOGY_MASK_ISO15693 0x08 /* Proprietary Technology */
-# NFA_TECHNOLOGY_MASK_KOVIO 0x20 /* Proprietary Technology */
-# NFA_TECHNOLOGY_MASK_A_ACTIVE 0x40 /* NFC Technology A active mode */
-# NFA_TECHNOLOGY_MASK_F_ACTIVE 0x80 /* NFC Technology F active mode */
-POLLING_TECH_MASK=0xEF
+#Notable bits:
+#NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
+#NFA_TECHNOLOGY_MASK_B 0x02 /* NFC Technology B */
+#NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
+#NFA_TECHNOLOGY_MASK_ISO15693 0x08 /* Proprietary Technology */
+#NFA_TECHNOLOGY_MASK_KOVIO 0x20 /* Proprietary Technology */
+#NFA_TECHNOLOGY_MASK_ACTIVE 0x40 /* NFC Technology Active*/
+
+POLLING_TECH_MASK=0x6F
###############################################################################
# Force P2P to only listen for the following technology(s).
@@ -343,54 +343,70 @@
# Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_F |
# NFA_TECHNOLOGY_MASK_A_ACTIVE | NFA_TECHNOLOGY_MASK_F_ACTIVE
#
-# Notable bits:
-# NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
-# NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
-# NFA_TECHNOLOGY_MASK_A_ACTIVE 0x40 /* NFC Technology A active mode */
-# NFA_TECHNOLOGY_MASK_F_ACTIVE 0x80 /* NFC Technology F active mode */
-P2P_LISTEN_TECH_MASK=0xC5
+#Notable bits:
+#NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
+#NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
+#NFA_TECHNOLOGY_MASK_ACTIVE 0x40 /* NFC Technology Active */
+
+P2P_LISTEN_TECH_MASK=0x45
PRESERVE_STORAGE=0x01
###############################################################################
-# NCI Hal Module name
-NCI_HAL_MODULE="nfc_nci.nqx"
+#Override the stack default for NFA_EE_MAX_EE_SUPPORTED set in nfc_target.h.
+#The value is set to 3 by default as it assumes we will discover 0xF2,
+# 0xF3, and 0xF4. If a platform will exclude and SE, this value can be reduced
+#so that the stack will not wait any longer than necessary.
+
+#Maximum EE supported number
+#NXP PN547C2 0x02
+#NXP PN65T 0x03
+#NXP PN548C2 0x02
+#NXP PN66T 0x03
+NFA_MAX_EE_SUPPORTED=0x03
+
+###############################################################################
+#NCI Hal Module name
+NCI_HAL_MODULE="nfc_nci"
##############################################################################
-# Deactivate notification wait time out in seconds used in ETSI Reader mode
+#Deactivate notification wait time out in seconds used in ETSI Reader mode
# 0 - Infinite wait
NFA_DM_DISC_NTF_TIMEOUT=100
###############################################################################
-# AID_MATCHING constants
-# AID_MATCHING_EXACT_ONLY 0x00
-# AID_MATCHING_EXACT_OR_PREFIX 0x01
-# AID_MATCHING_PREFIX_ONLY 0x02
-AID_MATCHING_MODE=0x01
+#AID_MATCHING constants
+#AID_MATCHING_EXACT_ONLY 0x00
+#AID_MATCHING_EXACT_OR_PREFIX 0x01
+#AID_MATCHING_PREFIX_ONLY 0x02
+#AID_MATCHING_EXACT_OR_SUBSET_OR_PREFIX 0x03
+AID_MATCHING_MODE=0x03
###############################################################################
-# Default Secure Element route id
+#Default Secure Element route id
DEFAULT_OFFHOST_ROUTE=0x02
###############################################################################
-# Vendor Specific Proprietary Protocol & Discovery Configuration
-# Set to 0xFF if unsupported
-# byte[0] NCI_PROTOCOL_18092_ACTIVE
-# byte[1] NCI_PROTOCOL_B_PRIME
-# byte[2] NCI_PROTOCOL_DUAL
-# byte[3] NCI_PROTOCOL_15693
-# byte[4] NCI_PROTOCOL_KOVIO
-# byte[5] NCI_PROTOCOL_MIFARE
-# byte[6] NCI_DISCOVERY_TYPE_POLL_KOVIO
-# byte[7] NCI_DISCOVERY_TYPE_POLL_B_PRIME
-# byte[8] NCI_DISCOVERY_TYPE_LISTEN_B_PRIME
-NFA_PROPRIETARY_CFG={05:FF:FF:06:81:80:70:FF:FF}
+#Vendor Specific Proprietary Protocol& Discovery Configuration
+#Set to 0xFF if unsupported
+#byte[0] NCI_PROTOCOL_18092_ACTIVE
+#byte[1] NCI_PROTOCOL_B_PRIME
+#byte[2] NCI_PROTOCOL_DUAL
+#byte[3] NCI_PROTOCOL_15693
+#byte[4] NCI_PROTOCOL_KOVIO
+#byte[5] NCI_PROTOCOL_MIFARE
+#byte[6] NCI_DISCOVERY_TYPE_POLL_KOVIO
+#byte[7] NCI_DISCOVERY_TYPE_POLL_B_PRIME
+#byte[8] NCI_DISCOVERY_TYPE_LISTEN_B_PRIME
+NFA_PROPRIETARY_CFG={05 : FF : FF : 06 : 81 : 80 : 70 : FF : FF}
-#################################################################################
-# Bail out mode
-# If set to 1, NFCC is using bail out mode for either Type A or Type B poll.
+###############################################################################
+#Bail out mode
+#If set to 1, NFCC is using bail out mode for either Type A or Type B poll.
NFA_POLL_BAIL_OUT_MODE=0x01
-############################################################################## #
-#White list of Hosts
-#This values will be the Hosts(NFCEEs) in the HCI Network.
- DEVICE_HOST_WHITE_LIST={80 : 81 : C0}
+###############################################################################
+# Enable/Disable Block Route feature.
+# Block Route will restrict routing to first matched rule
+# Block Route enable 0x01
+# Block Route disable 0x00
+NFA_BLOCK_ROUTE=0x00
diff --git a/src/Android.bp b/src/Android.bp
deleted file mode 100644
index e94d026..0000000
--- a/src/Android.bp
+++ /dev/null
@@ -1,82 +0,0 @@
-cc_library_shared {
- arch: {
- arm: {
- instruction_set: "arm",
- },
- },
- name: "libnfc-nci",
- shared_libs: [
- "libcutils",
- "liblog",
- "libdl",
- "libhardware",
- "libpower",
-
- // Treble configuration
- "libhidlbase",
- "libhidltransport",
- "libhwbinder",
- "libutils",
- "android.hardware.nfc@1.0",
- "vendor.nxp.nxpnfc@1.0",
- ],
- cflags: [
- "-DBUILDCFG=1",
- "-Wno-deprecated-register",
- "-Wno-unused-parameter",
- "-Wno-missing-field-initializers",
- "-DPN547C2=1",
- "-DPN548C2=2",
- "-DPN551=3",
- "-DPN553=4",
- "-DPN557=5",
- "-DNFC_NXP_CHIP_TYPE=5",
- "-DNXP_EXTNS=TRUE",
- "-DNFC_NXP_AID_MAX_SIZE_DYN=TRUE",
- "-DNXP_NFCC_HCE_F=TRUE",
- "-DNFC_NXP_ESE=TRUE",
- "-DJCOP_VER_3_1=1",
- "-DJCOP_VER_3_2=2",
- "-DJCOP_VER_3_3=3",
- "-DJCOP_VER_4_0=4",
- "-DNFC_NXP_ESE_VER=4",
- "-DNFC_NXP_LISTEN_ROUTE_TBL_OPTIMIZATION=TRUE",
- "-DANDROID",
- "-DJCOP_WA_ENABLE=FALSE"
- ],
- local_include_dirs: [
- "include",
- "gki/ulinux",
- "gki/common",
- "hal/include",
- "hal/int",
- "nfa/include",
- "nfa/int",
- "nfc/include",
- "nfc/int",
- ],
- include_dirs: [
- "vendor/nxp/opensource/hardware/interfaces/nxpnfc/1.0/default/",
- ],
- srcs: [
- "nfa/ce/*.c",
- "nfa/dm/*.c",
- "nfa/ee/*.c",
- "nfa/hci/*.c",
- "nfa/int/*.c",
- "nfa/p2p/*.c",
- "nfa/rw/*.c",
- "nfa/sys/*.c",
- "nfc/int/*.c",
- "nfc/llcp/*.c",
- "nfc/nci/*.c",
- "nfc/ndef/*.c",
- "nfc/nfc/*.c",
- "nfc/tags/*.c",
- "adaptation/*.c",
- "adaptation/*.cpp",
- "gki/common/*.c",
- "gki/ulinux/*.c",
- "nfca_version.c",
- ],
-}
diff --git a/src/nfc/ndef/ndef_cho_utils.c b/src/nfc/ndef/ndef_cho_utils.c
deleted file mode 100644
index 4acf1c8..0000000
--- a/src/nfc/ndef/ndef_cho_utils.c
+++ /dev/null
@@ -1,628 +0,0 @@
-/******************************************************************************
- *
- * Copyright (c) 2016, The Linux Foundation. All rights reserved.
- * Not a Contribution.
- *
- * Copyright (C) 2010-2014 Broadcom Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-
-/******************************************************************************
- *
- * This file contains source code for some utility functions to help parse
- * and build NFC Data Exchange Format (NDEF) messages for Connection
- * Handover
- *
- ******************************************************************************/
-
-#include <string.h>
-#include "ndef_utils.h"
-
-/*******************************************************************************
-**
-** Static Local Functions
-*/
-static UINT8 *ndef_get_bt_oob_record (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- char *p_id_str);
-
-/*******************************************************************************
-**
-** Static data
-*/
-
-/* Handover Request Record Type */
-static UINT8 hr_rec_type[HR_REC_TYPE_LEN] = { 0x48, 0x72 }; /* "Hr" */
-
-/* Handover Select Record Type */
-static UINT8 hs_rec_type[HS_REC_TYPE_LEN] = { 0x48, 0x73 }; /* "Hs" */
-
-/* Handover Carrier recrod Type */
-static UINT8 hc_rec_type[HC_REC_TYPE_LEN] = { 0x48, 0x63 }; /* "Hc" */
-
-/* Collision Resolution Record Type */
-static UINT8 cr_rec_type[CR_REC_TYPE_LEN] = { 0x63, 0x72 }; /* "cr" */
-
-/* Alternative Carrier Record Type */
-static UINT8 ac_rec_type[AC_REC_TYPE_LEN] = { 0x61, 0x63 }; /* "ac" */
-
-/* Error Record Type */
-static UINT8 err_rec_type[ERR_REC_TYPE_LEN] = { 0x65, 0x72, 0x72 }; /* "err" */
-
-/* Bluetooth OOB Data Type */
-static UINT8 *p_bt_oob_rec_type = (UINT8 *)"application/vnd.bluetooth.ep.oob";
-
-/* Wifi WSC Data Type */
-static UINT8 *p_wifi_wsc_rec_type = (UINT8 *)"application/vnd.wfa.wsc";
-
-/*******************************************************************************
-**
-** Function NDEF_MsgCreateWktHr
-**
-** Description This function creates Handover Request Record with version.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgCreateWktHr (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- UINT8 version )
-{
- tNDEF_STATUS status;
-
- NDEF_MsgInit (p_msg, max_size, p_cur_size);
-
- /* Add record with version */
- status = NDEF_MsgAddRec (p_msg, max_size, p_cur_size,
- NDEF_TNF_WKT, hr_rec_type, HR_REC_TYPE_LEN,
- NULL, 0, &version, 1);
-
- return (status);
-}
-
-/*******************************************************************************
-**
-** Function NDEF_MsgCreateWktHs
-**
-** Description This function creates Handover Select Record with version.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgCreateWktHs (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- UINT8 version )
-{
- tNDEF_STATUS status;
-
- NDEF_MsgInit (p_msg, max_size, p_cur_size);
-
- /* Add record with version */
- status = NDEF_MsgAddRec (p_msg, max_size, p_cur_size,
- NDEF_TNF_WKT, hs_rec_type, HS_REC_TYPE_LEN,
- NULL, 0, &version, 1);
-
- return (status);
-}
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAddWktHc
-**
-** Description This function adds Handover Carrier Record.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgAddWktHc (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- char *p_id_str, UINT8 ctf,
- UINT8 carrier_type_len, UINT8 *p_carrier_type,
- UINT8 carrier_data_len, UINT8 *p_carrier_data)
-{
- tNDEF_STATUS status;
- UINT8 payload[256], *p, id_len;
- UINT32 payload_len;
-
- if (carrier_type_len + carrier_data_len + 2 > 256)
- {
- return (NDEF_MSG_INSUFFICIENT_MEM);
- }
-
- p = payload;
-
- UINT8_TO_STREAM (p, (ctf & 0x07));
- UINT8_TO_STREAM (p, carrier_type_len);
- ARRAY_TO_STREAM (p, p_carrier_type, carrier_type_len);
- ARRAY_TO_STREAM (p, p_carrier_data, carrier_data_len);
-
- payload_len = (UINT32)carrier_type_len + carrier_data_len + 2;
-
- id_len = (UINT8)strlen (p_id_str);
-
- status = NDEF_MsgAddRec (p_msg, max_size, p_cur_size,
- NDEF_TNF_WKT, hc_rec_type, HC_REC_TYPE_LEN,
- (UINT8*)p_id_str, id_len, payload, payload_len);
- return (status);
-}
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAddWktAc
-**
-** Description This function adds Alternative Carrier Record.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgAddWktAc (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- UINT8 cps, char *p_carrier_data_ref_str,
- UINT8 aux_data_ref_count, char *p_aux_data_ref_str[])
-{
- tNDEF_STATUS status;
- UINT32 payload_len;
- UINT8 ref_str_len, xx;
- UINT8 *p_rec, *p;
-
- /* get payload length first */
-
- /* CPS, length of carrier data ref, carrier data ref, Aux data reference count */
- payload_len = 3 + (UINT8)strlen (p_carrier_data_ref_str);
- for (xx = 0; xx < aux_data_ref_count; xx++)
- {
- /* Aux Data Reference length (1 byte) */
- payload_len += 1 + (UINT8)strlen (p_aux_data_ref_str[xx]);
- }
-
- /* reserve memory for payload */
- status = NDEF_MsgAddRec (p_msg, max_size, p_cur_size,
- NDEF_TNF_WKT, ac_rec_type, AC_REC_TYPE_LEN,
- NULL, 0, NULL, payload_len);
-
- if (status == NDEF_OK)
- {
- /* get AC record added at the end */
- p_rec = NDEF_MsgGetLastRecInMsg (p_msg);
-
- /* get start pointer of reserved payload */
- p = NDEF_RecGetPayload (p_rec, &payload_len);
- if(p == NULL)
- {
- status = NDEF_MSG_EMPTY_PAYLOAD;
- }
- else
- {
- /* Add Carrier Power State */
- UINT8_TO_BE_STREAM (p, cps);
-
- /* Carrier Data Reference length */
- ref_str_len = (UINT8)strlen (p_carrier_data_ref_str);
-
- UINT8_TO_BE_STREAM (p, ref_str_len);
-
- /* Carrier Data Reference */
- ARRAY_TO_BE_STREAM (p, p_carrier_data_ref_str, ref_str_len);
-
- /* Aux Data Reference Count */
- UINT8_TO_BE_STREAM (p, aux_data_ref_count);
-
- for (xx = 0; xx < aux_data_ref_count; xx++)
- {
- /* Aux Data Reference length (1 byte) */
- ref_str_len = (UINT8)strlen (p_aux_data_ref_str[xx]);
-
- UINT8_TO_BE_STREAM (p, ref_str_len);
-
- /* Aux Data Reference */
- ARRAY_TO_BE_STREAM (p, p_aux_data_ref_str[xx], ref_str_len);
- }
- }
- }
-
- return (status);
-}
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAddWktCr
-**
-** Description This function adds Collision Resolution Record.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgAddWktCr (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- UINT16 random_number )
-{
- tNDEF_STATUS status;
- UINT8 data[2], *p;
-
- p = data;
- UINT16_TO_BE_STREAM (p, random_number);
-
- status = NDEF_MsgAddRec (p_msg, max_size, p_cur_size,
- NDEF_TNF_WKT, cr_rec_type, CR_REC_TYPE_LEN,
- NULL, 0, data, 2);
- return (status);
-}
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAddWktErr
-**
-** Description This function adds Error Record.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgAddWktErr (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- UINT8 error_reason, UINT32 error_data )
-{
- tNDEF_STATUS status;
- UINT8 payload[5], *p;
- UINT32 payload_len;
-
- p = payload;
-
- UINT8_TO_BE_STREAM (p, error_reason);
-
- if (error_reason == 0x02)
- {
- UINT32_TO_BE_STREAM (p, error_data);
- payload_len = 5;
- }
- else
- {
- UINT8_TO_BE_STREAM (p, error_data);
- payload_len = 2;
- }
-
- status = NDEF_MsgAddRec (p_msg, max_size, p_cur_size,
- NDEF_TNF_WKT, err_rec_type, ERR_REC_TYPE_LEN,
- NULL, 0, payload, payload_len);
- return (status);
-}
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAddMediaBtOob
-**
-** Description This function adds BT OOB Record.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgAddMediaBtOob (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- char *p_id_str, BD_ADDR bd_addr)
-{
- tNDEF_STATUS status;
- UINT8 payload[BD_ADDR_LEN + 2];
- UINT8 *p;
- UINT8 payload_len, id_len;
-
- p = payload;
-
- /* length including itself */
- UINT16_TO_STREAM (p, BD_ADDR_LEN + 2);
-
- /* BD Addr */
- BDADDR_TO_STREAM (p, bd_addr);
-
- payload_len = BD_ADDR_LEN + 2;
- id_len = (UINT8)strlen (p_id_str);
-
- status = NDEF_MsgAddRec (p_msg, max_size, p_cur_size,
- NDEF_TNF_MEDIA, p_bt_oob_rec_type, BT_OOB_REC_TYPE_LEN,
- (UINT8*)p_id_str, id_len, payload, payload_len);
- return (status);
-}
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAppendMediaBtOobCod
-**
-** Description This function appends COD EIR data at the end of BT OOB Record.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgAppendMediaBtOobCod (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- char *p_id_str, DEV_CLASS cod)
-{
- tNDEF_STATUS status;
- UINT8 *p_rec;
- UINT8 eir_data[BT_OOB_COD_SIZE + 2];
- UINT8 *p;
- UINT8 eir_data_len;
- UINT32 oob_data_len;
-
- /* find record by Payload ID */
- p_rec = ndef_get_bt_oob_record (p_msg, max_size, p_cur_size, p_id_str);
-
- if (!p_rec)
- return (NDEF_REC_NOT_FOUND);
-
- /* create EIR data format for COD */
- p = eir_data;
- UINT8_TO_STREAM (p, BT_OOB_COD_SIZE + 1);
- UINT8_TO_STREAM (p, BT_EIR_OOB_COD_TYPE);
- DEVCLASS_TO_STREAM (p, cod);
- eir_data_len = BT_OOB_COD_SIZE + 2;
-
- /* append EIR data at the end of record */
- status = NDEF_MsgAppendPayload(p_msg, max_size, p_cur_size,
- p_rec, eir_data, eir_data_len);
-
- /* update BT OOB data length, if success */
- if (status == NDEF_OK)
- {
- /* payload length is the same as BT OOB data length */
- p = NDEF_RecGetPayload (p_rec, &oob_data_len);
- if(p == NULL)
- {
- status = NDEF_MSG_EMPTY_PAYLOAD;
- }
- else
- {
- UINT16_TO_STREAM (p, oob_data_len);
- }
- }
-
- return (status);
-}
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAppendMediaBtOobName
-**
-** Description This function appends Bluetooth Local Name EIR data
-** at the end of BT OOB Record.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgAppendMediaBtOobName (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- char *p_id_str, BOOLEAN is_complete,
- UINT8 name_len, UINT8 *p_name)
-{
- tNDEF_STATUS status;
- UINT8 *p_rec;
- UINT8 eir_data[256];
- UINT8 *p;
- UINT8 eir_data_len;
- UINT32 oob_data_len;
-
- /* find record by Payload ID */
- p_rec = ndef_get_bt_oob_record (p_msg, max_size, p_cur_size, p_id_str);
-
- if (!p_rec)
- return (NDEF_REC_NOT_FOUND);
-
- /* create EIR data format for COD */
- p = eir_data;
- UINT8_TO_STREAM (p, name_len + 1);
-
- if (is_complete)
- {
- UINT8_TO_STREAM (p, BT_EIR_COMPLETE_LOCAL_NAME_TYPE);
- }
- else
- {
- UINT8_TO_STREAM (p, BT_EIR_SHORTENED_LOCAL_NAME_TYPE);
- }
-
- ARRAY_TO_STREAM (p, p_name, name_len);
- eir_data_len = name_len + 2;
-
- /* append EIR data at the end of record */
- status = NDEF_MsgAppendPayload(p_msg, max_size, p_cur_size,
- p_rec, eir_data, eir_data_len);
-
- /* update BT OOB data length, if success */
- if (status == NDEF_OK)
- {
- /* payload length is the same as BT OOB data length */
- p = NDEF_RecGetPayload (p_rec, &oob_data_len);
- if(p == NULL)
- {
- status = NDEF_MSG_EMPTY_PAYLOAD;
- }
- else
- {
- UINT16_TO_STREAM (p, oob_data_len);
- }
- }
-
- return (status);
-}
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAppendMediaBtOobHashCRandR
-**
-** Description This function appends Hash C and Rand R at the end of BT OOB Record.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgAppendMediaBtOobHashCRandR (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- char *p_id_str, UINT8 *p_hash_c, UINT8 *p_rand_r)
-{
- tNDEF_STATUS status;
- UINT8 *p_rec;
- UINT8 eir_data[BT_OOB_HASH_C_SIZE + BT_OOB_RAND_R_SIZE + 4];
- UINT8 *p;
- UINT8 eir_data_len;
- UINT32 oob_data_len;
-
- /* find record by Payload ID */
- p_rec = ndef_get_bt_oob_record (p_msg, max_size, p_cur_size, p_id_str);
-
- if (!p_rec)
- return (NDEF_REC_NOT_FOUND);
-
- /* create EIR data format */
- p = eir_data;
-
- UINT8_TO_STREAM (p, BT_OOB_HASH_C_SIZE + 1);
- UINT8_TO_STREAM (p, BT_EIR_OOB_SSP_HASH_C_TYPE);
- ARRAY16_TO_STREAM (p, p_hash_c);
-
- UINT8_TO_STREAM (p, BT_OOB_RAND_R_SIZE + 1);
- UINT8_TO_STREAM (p, BT_EIR_OOB_SSP_RAND_R_TYPE);
- ARRAY16_TO_STREAM (p, p_rand_r);
-
- eir_data_len = BT_OOB_HASH_C_SIZE + BT_OOB_RAND_R_SIZE + 4;
-
- /* append EIR data at the end of record */
- status = NDEF_MsgAppendPayload(p_msg, max_size, p_cur_size,
- p_rec, eir_data, eir_data_len);
-
- /* update BT OOB data length, if success */
- if (status == NDEF_OK)
- {
- /* payload length is the same as BT OOB data length */
- p = NDEF_RecGetPayload (p_rec, &oob_data_len);
- if(p == NULL)
- {
- status = NDEF_MSG_EMPTY_PAYLOAD;
- }
- else
- {
- UINT16_TO_STREAM (p, oob_data_len);
- }
- }
-
- return (status);
-}
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAppendMediaBtOobEirData
-**
-** Description This function appends EIR Data at the end of BT OOB Record.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgAppendMediaBtOobEirData (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- char *p_id_str,
- UINT8 eir_type, UINT8 data_len, UINT8 *p_data)
-{
- tNDEF_STATUS status;
- UINT8 *p_rec;
- UINT8 eir_data[256];
- UINT8 *p;
- UINT8 eir_data_len;
- UINT32 oob_data_len;
-
- /* find record by Payload ID */
- p_rec = ndef_get_bt_oob_record (p_msg, max_size, p_cur_size, p_id_str);
-
- if (!p_rec)
- return (NDEF_REC_NOT_FOUND);
-
- /* create EIR data format */
- p = eir_data;
- UINT8_TO_STREAM (p, data_len + 1);
- UINT8_TO_STREAM (p, eir_type);
- ARRAY_TO_STREAM (p, p_data, data_len);
- eir_data_len = data_len + 2;
-
- /* append EIR data at the end of record */
- status = NDEF_MsgAppendPayload(p_msg, max_size, p_cur_size,
- p_rec, eir_data, eir_data_len);
-
- /* update BT OOB data length, if success */
- if (status == NDEF_OK)
- {
- /* payload length is the same as BT OOB data length */
- p = NDEF_RecGetPayload (p_rec, &oob_data_len);
- if(p == NULL)
- {
- status = NDEF_MSG_EMPTY_PAYLOAD;
- }
- else
- {
- UINT16_TO_STREAM (p, oob_data_len);
- }
- }
-
- return (status);
-}
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAddMediaWifiWsc
-**
-** Description This function adds Wifi Wsc Record header.
-**
-** Returns NDEF_OK if all OK
-**
-*******************************************************************************/
-tNDEF_STATUS NDEF_MsgAddMediaWifiWsc (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- char *p_id_str, UINT8 *p_payload, UINT32 payload_len)
-{
- tNDEF_STATUS status;
- UINT8 id_len = 0;
-
- if (p_id_str)
- id_len = (UINT8)strlen (p_id_str);
-
- status = NDEF_MsgAddRec (p_msg, max_size, p_cur_size,
- NDEF_TNF_MEDIA, p_wifi_wsc_rec_type, WIFI_WSC_REC_TYPE_LEN,
- (UINT8*)p_id_str, id_len, p_payload, payload_len);
- return (status);
-}
-
-/*******************************************************************************
-**
-** Static Local Functions
-**
-*******************************************************************************/
-/*******************************************************************************
-**
-** Function ndef_get_bt_oob_record
-**
-** Description This function returns BT OOB record which has matched payload ID
-**
-** Returns pointer of record if found, otherwise NULL
-**
-*******************************************************************************/
-static UINT8 *ndef_get_bt_oob_record (UINT8 *p_msg, UINT32 max_size, UINT32 *p_cur_size,
- char *p_id_str)
-{
- UINT8 *p_rec, *p_type;
- UINT8 id_len, tnf, type_len;
- (void)(max_size);
- (void)(p_cur_size);
-
- /* find record by Payload ID */
- id_len = (UINT8)strlen (p_id_str);
- p_rec = NDEF_MsgGetFirstRecById (p_msg, (UINT8*)p_id_str, id_len);
-
- if (!p_rec)
- return (NULL);
-
- p_type = NDEF_RecGetType (p_rec, &tnf, &type_len);
-
- /* check type if this is BT OOB record */
- if ((!p_rec)
- ||(tnf != NDEF_TNF_MEDIA)
- ||(type_len != BT_OOB_REC_TYPE_LEN)
- ||(memcmp (p_type, p_bt_oob_rec_type, BT_OOB_REC_TYPE_LEN)))
- {
- return (NULL);
- }
-
- return (p_rec);
-}