Merge cherrypicks of ['googleplex-android-review.googlesource.com/35838654', 'googleplex-android-review.googlesource.com/35838655', 'googleplex-android-review.googlesource.com/35838656'] into 25Q4-release.
Change-Id: I8ecf2ad63d2cf6db47a8c7dc583bb0fa454c6cb4
diff --git a/aidl/Android.bp b/aidl/Android.bp
index 7a8d02a..1227573 100644
--- a/aidl/Android.bp
+++ b/aidl/Android.bp
@@ -18,7 +18,7 @@
"liblog",
"libutils",
"libbinder_ndk",
- "android.hardware.nfc-V2-ndk",
+ "android.hardware.nfc-V1-ndk",
"nfc_nci.st21nfc.default",
],
srcs: [
@@ -48,7 +48,7 @@
"liblog",
"libutils",
"libbinder_ndk",
- "android.hardware.nfc-V2-ndk",
+ "android.hardware.nfc-V1-ndk",
"nfc_nci.st21nfc.default",
],
srcs: [
diff --git a/aidl/Nfc.cpp b/aidl/Nfc.cpp
index a2ff59d..0ebaa4a 100644
--- a/aidl/Nfc.cpp
+++ b/aidl/Nfc.cpp
@@ -185,11 +185,6 @@
return ndk::ScopedAStatus::ok();
}
-::ndk::ScopedAStatus Nfc::controlGranted(NfcStatus* _aidl_return) {
- LOG(INFO) << "controlGranted";
- return ndk::ScopedAStatus::ok();
-}
-
binder_status_t Nfc::dump(int fd, const char**, uint32_t) {
StNfc_hal_dump(fd);
return STATUS_OK;
diff --git a/aidl/Nfc.h b/aidl/Nfc.h
index 29d0c1f..707bd65 100644
--- a/aidl/Nfc.h
+++ b/aidl/Nfc.h
@@ -50,7 +50,6 @@
::ndk::ScopedAStatus setEnableVerboseLogging(bool enable) override;
::ndk::ScopedAStatus isVerboseLoggingEnabled(bool* _aidl_return) override;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
- ::ndk::ScopedAStatus controlGranted(NfcStatus* _aidl_return) override;
static void eventCallback(uint8_t event, uint8_t status) {
if (mCallback != nullptr) {
diff --git a/aidl/hal_st21nfc.cc b/aidl/hal_st21nfc.cc
index 638978a..0fd5553 100644
--- a/aidl/hal_st21nfc.cc
+++ b/aidl/hal_st21nfc.cc
@@ -23,7 +23,6 @@
#include <android-base/properties.h>
#include <dlfcn.h>
#include <errno.h>
-#include <stpropnci.h>
#include <string.h>
#include "StNfc_hal_api.h"
@@ -40,6 +39,11 @@
#endif
#define VENDOR_LIB_EXT ".so"
+#define CRC_PRESET_A 0x6363
+#define CRC_PRESET_B 0xFFFF
+#define Type_A 0
+#define Type_B 1
+
bool dbg_logging = false;
extern void HalCoreCallback(void* context, uint32_t event, const void* d,
@@ -48,13 +52,14 @@
typedef int (*STEseReset)(void);
-const char* halVersion = "ST21NFC AIDL Version 2.1.0";
+const char* halVersion = "ST21NFC AIDL Version 1.0.0";
uint8_t cmd_set_nfc_mode_enable[] = {0x2f, 0x02, 0x02, 0x02, 0x01};
uint8_t hal_is_closed = 1;
pthread_mutex_t hal_mtx = PTHREAD_MUTEX_INITIALIZER;
st21nfc_dev_t dev;
int nfc_mode = 0;
+uint8_t nci_cmd[256];
/*
* NCI HAL method implementations. These must be overridden
@@ -232,7 +237,6 @@
if (pthread_equal(pthread_self(), async_callback_data.thr)) {
dev.p_cback_unwrap(event, event_status);
- return;
}
ret = pthread_mutex_lock(&async_callback_data.mutex);
@@ -315,6 +319,21 @@
int StNfc_hal_write(uint16_t data_len, const uint8_t* p_data) {
STLOG_HAL_D("HAL st21nfc: %s", __func__);
+ uint8_t NCI_ANDROID_PASSIVE_OBSERVER_PREFIX[] = {0x2f, 0x0c, 0x02, 0x02};
+ uint8_t NCI_ANDROID_PASSIVE_OBSERVER_PER_TECH_PREFIX[] = {0x2f, 0x0c, 0x02,
+ 0x05};
+ uint8_t NCI_QUERY_ANDROID_PASSIVE_OBSERVER_PREFIX[] = {0x2f, 0x0c, 0x01, 0x4};
+ uint8_t NCI_ANDROID_PREFIX[] = {0x2f, 0x0c};
+ uint8_t RF_GET_LISTEN_OBSERVE_MODE_STATE[5] = {0x21, 0x17, 0x00};
+ uint8_t RF_SET_LISTEN_OBSERVE_MODE_STATE[4] = {0x21, 0x16, 0x01, 0x0};
+ uint8_t CORE_GET_CONFIG_OBSERVER[5] = {0x20, 0x03, 0x02, 0x01, 0xa3};
+ uint8_t CORE_SET_CONFIG_OBSERVER[7] = {0x20, 0x02, 0x04, 0x01,
+ 0xa3, 0x01, 0x00};
+ uint8_t* mGetObserve = CORE_GET_CONFIG_OBSERVER;
+ uint8_t mGetObserve_size = 5;
+ uint8_t* mSetObserve = CORE_SET_CONFIG_OBSERVER;
+ uint8_t mSetObserve_size = 7;
+ uint8_t mTechObserved = 0x0;
/* check if HAL is closed */
int ret = (int)data_len;
(void)pthread_mutex_lock(&hal_mtx);
@@ -327,19 +346,163 @@
return ret;
}
- // Log message Stack to Hal
- DispHal("TX DATA S2H", p_data, data_len);
-
- // Process NCI message here for prop NCI support
- if (stpropnci_process(MSG_DIR_FROM_STACK, p_data, data_len)) {
- // STLOG_HAL_V("%s - message was intercepted by stpropnci_process, consider
- // handled", __func__);
- (void)pthread_mutex_unlock(&hal_mtx);
- return ret;
+ if (data_len == 4 &&
+ !memcmp(p_data, NCI_QUERY_ANDROID_PASSIVE_OBSERVER_PREFIX,
+ sizeof(NCI_QUERY_ANDROID_PASSIVE_OBSERVER_PREFIX))) {
+ hal_wrapper_get_observer_mode();
+ if (hal_fd_getFwCap()->ObserveMode == 2) {
+ mGetObserve = RF_GET_LISTEN_OBSERVE_MODE_STATE;
+ mGetObserve_size = 3;
+ }
+ if (!HalSendDownstream(dev.hHAL, mGetObserve, mGetObserve_size)) {
+ STLOG_HAL_E("HAL st21nfc %s SendDownstream failed", __func__);
+ (void)pthread_mutex_unlock(&hal_mtx);
+ return 0;
+ }
}
- /* Default behavior: forward to the NFCC directly.*/
- if (!HalSendDownstream(dev.hHAL, p_data, data_len)) {
+ else if (data_len == 5 &&
+ !memcmp(p_data, NCI_ANDROID_PASSIVE_OBSERVER_PREFIX,
+ sizeof(NCI_ANDROID_PASSIVE_OBSERVER_PREFIX))) {
+ if (hal_fd_getFwCap()->ObserveMode == 2) {
+ mSetObserve = RF_SET_LISTEN_OBSERVE_MODE_STATE;
+ mSetObserve_size = 4;
+ if (p_data[4]) {
+ mTechObserved = 0x7;
+ }
+ mSetObserve[3] = mTechObserved;
+ hal_wrapper_set_observer_mode(mTechObserved, false);
+ } else {
+ mSetObserve[6] = p_data[4];
+ hal_wrapper_set_observer_mode(p_data[4], false);
+ }
+
+ if (!HalSendDownstream(dev.hHAL, mSetObserve, mSetObserve_size)) {
+ STLOG_HAL_E("HAL st21nfc %s SendDownstream failed", __func__);
+ (void)pthread_mutex_unlock(&hal_mtx);
+ return 0;
+ }
+ } else if (data_len == 5 &&
+ !memcmp(p_data, NCI_ANDROID_PASSIVE_OBSERVER_PER_TECH_PREFIX,
+ sizeof(NCI_ANDROID_PASSIVE_OBSERVER_PER_TECH_PREFIX))) {
+ mSetObserve = RF_SET_LISTEN_OBSERVE_MODE_STATE;
+ mSetObserve_size = 4;
+ if (p_data[4]) {
+ mTechObserved = p_data[4];
+ }
+ mSetObserve[3] = mTechObserved;
+ hal_wrapper_set_observer_mode(mTechObserved, true);
+ if (!HalSendDownstream(dev.hHAL, mSetObserve, mSetObserve_size)) {
+ STLOG_HAL_E("HAL st21nfc %s SendDownstream failed", __func__);
+ (void)pthread_mutex_unlock(&hal_mtx);
+ return 0;
+ }
+ } else if (!memcmp(p_data, NCI_ANDROID_PREFIX, sizeof(NCI_ANDROID_PREFIX)) &&
+ p_data[3] == 0x6) {
+ DispHal("TX DATA", (p_data), data_len);
+
+ memcpy(nci_cmd + 3, p_data + 4, 4);
+ nci_cmd[0] = 0x2f;
+ nci_cmd[1] = 0x19;
+
+ int index = 8;
+ int ll_index = 7;
+ uint8_t nci_length = 0;
+ uint16_t crc = 0;
+ bool prefix_match = false;
+ bool exact_match = true;
+
+ while (index < data_len) {
+ // Read the Type field (1 byte)
+ uint8_t type_field = p_data[index];
+ int tlv_len = p_data[index + 1];
+ prefix_match = false;
+ exact_match = true;
+ if (p_data[index] == 0x01) {
+ crc = iso14443_crc(p_data + index + 3, (uint8_t)((tlv_len - 1) / 2),
+ Type_B);
+ } else if ((p_data[index] & 0xF0) == 0x00) {
+ crc = iso14443_crc(p_data + index + 3, (uint8_t)((tlv_len - 1) / 2),
+ Type_A);
+ } else {
+ prefix_match = true;
+ }
+
+ nci_cmd[ll_index++] = p_data[index++];
+ nci_cmd[ll_index++] =
+ (!prefix_match) ? p_data[index++] + 4 : p_data[index++];
+ nci_cmd[ll_index++] = p_data[index++];
+
+ memcpy(nci_cmd + ll_index, p_data + index, (uint8_t)((tlv_len - 1) / 2));
+ ll_index += (tlv_len - 1) / 2;
+ index += (tlv_len - 1) / 2;
+ int crc_index = 0;
+ if (!prefix_match) {
+ crc_index = ll_index;
+ nci_cmd[ll_index++] = (uint8_t)crc;
+ nci_cmd[ll_index++] = (uint8_t)(crc >> 8);
+ }
+
+ memcpy(nci_cmd + ll_index, p_data + index, (tlv_len - 1) / 2);
+ for (int i = 0; i < (tlv_len - 1) / 2; ++i) {
+ if (p_data[index + i] != 0xFF) {
+ exact_match = false;
+ break;
+ }
+ }
+ ll_index += (tlv_len - 1) / 2;
+ index += (tlv_len - 1) / 2;
+ uint8_t crc_mask = exact_match ? 0xFF : 0x00;
+ if (!prefix_match) {
+ nci_cmd[ll_index++] = crc_mask;
+ nci_cmd[ll_index++] = crc_mask;
+
+ if (!exact_match) {
+ nci_cmd[crc_index] = crc_mask;
+ nci_cmd[crc_index + 1] = crc_mask;
+ }
+ }
+ }
+ nci_length = ll_index;
+ nci_cmd[2] = ll_index - 3;
+
+ if (!HalSendDownstream(dev.hHAL, nci_cmd, nci_length)) {
+ STLOG_HAL_E("HAL st21nfc %s SendDownstream failed", __func__);
+ (void)pthread_mutex_unlock(&hal_mtx);
+ return 0;
+ }
+ } else if (!memcmp(p_data, NCI_ANDROID_PREFIX, sizeof(NCI_ANDROID_PREFIX)) &&
+ p_data[3] == 0x9) {
+ DispHal("TX DATA", (p_data), data_len);
+ if (data_len < 5) {
+ STLOG_HAL_E("HAL st21nfc %s data_len is too short", __func__);
+ (void)pthread_mutex_unlock(&hal_mtx);
+ return 0;
+ }
+ memcpy(nci_cmd + 3, p_data + 4, data_len - 4);
+ nci_cmd[0] = 0x2f;
+ nci_cmd[1] = 0x1d;
+ if (p_data[2] == 0x2 && p_data[4] == 0x0) {
+ nci_cmd[2] = 0x1;
+ } else {
+ uint16_t crc = 0;
+ if (nci_cmd[5] > 0) {
+ crc = iso14443_crc(nci_cmd + 7, nci_cmd[5] - 1, Type_A);
+ }
+
+ uint8_t len = p_data[2];
+ nci_cmd[5] = nci_cmd[5] + 2;
+ nci_cmd[data_len - 1] = (uint8_t)crc;
+ nci_cmd[data_len] = (uint8_t)(crc >> 8);
+
+ nci_cmd[2] = p_data[2] + 1;
+ }
+ if (!HalSendDownstream(dev.hHAL, nci_cmd, nci_cmd[2] + 3)) {
+ STLOG_HAL_E("HAL st21nfc %s SendDownstream failed", __func__);
+ (void)pthread_mutex_unlock(&hal_mtx);
+ return 0;
+ }
+ } else if (!HalSendDownstream(dev.hHAL, p_data, data_len)) {
STLOG_HAL_E("HAL st21nfc %s SendDownstream failed", __func__);
(void)pthread_mutex_unlock(&hal_mtx);
return 0;
@@ -515,7 +678,6 @@
config.nfaProprietaryCfg.discoveryPollKovio = (uint8_t)buffer[6];
config.nfaProprietaryCfg.discoveryPollBPrime = (uint8_t)buffer[7];
config.nfaProprietaryCfg.discoveryListenBPrime = (uint8_t)buffer[8];
- config.nfaProprietaryCfg.protocolChineseId = (uint8_t)buffer[9];
} else {
memset(&config.nfaProprietaryCfg, 0xFF, sizeof(ProtocolDiscoveryConfig));
}
@@ -548,18 +710,6 @@
if (GetNumValue(NAME_DEFAULT_ISODEP_ROUTE, &num, sizeof(num))) {
config.defaultIsoDepRoute = num;
}
-
- if (GetByteArrayValue(NAME_OFF_HOST_SIM_PIPE_IDS, (char*)buffer.data(),
- buffer.size(), &retlen)) {
- config.offHostSimPipeIds.resize(retlen);
- for (int i = 0; i < retlen; i++) {
- config.offHostSimPipeIds[i] = buffer[i];
- }
- }
-
- if (GetNumValue(NAME_T4T_NFCEE_ENABLE, &num, sizeof(num))) {
- config.t4tNfceeEnable = num;
- }
}
void StNfc_hal_setLogging(bool enable) {
@@ -570,9 +720,27 @@
} else {
hal_trace_level = hal_conf_trace_level;
}
- stpropnci_change_log_level(hal_trace_level);
}
bool StNfc_hal_isLoggingEnabled() { return dbg_logging; }
void StNfc_hal_dump(int fd) { hal_wrapper_dumplog(fd); }
+
+uint16_t iso14443_crc(const uint8_t* data, size_t szLen, int type) {
+ uint16_t tempCrc;
+ if (type == Type_A) {
+ tempCrc = (unsigned short)CRC_PRESET_A;
+ } else {
+ tempCrc = (unsigned short)CRC_PRESET_B;
+ }
+ do {
+ uint8_t bt;
+ bt = *data++;
+ bt = (bt ^ (uint8_t)(tempCrc & 0x00FF));
+ bt = (bt ^ (bt << 4));
+ tempCrc = (tempCrc >> 8) ^ ((uint32_t)bt << 8) ^ ((uint32_t)bt << 3) ^
+ ((uint32_t)bt >> 4);
+ } while (--szLen);
+
+ return tempCrc;
+}
diff --git a/libstpropnci/Android.bp b/libstpropnci/Android.bp
deleted file mode 100755
index 7f1e93a..0000000
--- a/libstpropnci/Android.bp
+++ /dev/null
@@ -1,71 +0,0 @@
-package {
- default_team: "trendy_team_fwk_nfc",
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "Android-Apache-2.0"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-// Default - START
-/* We use headers from libstnfc-nci for the NCI protocol definitions */
-cc_library_headers {
- name: "libstnfc-nci-headers-vendor",
- vendor_available: true,
- export_include_dirs: [
- "libstnfc-nci-headers/src/nfa/include",
- "libstnfc-nci-headers/src/nfc/include",
- "libstnfc-nci-headers/src/include",
- "libstnfc-nci-headers/src/gki/ulinux",
- "libstnfc-nci-headers/src/gki/common",
- "libstnfc-nci-headers/src/nfc_vendor_extn/include",
- "libstnfc-nci-headers/utils/include",
- ],
-}
-
-cc_library_static {
- name: "libstpropnci-vendor",
- vendor_available: true,
- local_include_dirs: [
- "include",
- "src",
- ],
- header_libs: [
- "libstnfc-nci-headers-vendor",
- ],
- export_header_lib_headers: [
- "libstnfc-nci-headers-vendor",
- ],
-
- export_include_dirs: [
- "include",
- ],
- srcs: [
- "src/*.cc",
- ],
- cflags: [
- "-Wall",
- "-Werror",
- "-Wimplicit-fallthrough",
- "-DST21NFC",
- ],
- stl: "libc++_static",
- product_variables: {
- debuggable: {
- cflags: [
- "-DDCHECK_ALWAYS_ON",
- ],
- },
- },
- shared_libs: [
- "libcutils",
- "liblog",
- "libbase",
- ],
- target: {
- vendor: {
- cflags: ["-DSTPROPNCI_VENDOR"],
- },
- },
-}
diff --git a/libstpropnci/include/stpropnci.h b/libstpropnci/include/stpropnci.h
deleted file mode 100755
index a817338..0000000
--- a/libstpropnci/include/stpropnci.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2025 STMicroelectronics
- *
- * 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.
- *
- ******************************************************************************/
-
-#ifndef STPROPNCI_H
-#define STPROPNCI_H
-
-#include <stdint.h>
-
-// b15..12: flavour; b11..0: version
-// flavours: 0: base ST stack.
-#define STPROPNCI_LIB_VERSION 0x0001
-
-struct halconfig {
- int hal_field_timer;
- int hal_activerw_timer;
- int hal_trace_level;
-};
-/***************/
-/* Library API */
-/***************/
-
-/*
- * outgoing_cb_t callback:
- *
- * Caller must provide a function for this library to send a message.
- * This function may be called from the same thread that called
- * stpropnci_process or another thread. Up to the caller to implement a message
- * queue to change threads if needed.
- *
- * dir_to_nfcc: if true, the payload is a CMD or DATA and shall be sent to the
- * NFCC. If false, it is RSP, NTF, or DATA and to be passed to the stack.
- * payload: a buffer in the library memory space. The memory will be freed after
- * this callback returns. payloadlen: the length of data inside payload buffer.
- *
- * returns: none.
- */
-typedef void (*outgoing_cb_t)(bool dir_to_nfcc, uint8_t* payload,
- uint16_t payloadlen);
-
-#define MSG_DIR_TO_STACK false
-#define MSG_DIR_TO_NFCC true
-
-/*
- * stpropnci_init:
- *
- * Initialize the library and registers the outgoing_cb of the caller.
- *
- * loglvl: 0: no logs at all. 1: information and errors. 2: debug
- * cb: method that will send outgoing messages.
- *
- * returns: true if the initialization is successful, false otherwise.
- */
-bool stpropnci_init(int loglvl, outgoing_cb_t cb);
-
-/*
- * stpropnci_change_log_level:
- *
- * This enables to update the log level of the library.
- *
- * loglvl: 0: no logs at all. 1: information and errors. 2: debug
- */
-void stpropnci_change_log_level(int loglvl);
-
-/*
- * stpropnci_config_settings:
- *
- * Update configs from the conf file.
- *
- * halconfig : struct containing different configs values.
- */
-void stpropnci_config_settings(halconfig& halconfig);
-
-/*
- * stpropnci_st_set_hal_passthrough:
- *
- * For HAL AIDL version > 1, make sure the HAL's libstpropnci does not interfere
- */
-void stpropnci_st_set_hal_passthrough();
-
-/*
- * stpropnci_deinit:
- *
- * Caller can call this when NFC is disabled, so resources may be freed.
- *
- */
-void stpropnci_deinit();
-
-/*
- * stpropnci_process:
- *
- * Process an NCI message.
- * This function is not reentrant; it will be blocking until a previous call has
- * returned.
- *
- * dir_from_upper: if true, the payload is a CMD or DATA and coming from the
- * stack. if false, it is RSP, NTF, or DATA and coming from NFCC. payload: a
- * buffer in the caller memory space. The memory can be freed after this
- * function returns. payloadlen: the length of data inside payload buffer.
- *
- * returns: true if the message has been processed and caller can discard it,
- * false if caller should forward it directly.
- */
-bool stpropnci_process(bool dir_from_upper, const uint8_t* payload,
- const uint16_t payloadlen);
-
-#define MSG_DIR_FROM_STACK true
-#define MSG_DIR_FROM_NFCC false
-
-/*
- * stpropnci_inform:
- *
- * Just let the library know about a message but no handling expected.
- * This is used by the HAL in its own wrapper processing.
- *
- * This function is not reentrant; it will be blocking until a previous call has
- * returned.
- *
- * dir_from_upper: if true, the payload is a CMD or DATA and coming from the
- * stack. if false, it is RSP, NTF, or DATA and coming from NFCC. payload: a
- * buffer in the caller memory space. The memory can be freed after this
- * function returns. payloadlen: the length of data inside payload buffer.
- *
- * returns: n/a
- */
-void stpropnci_inform(bool dir_from_upper, const uint8_t* payload,
- const uint16_t payloadlen);
-
-
-
-#endif // STPROPNCI_H
diff --git a/libstpropnci/libstnfc-nci-headers/src/gki/common/gki.h b/libstpropnci/libstnfc-nci-headers/src/gki/common/gki.h
deleted file mode 100755
index e8414f5..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/gki/common/gki.h
+++ /dev/null
@@ -1,531 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-2012 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.
- *
- ******************************************************************************/
-#ifndef GKI_H
-#define GKI_H
-
-#ifdef BUILDCFG
-#include "buildcfg.h"
-#endif
-
-#ifndef NFC_STANDALONE
-#define NFC_STANDALONE FALSE
-#endif
-
-#ifdef NFC_INTEGRATION_FUZZER
-#include <list>
-#endif
-
-#include <string>
-
-#include "bt_types.h"
-#include "gki_target.h"
-
-/* Error codes */
-#define GKI_SUCCESS 0x00
-#define GKI_FAILURE 0x01
-#define GKI_INVALID_TASK 0xF0
-#define GKI_INVALID_POOL 0xFF
-
-/************************************************************************
-** Mailbox definitions. Each task has 4 mailboxes that are used to
-** send buffers to the task.
-*/
-#define TASK_MBOX_0 0
-#define TASK_MBOX_2 2
-
-#define NUM_TASK_MBOX 4
-
-/************************************************************************
-** Event definitions.
-**
-** There are 4 reserved events used to signal messages rcvd in task mailboxes.
-** There are 4 reserved events used to signal timeout events.
-** There are 8 general purpose events available for applications.
-*/
-
-#define TASK_MBOX_0_EVT_MASK 0x0001
-#define TASK_MBOX_1_EVT_MASK 0x0002
-#define TASK_MBOX_2_EVT_MASK 0x0004
-#define TASK_MBOX_3_EVT_MASK 0x0008
-
-#define TIMER_0 0
-#define TIMER_1 1
-#define TIMER_2 2
-#define TIMER_3 3
-
-#define TIMER_0_EVT_MASK 0x0010
-#define TIMER_1_EVT_MASK 0x0020
-#define TIMER_2_EVT_MASK 0x0040
-#define TIMER_3_EVT_MASK 0x0080
-
-#define APPL_EVT_0 8
-#define APPL_EVT_7 15
-
-#define EVENT_MASK(evt) ((uint16_t)(0x0001 << (evt)))
-
-/************************************************************************
-** Max Time Queue
-**/
-#ifndef GKI_MAX_TIMER_QUEUES
-#define GKI_MAX_TIMER_QUEUES 3
-#endif
-
-/************************************************************************
-** Utility macros for timer conversion
-**/
-#ifdef TICKS_PER_SEC
-#define GKI_MS_TO_TICKS(x) ((x) / (1000 / TICKS_PER_SEC))
-#define GKI_SECS_TO_TICKS(x) ((x) * (TICKS_PER_SEC))
-#define GKI_TICKS_TO_MS(x) ((x) * (1000 / TICKS_PER_SEC))
-#define GKI_TICKS_TO_SECS(x) ((x) * (1 / TICKS_PER_SEC))
-#endif
-
-/************************************************************************
-** Macro to determine the pool buffer size based on the GKI POOL ID at compile
-** time. Pool IDs index from 0 to GKI_NUM_FIXED_BUF_POOLS - 1
-*/
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 1)
-
-#ifndef GKI_POOL_ID_0
-#define GKI_POOL_ID_0 0
-#endif /* ifndef GKI_POOL_ID_0 */
-
-#ifndef GKI_BUF0_SIZE
-#define GKI_BUF0_SIZE 0
-#endif /* ifndef GKI_BUF0_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 1 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 2)
-
-#ifndef GKI_POOL_ID_1
-#define GKI_POOL_ID_1 0
-#endif /* ifndef GKI_POOL_ID_1 */
-
-#ifndef GKI_BUF1_SIZE
-#define GKI_BUF1_SIZE 0
-#endif /* ifndef GKI_BUF1_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 2 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 3)
-
-#ifndef GKI_POOL_ID_2
-#define GKI_POOL_ID_2 0
-#endif /* ifndef GKI_POOL_ID_2 */
-
-#ifndef GKI_BUF2_SIZE
-#define GKI_BUF2_SIZE 0
-#endif /* ifndef GKI_BUF2_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 3 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 4)
-
-#ifndef GKI_POOL_ID_3
-#define GKI_POOL_ID_3 0
-#endif /* ifndef GKI_POOL_ID_4 */
-
-#ifndef GKI_BUF3_SIZE
-#define GKI_BUF3_SIZE 0
-#endif /* ifndef GKI_BUF3_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 4 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 5)
-
-#ifndef GKI_POOL_ID_4
-#define GKI_POOL_ID_4 0
-#endif /* ifndef GKI_POOL_ID_4 */
-
-#ifndef GKI_BUF4_SIZE
-#define GKI_BUF4_SIZE 0
-#endif /* ifndef GKI_BUF4_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 5 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 6)
-
-#ifndef GKI_POOL_ID_5
-#define GKI_POOL_ID_5 0
-#endif /* ifndef GKI_POOL_ID_5 */
-
-#ifndef GKI_BUF5_SIZE
-#define GKI_BUF5_SIZE 0
-#endif /* ifndef GKI_BUF5_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 6 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 7)
-
-#ifndef GKI_POOL_ID_6
-#define GKI_POOL_ID_6 0
-#endif /* ifndef GKI_POOL_ID_6 */
-
-#ifndef GKI_BUF6_SIZE
-#define GKI_BUF6_SIZE 0
-#endif /* ifndef GKI_BUF6_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 7 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 8)
-
-#ifndef GKI_POOL_ID_7
-#define GKI_POOL_ID_7 0
-#endif /* ifndef GKI_POOL_ID_7 */
-
-#ifndef GKI_BUF7_SIZE
-#define GKI_BUF7_SIZE 0
-#endif /* ifndef GKI_BUF7_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 8 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 9)
-
-#ifndef GKI_POOL_ID_8
-#define GKI_POOL_ID_8 0
-#endif /* ifndef GKI_POOL_ID_8 */
-
-#ifndef GKI_BUF8_SIZE
-#define GKI_BUF8_SIZE 0
-#endif /* ifndef GKI_BUF8_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 9 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 10)
-
-#ifndef GKI_POOL_ID_9
-#define GKI_POOL_ID_9 0
-#endif /* ifndef GKI_POOL_ID_9 */
-
-#ifndef GKI_BUF9_SIZE
-#define GKI_BUF9_SIZE 0
-#endif /* ifndef GKI_BUF9_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 10 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 11)
-
-#ifndef GKI_POOL_ID_10
-#define GKI_POOL_ID_10 0
-#endif /* ifndef GKI_POOL_ID_10 */
-
-#ifndef GKI_BUF10_SIZE
-#define GKI_BUF10_SIZE 0
-#endif /* ifndef GKI_BUF10_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 11 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 12)
-
-#ifndef GKI_POOL_ID_11
-#define GKI_POOL_ID_11 0
-#endif /* ifndef GKI_POOL_ID_11 */
-
-#ifndef GKI_BUF11_SIZE
-#define GKI_BUF11_SIZE 0
-#endif /* ifndef GKI_BUF11_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 12 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 13)
-
-#ifndef GKI_POOL_ID_12
-#define GKI_POOL_ID_12 0
-#endif /* ifndef GKI_POOL_ID_12 */
-
-#ifndef GKI_BUF12_SIZE
-#define GKI_BUF12_SIZE 0
-#endif /* ifndef GKI_BUF12_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 13 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 14)
-
-#ifndef GKI_POOL_ID_13
-#define GKI_POOL_ID_13 0
-#endif /* ifndef GKI_POOL_ID_13 */
-
-#ifndef GKI_BUF13_SIZE
-#define GKI_BUF13_SIZE 0
-#endif /* ifndef GKI_BUF13_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 14 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 15)
-
-#ifndef GKI_POOL_ID_14
-#define GKI_POOL_ID_14 0
-#endif /* ifndef GKI_POOL_ID_14 */
-
-#ifndef GKI_BUF14_SIZE
-#define GKI_BUF14_SIZE 0
-#endif /* ifndef GKI_BUF14_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 15 */
-
-#if (GKI_NUM_FIXED_BUF_POOLS < 16)
-
-#ifndef GKI_POOL_ID_15
-#define GKI_POOL_ID_15 0
-#endif /* ifndef GKI_POOL_ID_15 */
-
-#ifndef GKI_BUF15_SIZE
-#define GKI_BUF15_SIZE 0
-#endif /* ifndef GKI_BUF15_SIZE */
-
-#endif /* GKI_NUM_FIXED_BUF_POOLS < 16 */
-
-#ifndef GKI_SHUTDOWN_EVT
-#define GKI_SHUTDOWN_EVT APPL_EVT_7
-#endif
-
-/* Timer list entry callback type */
-struct TIMER_LIST_ENT;
-typedef void(TIMER_CBACK)(TIMER_LIST_ENT* p_tle);
-
-/* Define a timer list entry */
-#ifdef NFC_INTEGRATION_FUZZER
-struct TIMER_LIST_ENT {
- TIMER_CBACK* p_cback;
- int32_t ticks;
- uintptr_t param;
- uint16_t event;
- uint8_t in_use;
-};
-#else
-struct TIMER_LIST_ENT {
- TIMER_LIST_ENT* p_next;
- TIMER_LIST_ENT* p_prev;
- TIMER_CBACK* p_cback;
- int32_t ticks;
- uintptr_t param;
- uint16_t event;
- uint8_t in_use;
-};
-#endif
-
-/* Define a timer list queue */
-#ifdef NFC_INTEGRATION_FUZZER
-typedef std::list<TIMER_LIST_ENT*> TIMER_LIST_Q;
-#else
-typedef struct {
- TIMER_LIST_ENT* p_first;
- TIMER_LIST_ENT* p_last;
- int32_t last_ticks;
-} TIMER_LIST_Q;
-#endif
-
-/***********************************************************************
-** This queue is a general purpose buffer queue, for application use.
-*/
-typedef struct {
- void* p_first;
- void* p_last;
- uint16_t count;
-} BUFFER_Q;
-
-/* Task constants */
-#ifndef TASKPTR
-typedef uint32_t (*TASKPTR)(uint32_t);
-#endif
-
-/* General pool accessible to GKI_getbuf() */
-#define GKI_RESTRICTED_POOL 1 /* Inaccessible pool to GKI_getbuf() */
-
-/***********************************************************************
-** Function prototypes
-*/
-
-/* Task management */
-extern uint8_t GKI_create_task(TASKPTR, uint8_t, int8_t*, uint16_t*, uint16_t,
- void*, void*);
-extern void GKI_exit_task(uint8_t);
-extern uint8_t GKI_get_taskid(void);
-extern void GKI_init(void);
-extern int8_t* GKI_map_taskname(uint8_t);
-extern uint8_t GKI_resume_task(uint8_t);
-extern void GKI_run(void*);
-extern void GKI_stop(void);
-extern uint8_t GKI_suspend_task(uint8_t);
-
-/* memory management */
-extern void GKI_shiftdown(uint8_t* p_mem, uint32_t len, uint32_t shift_amount);
-extern void GKI_shiftup(uint8_t* p_dest, uint8_t* p_src, uint32_t len);
-
-/* To send buffers and events between tasks */
-extern uint8_t GKI_isend_event(uint8_t, uint16_t);
-extern void GKI_isend_msg(uint8_t, uint8_t, void*);
-extern void* GKI_read_mbox(uint8_t);
-extern void GKI_send_msg(uint8_t, uint8_t, void*);
-extern uint8_t GKI_send_event(uint8_t, uint16_t);
-
-/* To get and release buffers, change owner and get size */
-extern void GKI_change_buf_owner(void*, uint8_t);
-extern uint8_t GKI_create_pool(uint16_t, uint16_t, uint8_t, void*);
-extern void GKI_delete_pool(uint8_t);
-extern void* GKI_find_buf_start(void*);
-extern void GKI_freebuf(void*);
-extern void* GKI_getbuf(uint16_t);
-extern uint16_t GKI_get_buf_size(void*);
-extern void* GKI_getpoolbuf(uint8_t);
-
-extern uint16_t GKI_poolcount(uint8_t);
-extern uint16_t GKI_poolfreecount(uint8_t);
-extern uint16_t GKI_poolutilization(uint8_t);
-extern void GKI_register_mempool(void* p_mem);
-extern uint8_t GKI_set_pool_permission(uint8_t, uint8_t);
-
-/* User buffer queue management */
-extern void* GKI_dequeue(BUFFER_Q*);
-extern void GKI_enqueue(BUFFER_Q*, void*);
-extern void GKI_enqueue_head(BUFFER_Q*, void*);
-extern void* GKI_getfirst(BUFFER_Q*);
-extern void* GKI_getlast(BUFFER_Q*);
-extern void* GKI_getnext(void*);
-extern void GKI_init_q(BUFFER_Q*);
-extern bool GKI_queue_is_empty(BUFFER_Q*);
-extern void* GKI_remove_from_queue(BUFFER_Q*, void*);
-extern uint16_t GKI_get_pool_bufsize(uint8_t);
-
-/* Timer management */
-extern void GKI_add_to_timer_list(TIMER_LIST_Q*, TIMER_LIST_ENT*);
-extern void GKI_delay(uint32_t);
-extern uint32_t GKI_get_tick_count(void);
-extern int8_t* GKI_get_time_stamp(int8_t*);
-extern void GKI_init_timer_list(TIMER_LIST_Q*);
-extern void GKI_init_timer_list_entry(TIMER_LIST_ENT*);
-extern int32_t GKI_ready_to_sleep(void);
-extern void GKI_remove_from_timer_list(TIMER_LIST_Q*, TIMER_LIST_ENT*);
-extern void GKI_start_timer(uint8_t, int32_t, bool);
-extern void GKI_stop_timer(uint8_t);
-extern void GKI_timer_update(int32_t);
-extern bool GKI_timer_list_empty(TIMER_LIST_Q*);
-extern TIMER_LIST_ENT* GKI_timer_list_first(TIMER_LIST_Q*);
-extern uint16_t GKI_update_timer_list(TIMER_LIST_Q*, int32_t);
-extern uint32_t GKI_get_remaining_ticks(TIMER_LIST_Q*, TIMER_LIST_ENT*);
-extern uint16_t GKI_wait(uint16_t, uint32_t);
-
-/* Start and Stop system time tick callback
- * true for start system tick if time queue is not empty
- * false to stop system tick if time queue is empty
- */
-typedef void(SYSTEM_TICK_CBACK)(bool);
-
-/* Time queue management for system ticks */
-extern bool GKI_timer_queue_empty(void);
-extern void GKI_timer_queue_register_callback(SYSTEM_TICK_CBACK*);
-
-/* Disable Interrupts, Enable Interrupts */
-extern void GKI_enable(void);
-extern void GKI_disable(void);
-extern void GKI_sched_lock(void);
-extern void GKI_sched_unlock(void);
-
-/* Allocate (Free) memory from an OS */
-extern void* GKI_os_malloc(uint32_t);
-extern void GKI_os_free(void*);
-
-/* os timer operation */
-extern uint32_t GKI_get_os_tick_count(void);
-
-/* Exception handling */
-extern void GKI_exception(uint16_t, std::string);
-
-class GkiUtilsInterface {
- public:
- virtual ~GkiUtilsInterface() = default;
- virtual void remove_from_timer_list(TIMER_LIST_Q* p_timer_listq,
- TIMER_LIST_ENT* p_tle) = 0;
- virtual void stop_timer(uint8_t tnum) = 0;
- virtual bool timer_list_empty(TIMER_LIST_Q* p_list) = 0;
- virtual void start_timer(uint8_t timer_id, uint32_t ticks, bool periodic) = 0;
- virtual uint8_t get_taskid() = 0;
- virtual void* getbuf(uint16_t size) = 0;
- virtual void send_msg(uint8_t task_id, uint8_t mailbox_id, void* p_msg) = 0;
- virtual void add_to_timer_list(TIMER_LIST_Q* p_list,
- TIMER_LIST_ENT* p_tle) = 0;
- virtual uint16_t update_timer_list(TIMER_LIST_Q* p_timer_listq,
- int32_t num_units_since_last_update) = 0;
- virtual TIMER_LIST_ENT* timer_list_first(TIMER_LIST_Q* p_timer_listq) = 0;
- virtual void freebuf(void* p_buf) = 0;
- virtual void enqueue(BUFFER_Q* p_q, void* p_buf) = 0;
- virtual void* dequeue(BUFFER_Q* p_q) = 0;
- virtual void* getpoolbuf(uint8_t pool_id) = 0;
- virtual void* read_mbox(uint8_t) = 0;
- virtual void* remove_from_queue(BUFFER_Q* p_q, void* p_buf) = 0;
- virtual void* getlast(BUFFER_Q* p_q) = 0;
-};
-
-class GkiUtils : public GkiUtilsInterface {
- public:
- void remove_from_timer_list(TIMER_LIST_Q* p_timer_listq,
- TIMER_LIST_ENT* p_tle) override {
- GKI_remove_from_timer_list(p_timer_listq, p_tle);
- }
-
- void stop_timer(uint8_t tnum) override { GKI_stop_timer(tnum); }
-
- bool timer_list_empty(TIMER_LIST_Q* p_list) override {
- return GKI_timer_list_empty(p_list);
- }
-
- void start_timer(uint8_t timer_id, uint32_t ticks, bool periodic) override {
- GKI_start_timer(timer_id, ticks, periodic);
- }
-
- uint8_t get_taskid() override { return GKI_get_taskid(); }
-
- void* getbuf(uint16_t size) override { return GKI_getbuf(size); }
-
- void send_msg(uint8_t task_id, uint8_t mailbox_id, void* p_msg) override {
- GKI_send_msg(task_id, mailbox_id, p_msg);
- }
-
- void add_to_timer_list(TIMER_LIST_Q* p_list, TIMER_LIST_ENT* p_tle) override {
- GKI_add_to_timer_list(p_list, p_tle);
- }
-
- uint16_t update_timer_list(TIMER_LIST_Q* p_timer_listq,
- int32_t num_units_since_last_update) override {
- return GKI_update_timer_list(p_timer_listq, num_units_since_last_update);
- };
-
- TIMER_LIST_ENT* timer_list_first(TIMER_LIST_Q* p_timer_listq) override {
- return GKI_timer_list_first(p_timer_listq);
- };
-
- void freebuf(void* p_buf) override { GKI_freebuf(p_buf); };
- void enqueue(BUFFER_Q* p_q, void* p_buf) override {
- GKI_enqueue(p_q, p_buf);
- };
- void* dequeue(BUFFER_Q* p_q) override { return GKI_dequeue(p_q); };
- void* getpoolbuf(uint8_t pool_id) override {
- return GKI_getpoolbuf(pool_id);
- };
- void* read_mbox(uint8_t id) override { return GKI_read_mbox(id); };
- void* remove_from_queue(BUFFER_Q* p_q, void* p_buf) override {
- return GKI_remove_from_queue(p_q, p_buf);
- };
- void* getlast(BUFFER_Q* p_q) override { return GKI_getlast(p_q); }
-};
-
-extern GkiUtilsInterface* gki_utils;
-
-#endif
diff --git a/libstpropnci/libstnfc-nci-headers/src/gki/common/gki_common.h b/libstpropnci/libstnfc-nci-headers/src/gki/common/gki_common.h
deleted file mode 100755
index 437ace9..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/gki/common/gki_common.h
+++ /dev/null
@@ -1,272 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-2012 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.
- *
- ******************************************************************************/
-#ifndef GKI_COMMON_H
-#define GKI_COMMON_H
-
-#include "gki.h"
-
-/* Task States: (For OSRdyTbl) */
-#define TASK_DEAD 0 /* b0000 */
-#define TASK_READY 1 /* b0001 */
-
-/********************************************************************
-** Internal Error codes
-*********************************************************************/
-#define GKI_ERROR_BUF_CORRUPTED 0xFFFF
-#define GKI_ERROR_NOT_BUF_OWNER 0xFFFE
-#define GKI_ERROR_FREEBUF_BAD_QID 0xFFFD
-#define GKI_ERROR_FREEBUF_BUF_LINKED 0xFFFC
-#define GKI_ERROR_SEND_MSG_BAD_DEST 0xFFFB
-#define GKI_ERROR_SEND_MSG_BUF_LINKED 0xFFFA
-#define GKI_ERROR_ENQUEUE_BUF_LINKED 0xFFF9
-#define GKI_ERROR_DELETE_POOL_BAD_QID 0xFFF8
-#define GKI_ERROR_BUF_SIZE_TOOBIG 0xFFF7
-#define GKI_ERROR_BUF_SIZE_ZERO 0xFFF6
-
-/********************************************************************
-** Misc constants
-*********************************************************************/
-
-#define GKI_MAX_INT32 (0x7fffffffL)
-
-/********************************************************************
-** Buffer Management Data Structures
-*********************************************************************/
-
-typedef struct _buffer_hdr {
- struct _buffer_hdr* p_next; /* next buffer in the queue */
- uint8_t q_id; /* id of the queue */
- uint8_t task_id; /* task which allocated the buffer*/
- uint8_t status; /* FREE, UNLINKED or QUEUED */
- uint8_t Type;
-#if defined(DYN_ALLOC) || defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
- uint16_t size;
-#endif
-} BUFFER_HDR_T;
-
-typedef struct _free_queue {
- BUFFER_HDR_T* p_first; /* first buffer in the queue */
- BUFFER_HDR_T* p_last; /* last buffer in the queue */
- uint16_t size; /* size of the buffers in the pool */
- uint16_t total; /* toatal number of buffers */
- uint16_t cur_cnt; /* number of buffers currently allocated */
- uint16_t max_cnt; /* maximum number of buffers allocated at any time */
-} FREE_QUEUE_T;
-
-/* Buffer related defines */
-#define ALIGN_POOL(pl_size) \
- ((((pl_size) + 3) / sizeof(uint32_t)) * sizeof(uint32_t))
-/* Offset past header */
-#define BUFFER_HDR_SIZE (sizeof(BUFFER_HDR_T))
-/* Header + Magic Number */
-#define BUFFER_PADDING_SIZE (sizeof(BUFFER_HDR_T) + sizeof(uint32_t))
-/* pool size must allow for header */
-#define MAX_USER_BUF_SIZE ((uint16_t)0xffff - BUFFER_PADDING_SIZE)
-#define MAGIC_NO 0xDDBADDBA
-
-#define BUF_STATUS_FREE 0
-#define BUF_STATUS_UNLINKED 1
-#define BUF_STATUS_QUEUED 2
-
-/* Put all GKI variables into one control block */
-typedef struct {
- /* Task management variables */
- /* The stack and stack size are not used on Windows */
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 0)
- uint8_t bufpool0[(ALIGN_POOL(GKI_BUF0_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF0_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 1)
- uint8_t bufpool1[(ALIGN_POOL(GKI_BUF1_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF1_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 2)
- uint8_t bufpool2[(ALIGN_POOL(GKI_BUF2_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF2_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 3)
- uint8_t bufpool3[(ALIGN_POOL(GKI_BUF3_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF3_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 4)
- uint8_t bufpool4[(ALIGN_POOL(GKI_BUF4_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF4_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 5)
- uint8_t bufpool5[(ALIGN_POOL(GKI_BUF5_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF5_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 6)
- uint8_t bufpool6[(ALIGN_POOL(GKI_BUF6_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF6_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 7)
- uint8_t bufpool7[(ALIGN_POOL(GKI_BUF7_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF7_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 8)
- uint8_t bufpool8[(ALIGN_POOL(GKI_BUF8_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF8_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 9)
- uint8_t bufpool9[(ALIGN_POOL(GKI_BUF9_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF9_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 10)
- uint8_t bufpool10[(ALIGN_POOL(GKI_BUF10_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF10_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 11)
- uint8_t bufpool11[(ALIGN_POOL(GKI_BUF11_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF11_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 12)
- uint8_t bufpool12[(ALIGN_POOL(GKI_BUF12_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF12_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 13)
- uint8_t bufpool13[(ALIGN_POOL(GKI_BUF13_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF13_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 14)
- uint8_t bufpool14[(ALIGN_POOL(GKI_BUF14_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF14_MAX];
-#endif
-
-#if (GKI_NUM_FIXED_BUF_POOLS > 15)
- uint8_t bufpool15[(ALIGN_POOL(GKI_BUF15_SIZE) + BUFFER_PADDING_SIZE) *
- GKI_BUF15_MAX];
-#endif
-
- uint8_t* OSStack[GKI_MAX_TASKS]; /* pointer to beginning of stack */
- uint16_t OSStackSize[GKI_MAX_TASKS]; /* stack size available to each task */
-
- int8_t* OSTName[GKI_MAX_TASKS]; /* name of the task */
-
- uint8_t OSRdyTbl[GKI_MAX_TASKS]; /* current state of the task */
- uint16_t OSWaitEvt[GKI_MAX_TASKS]; /* events that have to be processed by the
- task */
- uint16_t OSWaitForEvt[GKI_MAX_TASKS]; /* events the task is waiting for*/
-
- uint32_t OSTicks; /* system ticks from start */
- uint32_t OSIdleCnt; /* idle counter */
- int16_t
- OSDisableNesting; /* counter to keep track of interrupt disable nesting */
- int16_t OSLockNesting; /* counter to keep track of sched lock nesting */
- int16_t OSIntNesting; /* counter to keep track of interrupt nesting */
-
- /* Timer related variables */
- int32_t OSTicksTilExp; /* Number of ticks till next timer expires */
-#if (GKI_DELAY_STOP_SYS_TICK > 0)
- uint32_t OSTicksTilStop; /* inactivity delay timer; OS Ticks till stopping
- system tick */
-#endif
- int32_t OSNumOrigTicks; /* Number of ticks between last timer expiration to
- the next one */
-
- int32_t OSWaitTmr[GKI_MAX_TASKS]; /* ticks the task has to wait, for specific
- events */
-
-/* Only take up space timers used in the system (GKI_NUM_TIMERS defined in
- * target.h) */
-#if (GKI_NUM_TIMERS > 0)
- int32_t OSTaskTmr0[GKI_MAX_TASKS];
- int32_t OSTaskTmr0R[GKI_MAX_TASKS];
-#endif
-
-#if (GKI_NUM_TIMERS > 1)
- int32_t OSTaskTmr1[GKI_MAX_TASKS];
- int32_t OSTaskTmr1R[GKI_MAX_TASKS];
-#endif
-
-#if (GKI_NUM_TIMERS > 2)
- int32_t OSTaskTmr2[GKI_MAX_TASKS];
- int32_t OSTaskTmr2R[GKI_MAX_TASKS];
-#endif
-
-#if (GKI_NUM_TIMERS > 3)
- int32_t OSTaskTmr3[GKI_MAX_TASKS];
- int32_t OSTaskTmr3R[GKI_MAX_TASKS];
-#endif
-
- /* Buffer related variables */
- BUFFER_HDR_T* OSTaskQFirst[GKI_MAX_TASKS]
- [NUM_TASK_MBOX]; /* array of pointers to the first
- event in the task mailbox */
- BUFFER_HDR_T* OSTaskQLast[GKI_MAX_TASKS]
- [NUM_TASK_MBOX]; /* array of pointers to the last
- event in the task mailbox */
-
- /* Define the buffer pool management variables */
- FREE_QUEUE_T freeq[GKI_NUM_TOTAL_BUF_POOLS];
-
- uint16_t pool_buf_size[GKI_NUM_TOTAL_BUF_POOLS];
- uint16_t pool_max_count[GKI_NUM_TOTAL_BUF_POOLS];
- uint16_t pool_additions[GKI_NUM_TOTAL_BUF_POOLS];
-
- /* Define the buffer pool start addresses */
- uint8_t* pool_start[GKI_NUM_TOTAL_BUF_POOLS]; /* array of pointers to the
- start of each buffer pool */
- uint8_t* pool_end[GKI_NUM_TOTAL_BUF_POOLS]; /* array of pointers to the end of
- each buffer pool */
- uint16_t pool_size[GKI_NUM_TOTAL_BUF_POOLS]; /* actual size of the buffers in
- a pool */
-
- /* Define the buffer pool access control variables */
- void* p_user_mempool; /* User O/S memory pool */
- uint16_t pool_access_mask; /* Bits are set if the corresponding buffer pool is
- a restricted pool */
- uint8_t pool_list[GKI_NUM_TOTAL_BUF_POOLS]; /* buffer pools arranged in the
- order of size */
- uint8_t curr_total_no_of_pools; /* number of fixed buf pools + current number
- of dynamic pools */
-
- bool timer_nesting; /* flag to prevent timer interrupt nesting */
-
- /* Time queue arrays */
- TIMER_LIST_Q* timer_queues[GKI_MAX_TIMER_QUEUES];
- /* System tick callback */
- SYSTEM_TICK_CBACK* p_tick_cb;
- bool system_tick_running; /* TRUE if system tick is running. Valid only if
- p_tick_cb is not NULL */
-
-} tGKI_COM_CB;
-
-/* Internal GKI function prototypes */
-extern bool gki_chk_buf_damage(void*);
-extern bool gki_chk_buf_owner(void*);
-extern void gki_buffer_init(void);
-extern void gki_timers_init(void);
-extern void gki_adjust_timer_count(int32_t);
-
-#endif
diff --git a/libstpropnci/libstnfc-nci-headers/src/gki/common/gki_inet.h b/libstpropnci/libstnfc-nci-headers/src/gki/common/gki_inet.h
deleted file mode 100755
index c40bc22..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/gki/common/gki_inet.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-2012 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.
- *
- ******************************************************************************/
-#ifndef GKI_INET_H
-#define GKI_INET_H
-
-#include "data_types.h"
-
-#if (BIG_ENDIAN == TRUE)
-#define ntohs(n) (n)
-#define ntohl(n) (n)
-#define ntoh6(n) (n)
-
-#define nettohs(n) (n)
-#define nettohl(n) (n)
-#else
-extern uint16_t ntohs(uint16_t n);
-extern uint32_t ntohl(uint32_t n);
-extern uint8_t* ntoh6(uint8_t* p);
-
-#define nettohs(n) ((uint16_t)((((n) << 8) & 0xff00) | (((n) >> 8) & 0x00ff)))
-#define nettohl(n) \
- ((((n) & 0x000000ff) << 24) | (((n) << 8) & 0x00ff0000) | \
- (((n) >> 8) & 0x0000ff00) | (((n) >> 24) & 0x000000ff))
-#endif
-
-#endif /* GKI_INET_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/gki/ulinux/data_types.h b/libstpropnci/libstnfc-nci-headers/src/gki/ulinux/data_types.h
deleted file mode 100755
index 727cd3c..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/gki/ulinux/data_types.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-2012 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.
- *
- ******************************************************************************/
-#ifndef DATA_TYPES_H
-#define DATA_TYPES_H
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef TRUE
-#define TRUE (!FALSE)
-#endif
-
-#ifdef __arm
-#define PACKED __packed
-#define INLINE __inline
-#else
-#define PACKED
-#define INLINE
-#endif
-
-#ifndef BIG_ENDIAN
-#define BIG_ENDIAN FALSE
-#endif
-
-#endif
diff --git a/libstpropnci/libstnfc-nci-headers/src/gki/ulinux/gki_int.h b/libstpropnci/libstnfc-nci-headers/src/gki/ulinux/gki_int.h
deleted file mode 100755
index f2bc223..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/gki/ulinux/gki_int.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-2012 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.
- *
- ******************************************************************************/
-#ifndef GKI_INT_H
-#define GKI_INT_H
-
-#include <pthread.h>
-
-#include "gki_common.h"
-
-/**********************************************************************
-** OS specific definitions
-*/
-#ifdef ANDROID
-#include <sys/times.h>
-#endif
-
-typedef struct {
- pthread_mutex_t GKI_mutex;
- pthread_t thread_id[GKI_MAX_TASKS];
- pthread_mutex_t thread_evt_mutex[GKI_MAX_TASKS];
- pthread_cond_t thread_evt_cond[GKI_MAX_TASKS];
- pthread_mutex_t thread_timeout_mutex[GKI_MAX_TASKS];
- pthread_cond_t thread_timeout_cond[GKI_MAX_TASKS];
- int no_timer_suspend; /* 1: no suspend, 0 stop calling GKI_timer_update() */
- pthread_mutex_t gki_timer_mutex;
- pthread_cond_t gki_timer_cond;
- pthread_mutex_t gki_end_mutex;
- pthread_cond_t gki_end_cond;
- int end_flag;
-} tGKI_OS;
-
-/* condition to exit or continue GKI_run() timer loop */
-#define GKI_TIMER_TICK_RUN_COND 1
-#define GKI_TIMER_TICK_STOP_COND 0
-#define GKI_TIMER_TICK_EXIT_COND 2
-
-extern void gki_system_tick_start_stop_cback(bool start);
-
-/* Contains common control block as well as OS specific variables */
-typedef struct {
- tGKI_OS os;
- tGKI_COM_CB com;
-} tGKI_CB;
-
-extern tGKI_CB gki_cb;
-
-#endif
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/CrcChecksum.h b/libstpropnci/libstnfc-nci-headers/src/include/CrcChecksum.h
deleted file mode 100755
index 00a3dd8..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/CrcChecksum.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2012 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.
- *
- ******************************************************************************/
-#pragma once
-
-#include <stdbool.h>
-#include <stdint.h>
-
-/*******************************************************************************
-**
-** Function crcChecksumCompute
-**
-** Description Compute a checksum on a buffer of data.
-**
-** Returns 2-byte checksum.
-**
-*******************************************************************************/
-uint16_t crcChecksumCompute(const unsigned char* buffer, int bufferLen);
-
-/*******************************************************************************
-**
-** Function crcChecksumVerifyIntegrity
-**
-** Description Detect any corruption in a file by computing a checksum.
-** filename: file name.
-**
-** Returns True if file is good.
-**
-*******************************************************************************/
-bool crcChecksumVerifyIntegrity(const char* filename);
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/NfcAdaptation.h b/libstpropnci/libstnfc-nci-headers/src/include/NfcAdaptation.h
deleted file mode 100755
index ed7830c..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/NfcAdaptation.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2011-2012 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.
- *
- ******************************************************************************/
-#pragma once
-
-#include <pthread.h>
-#include <utils/RefBase.h>
-
-#include "config.h"
-#include "nfc_hal_api.h"
-#include "nfc_target.h"
-
-using ::android::sp;
-
-namespace android {
-namespace hardware {
-namespace nfc {
-namespace V1_0 {
-struct INfc;
-struct INfcClientCallback;
-} // namespace V1_0
-namespace V1_1 {
-struct INfc;
-struct INfcClientCallback;
-} // namespace V1_1
-namespace V1_2 {
-struct INfc;
-}
-} // namespace nfc
-} // namespace hardware
-} // namespace android
-
-class ThreadMutex {
- public:
- ThreadMutex();
- virtual ~ThreadMutex();
- void lock();
- void unlock();
- explicit operator pthread_mutex_t*() { return &mMutex; }
-
- private:
- pthread_mutex_t mMutex;
-};
-
-class ThreadCondVar : public ThreadMutex {
- public:
- ThreadCondVar();
- virtual ~ThreadCondVar();
- void signal();
- void wait();
- bool wait(long millisec);
- explicit operator pthread_cond_t*() { return &mCondVar; }
- // NOLINTNEXTLINE(google-explicit-constructor)
- operator pthread_mutex_t*() {
- return ThreadMutex::operator pthread_mutex_t*();
- }
-
- private:
- pthread_cond_t mCondVar;
-};
-
-class AutoThreadMutex {
- public:
- explicit AutoThreadMutex(ThreadMutex& m);
- virtual ~AutoThreadMutex();
- explicit operator ThreadMutex&() { return mm; }
- explicit operator pthread_mutex_t*() { return (pthread_mutex_t*)mm; }
-
- private:
- ThreadMutex& mm;
-};
-
-class NfcHalDeathRecipient;
-
-class NfcAdaptation {
- public:
- virtual ~NfcAdaptation();
- void Initialize();
- void Finalize();
- void FactoryReset();
- void DeviceShutdown();
- static NfcAdaptation& GetInstance();
- tHAL_NFC_ENTRY* GetHalEntryFuncs();
- bool DownloadFirmware();
- void GetVendorConfigs(std::map<std::string, ConfigValue>& configMap);
- void Dump(int fd);
-
- private:
- NfcAdaptation();
- void signal();
- static NfcAdaptation* mpInstance;
- static ThreadMutex sLock;
- ThreadCondVar mCondVar;
- tHAL_NFC_ENTRY mHalEntryFuncs; // function pointers for HAL entry points
- static android::sp<android::hardware::nfc::V1_0::INfc> mHal;
- static android::sp<android::hardware::nfc::V1_1::INfc> mHal_1_1;
- static android::sp<android::hardware::nfc::V1_2::INfc> mHal_1_2;
- static android::hardware::nfc::V1_1::INfcClientCallback* mCallback;
- sp<NfcHalDeathRecipient> mNfcHalDeathRecipient;
- static tHAL_NFC_CBACK* mHalCallback;
- static tHAL_NFC_DATA_CBACK* mHalDataCallback;
- static ThreadCondVar mHalOpenCompletedEvent;
-
- static uint32_t NFCA_TASK(uint32_t arg);
- static uint32_t Thread(uint32_t arg);
- void InitializeHalDeviceContext();
- static void HalDeviceContextCallback(nfc_event_t event,
- nfc_status_t event_status);
- static void HalDeviceContextDataCallback(uint16_t data_len, uint8_t* p_data);
-
- static void HalInitialize();
- static void HalTerminate();
- static void HalOpenInternal(tHAL_NFC_CBACK* p_hal_cback,
- tHAL_NFC_DATA_CBACK* p_data_cback);
- static void HalOpen(tHAL_NFC_CBACK* p_hal_cback,
- tHAL_NFC_DATA_CBACK* p_data_cback);
- static void HalClose();
- static void HalCoreInitialized(uint16_t data_len,
- uint8_t* p_core_init_rsp_params);
- static void HalWrite(uint16_t data_len, uint8_t* p_data);
- static bool HalPrediscover();
- static void HalControlGranted();
- static void HalPowerCycle();
- static uint8_t HalGetMaxNfcee();
- static void HalDownloadFirmwareCallback(nfc_event_t event,
- nfc_status_t event_status);
- static void HalDownloadFirmwareDataCallback(uint16_t data_len,
- uint8_t* p_data);
-};
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/bt_types.h b/libstpropnci/libstnfc-nci-headers/src/include/bt_types.h
deleted file mode 100755
index 93bcb69..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/bt_types.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-2012 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.
- *
- ******************************************************************************/
-
-#ifndef BT_TYPES_H
-#define BT_TYPES_H
-
-#include "data_types.h"
-#include "nfc_types.h"
-
-/* NCI Command, Notification or Data*/
-#define BT_EVT_TO_NFC_NCI 0x4000
-/* messages between NFC and NCI task */
-#define BT_EVT_TO_NFC_MSGS 0x4300
-
-/* start timer */
-#define BT_EVT_TO_START_TIMER 0x3c00
-
-/* start quick timer */
-#define BT_EVT_TO_START_QUICK_TIMER 0x3e00
-#endif
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/buildcfg.h b/libstpropnci/libstnfc-nci-headers/src/include/buildcfg.h
deleted file mode 100755
index 92bfe63..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/buildcfg.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-2012 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.
- *
- ******************************************************************************/
-#ifndef __BUILDCFG_H
-#define __BUILDCFG_H
-#include <cutils/memory.h>
-#include <memory.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "data_types.h"
-
-#ifndef NFC_CONTORLLER_ID
-#define NFC_CONTORLLER_ID (1)
-#endif
-
-#define GKI_BUF1_MAX 0
-// 2 is in use
-#define GKI_BUF3_MAX 30
-#define GKI_BUF4_SIZE 2400
-#define GKI_BUF4_MAX 30
-#define GKI_BUF5_MAX 0
-#define GKI_BUF6_MAX 0
-#define GKI_BUF7_MAX 0
-#define GKI_BUF8_MAX 0
-
-#define GKI_BUF2_SIZE 660
-#define GKI_BUF2_MAX 50
-
-#define GKI_BUF0_SIZE 268
-#define GKI_BUF0_MAX 40
-
-#ifdef DYN_ALLOC
-#define GKI_NUM_FIXED_BUF_POOLS 0
-#else
-#define GKI_NUM_FIXED_BUF_POOLS 4
-#endif
-
-#endif
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/buildcfg_hal.h b/libstpropnci/libstnfc-nci-headers/src/include/buildcfg_hal.h
deleted file mode 100755
index d43fb0c..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/buildcfg_hal.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-2012 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 constant definitions for customizing NFA
- *
- ******************************************************************************/
-#pragma once
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/debug_lmrt.h b/libstpropnci/libstnfc-nci-headers/src/include/debug_lmrt.h
deleted file mode 100755
index b050285..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/debug_lmrt.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Copyright (C) 2021 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.
- */
-
-#ifndef _DEBUG_LMRT_
-#define _DEBUG_LMRT_
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-#include "nfc_int.h"
-
-/* The type definition of a group of RF_SET_LISTEN_MODE_ROUTING_CMD(s) */
-typedef struct lmrt_payload_t {
- std::vector<uint8_t> more;
- std::vector<uint8_t> entry_count;
- std::vector<std::vector<uint8_t>> tlvs;
-} __attribute__((__packed__)) lmrt_payload_t;
-
-/*******************************************************************************
-**
-** Function debug_lmrt_init
-**
-** Description initialize the lmrt_payloads
-**
-** Returns None
-**
-*******************************************************************************/
-void debug_lmrt_init(void);
-
-/*******************************************************************************
-**
-** Function lmrt_log
-**
-** Description print the listen mode routing configuration for debug use
-**
-** Returns None
-**
-*******************************************************************************/
-void lmrt_log(void);
-
-/*******************************************************************************
-**
-** Function lmrt_capture
-**
-** Description record the last RF_SET_LISTEN_MODE_ROUTING_CMD
-**
-** Returns None
-**
-*******************************************************************************/
-void lmrt_capture(uint8_t* buf, uint8_t buf_size);
-
-/*******************************************************************************
-**
-** Function lmrt_update
-**
-** Description Update the committed tlvs to committed_lmrt_tlvs
-**
-** Returns None
-**
-*******************************************************************************/
-void lmrt_update(void);
-
-/*******************************************************************************
-**
-** Function lmrt_get_max_size
-**
-** Description This function is used to get the max size of the routing
-** table from cache
-**
-** Returns Max Routing Table Size
-**
-*******************************************************************************/
-int lmrt_get_max_size(void);
-
-/*******************************************************************************
-**
-** Function lmrt_get_tlvs
-**
-** Description This function is used to get the committed listen mode
-** routing configuration command
-**
-** Returns The committed listen mode routing configuration command
-**
-*******************************************************************************/
-std::vector<uint8_t>* lmrt_get_tlvs();
-
-#endif /* _DEBUG_LMRT_ */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/debug_nfcsnoop.h b/libstpropnci/libstnfc-nci-headers/src/include/debug_nfcsnoop.h
deleted file mode 100755
index 422b00e..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/debug_nfcsnoop.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2017 Google Inc.
- *
- * 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.
- *
- ******************************************************************************/
-#ifndef _DEBUG_NFCSNOOP_
-#define _DEBUG_NFCSNOOP_
-
-#include <stdint.h>
-
-#include <string>
-
-#include "nfc_target.h"
-#include "nfc_types.h"
-
-#define NFCSNOOZ_CURRENT_VERSION 0x01
-#define DEFAULT_NFCSNOOP_FILE_SIZE 32 * 1024 * 1024
-
-// The preamble is stored un-encrypted as the first part
-// of the file.
-typedef struct nfcsnooz_preamble_t {
- uint8_t version;
- uint64_t last_timestamp_ms;
-} __attribute__((__packed__)) nfcsnooz_preamble_t;
-
-// One header for each NCI packet
-typedef struct nfcsnooz_header_t {
- uint16_t length;
- uint32_t delta_time_ms;
- uint8_t is_received;
-} __attribute__((__packed__)) nfcsnooz_header_t;
-
-// Initializes nfcsnoop memory logging and registers
-void debug_nfcsnoop_init(void);
-
-// Writes nfcsnoop data base64 encoded to fd
-void debug_nfcsnoop_dump(int fd);
-
-// capture the packet
-void nfcsnoop_capture(const NFC_HDR* packet, bool is_received);
-
-// store NCI log to file
-bool storeNfcSnoopLogs(std::string filepath, off_t maxFileSize);
-
-// check whether either buffer is under memory threshold
-bool buffers_under_threshold();
-#endif /* _DEBUG_NFCSNOOP_ */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/gki_hal_target.h b/libstpropnci/libstnfc-nci-headers/src/include/gki_hal_target.h
deleted file mode 100755
index 800264d..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/gki_hal_target.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2012-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.
- *
- ******************************************************************************/
-
-#ifndef GKI_HAL_TARGET_H
-#define GKI_HAL_TARGET_H
-
-#ifdef BUILDCFG
-#include "buildcfg_hal.h"
-#endif
-
-#include "data_types.h"
-
-/******************************************************************************
-**
-** Task configuration
-**
-******************************************************************************/
-
-/* Definitions of task IDs for inter-task messaging */
-#ifndef NFC_HAL_TASK
-#define NFC_HAL_TASK 0
-#endif
-
-/* The number of GKI tasks in the software system. */
-#ifndef GKI_MAX_TASKS
-#define GKI_MAX_TASKS 1
-#endif
-
-/******************************************************************************
-**
-** Buffer pool assignment
-**
-******************************************************************************/
-
-/* GKI pool for NCI messages */
-#ifndef NFC_HAL_NCI_POOL_ID
-#define NFC_HAL_NCI_POOL_ID GKI_POOL_ID_1
-#endif
-
-#ifndef NFC_HAL_NCI_POOL_BUF_SIZE
-#define NFC_HAL_NCI_POOL_BUF_SIZE GKI_BUF1_SIZE
-#endif
-
-/******************************************************************************
-**
-** Timer configuration
-**
-******************************************************************************/
-
-/* The number of GKI timers in the software system. */
-#ifndef GKI_NUM_TIMERS
-#define GKI_NUM_TIMERS 2
-#endif
-
-/* A conversion value for translating ticks to calculate GKI timer. */
-#ifndef TICKS_PER_SEC
-#define TICKS_PER_SEC 100
-#endif
-
-/************************************************************************
-** Utility macros converting ticks to time with user define OS ticks per sec
-**/
-#ifndef GKI_MS_TO_TICKS
-#define GKI_MS_TO_TICKS(x) ((x) / (1000 / TICKS_PER_SEC))
-#endif
-
-#ifndef GKI_SECS_TO_TICKS
-#define GKI_SECS_TO_TICKS(x) ((x) * (TICKS_PER_SEC))
-#endif
-
-#ifndef GKI_TICKS_TO_MS
-#define GKI_TICKS_TO_MS(x) ((x) * 1000 / TICKS_PER_SEC)
-#endif
-
-#ifndef GKI_TICKS_TO_SECS
-#define GKI_TICKS_TO_SECS(x) ((x) / TICKS_PER_SEC)
-#endif
-
-/* TICK per second from OS (OS dependent change this macro accordingly to
- * various OS) */
-#ifndef OS_TICKS_PER_SEC
-#define OS_TICKS_PER_SEC 1000
-#endif
-
-/************************************************************************
-** Utility macros converting ticks to time with user define OS ticks per sec
-**/
-
-#ifndef GKI_OS_TICKS_TO_MS
-#define GKI_OS_TICKS_TO_MS(x) ((x) * 1000 / OS_TICKS_PER_SEC)
-#endif
-
-#ifndef GKI_OS_TICKS_TO_SECS
-#define GKI_OS_TICKS_TO_SECS(x) ((x) / OS_TICKS_PER_SEC))
-#endif
-
-/* delay in ticks before stopping system tick. */
-#ifndef GKI_DELAY_STOP_SYS_TICK
-#define GKI_DELAY_STOP_SYS_TICK 10
-#endif
-
-/* Option to guarantee no preemption during timer expiration (most system don't
- * need this) */
-#ifndef GKI_TIMER_LIST_NOPREEMPT
-#define GKI_TIMER_LIST_NOPREEMPT FALSE
-#endif
-
-/******************************************************************************
-**
-** Buffer configuration
-**
-******************************************************************************/
-
-/* The size of the buffers in pool 0. */
-#ifndef GKI_BUF0_SIZE
-#define GKI_BUF0_SIZE 64
-#endif
-
-/* The number of buffers in buffer pool 0. */
-#ifndef GKI_BUF0_MAX
-#define GKI_BUF0_MAX 8
-#endif
-
-/* The ID of buffer pool 0. */
-#ifndef GKI_POOL_ID_0
-#define GKI_POOL_ID_0 0
-#endif
-
-/* The size of the buffers in pool 1. */
-#ifndef GKI_BUF1_SIZE
-#define GKI_BUF1_SIZE 288
-#endif
-
-/* The number of buffers in buffer pool 1. */
-#ifndef GKI_BUF1_MAX
-#define GKI_BUF1_MAX 8
-#endif
-
-/* The ID of buffer pool 1. */
-#ifndef GKI_POOL_ID_1
-#define GKI_POOL_ID_1 1
-#endif
-
-/* The size of the largest PUBLIC fixed buffer in system. */
-#ifndef GKI_MAX_BUF_SIZE
-#define GKI_MAX_BUF_SIZE GKI_BUF1_SIZE
-#endif
-
-/* The pool ID of the largest PUBLIC fixed buffer in system. */
-#ifndef GKI_MAX_BUF_SIZE_POOL_ID
-#define GKI_MAX_BUF_SIZE_POOL_ID GKI_POOL_ID_1
-#endif
-
-/* buffer size for USERIAL, it must large enough to hold NFC_HDR and max packet
- * size */
-#ifndef USERIAL_POOL_BUF_SIZE
-#define USERIAL_POOL_BUF_SIZE GKI_BUF1_SIZE
-#endif
-
-/* buffer pool ID for USERIAL */
-#ifndef USERIAL_POOL_ID
-#define USERIAL_POOL_ID GKI_POOL_ID_1
-#endif
-
-#ifndef GKI_NUM_FIXED_BUF_POOLS
-#define GKI_NUM_FIXED_BUF_POOLS 2
-#endif
-
-/* The number of fixed and dynamic buffer pools */
-#ifndef GKI_NUM_TOTAL_BUF_POOLS
-#define GKI_NUM_TOTAL_BUF_POOLS 2
-#endif
-
-/* The buffer pool usage mask. */
-#ifndef GKI_DEF_BUFPOOL_PERM_MASK
-#define GKI_DEF_BUFPOOL_PERM_MASK 0xfff0
-#endif
-
-/* The buffer corruption check flag. */
-#ifndef GKI_ENABLE_BUF_CORRUPTION_CHECK
-#define GKI_ENABLE_BUF_CORRUPTION_CHECK TRUE
-#endif
-
-/* The GKI severe error macro. */
-#ifndef GKI_SEVERE
-#define GKI_SEVERE(code)
-#endif
-
-/* Maximum number of exceptions logged. */
-#ifndef GKI_MAX_EXCEPTION
-#define GKI_MAX_EXCEPTION 8
-#endif
-
-/* Maximum number of chars stored for each exception message. */
-#ifndef GKI_MAX_EXCEPTION_MSGLEN
-#define GKI_MAX_EXCEPTION_MSGLEN 64
-#endif
-
-#ifndef GKI_SEND_MSG_FROM_ISR
-#define GKI_SEND_MSG_FROM_ISR FALSE
-#endif
-
-#endif /* GKI_TARGET_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/gki_target.h b/libstpropnci/libstnfc-nci-headers/src/include/gki_target.h
deleted file mode 100755
index dfca10b..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/gki_target.h
+++ /dev/null
@@ -1,356 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-2012 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.
- *
- ******************************************************************************/
-#ifndef GKI_TARGET_H
-#define GKI_TARGET_H
-
-#ifdef BUILDCFG
-#include "buildcfg.h"
-#endif
-
-#include "data_types.h"
-
-/******************************************************************************
-**
-** Task configuration
-**
-******************************************************************************/
-
-/* Definitions of task IDs for inter-task messaging */
-#ifndef MMI_TASK
-#define MMI_TASK 0
-#endif
-
-#ifndef HCISU_TASK
-#define HCISU_TASK 1
-#endif
-
-#ifndef NCIT_TASK
-#define NCIT_TASK 2
-#endif
-
-#ifndef NFC_TASK
-#define NFC_TASK 3
-#endif
-
-#ifndef BTU_TASK
-#define BTU_TASK 4
-#endif
-
-/* BTE Application, Sample Apps, or Serial port Demo based on JP3 and JP4
- * setting) */
-#ifndef BTE_APPL_TASK
-#define BTE_APPL_TASK 5
-#endif
-
-#ifndef DEV_MGR_TASK
-#define DEV_MGR_TASK 6
-#endif
-
-#ifndef ISE_SCR_TASK
-#define ISE_SCR_TASK 7
-#endif
-
-#ifndef UCODEC_TASK
-#define UCODEC_TASK 8
-#endif
-
-#ifndef RPCT_TASK
-#define RPCT_TASK 9
-#endif
-
-#ifndef UNV_TASK
-#define UNV_TASK 10
-#endif
-
-#ifndef BTE_IDLE_TASK
-#define BTE_IDLE_TASK 11
-#endif
-
-#ifndef UIPC_TASK
-#define UIPC_TASK 12
-#endif
-
-#ifndef HCISU_AMP_TASK
-#define HCISU_AMP_TASK 13
-#endif
-
-/* The number of GKI tasks in the software system. */
-#ifndef GKI_MAX_TASKS
-#define GKI_MAX_TASKS 14
-#endif
-
-/******************************************************************************
-**
-** Timer configuration
-**
-******************************************************************************/
-
-/* The number of GKI timers in the software system. */
-#ifndef GKI_NUM_TIMERS
-#define GKI_NUM_TIMERS 3
-#endif
-
-/* A conversion value for translating ticks to calculate GKI timer. */
-#ifndef TICKS_PER_SEC
-#define TICKS_PER_SEC 100
-#endif
-
-/* delay in ticks before stopping system tick. */
-#ifndef GKI_DELAY_STOP_SYS_TICK
-#define GKI_DELAY_STOP_SYS_TICK 10
-#endif
-
-/******************************************************************************
-**
-** Buffer configuration
-**
-******************************************************************************/
-
-/* The size of the buffers in pool 0. */
-#ifndef GKI_BUF0_SIZE
-#define GKI_BUF0_SIZE 64
-#endif
-
-/* The number of buffers in buffer pool 0. */
-#ifndef GKI_BUF0_MAX
-#define GKI_BUF0_MAX 48
-#endif
-
-/* The ID of buffer pool 0. */
-#ifndef GKI_POOL_ID_0
-#define GKI_POOL_ID_0 0
-#endif
-
-/* The size of the buffers in pool 1. */
-#ifndef GKI_BUF1_SIZE
-#define GKI_BUF1_SIZE 128
-#endif
-
-/* The number of buffers in buffer pool 1. */
-#ifndef GKI_BUF1_MAX
-#define GKI_BUF1_MAX 26
-#endif
-
-/* The ID of buffer pool 1. */
-#ifndef GKI_POOL_ID_1
-#define GKI_POOL_ID_1 1
-#endif
-
-/* The size of the buffers in pool 2. */
-#ifndef GKI_BUF2_SIZE
-#define GKI_BUF2_SIZE 660
-#endif
-
-/* The number of buffers in buffer pool 2. */
-#ifndef GKI_BUF2_MAX
-#define GKI_BUF2_MAX 45
-#endif
-
-/* The ID of buffer pool 2. */
-#ifndef GKI_POOL_ID_2
-#define GKI_POOL_ID_2 2
-#endif
-
-/* The size of the buffers in pool 3. */
-#ifndef GKI_BUF3_SIZE
-#define GKI_BUF3_SIZE (0xFFB0)
-#endif
-
-/* The number of buffers in buffer pool 3. */
-#ifndef GKI_BUF3_MAX
-#define GKI_BUF3_MAX 30
-#endif
-
-/* The ID of buffer pool 3. */
-#ifndef GKI_POOL_ID_3
-#define GKI_POOL_ID_3 3
-#endif
-
-/* The size of the largest PUBLIC fixed buffer in system. */
-#ifndef GKI_MAX_BUF_SIZE
-#define GKI_MAX_BUF_SIZE GKI_BUF3_SIZE
-#endif
-
-/* The pool ID of the largest PUBLIC fixed buffer in system. */
-#ifndef GKI_MAX_BUF_SIZE_POOL_ID
-#define GKI_MAX_BUF_SIZE_POOL_ID GKI_POOL_ID_3
-#endif
-
-/* RESERVED buffer pool for OBX */
-/* Ideally there should be 1 buffer for each instance for RX data, and some
-number
-of TX buffers based on active instances. OBX will only use these if packet size
-requires it. In most cases the large packets are used in only one direction so
-the other direction will use smaller buffers.
-Devices with small amount of RAM should limit the number of active obex objects.
-*/
-/* The size of the buffers in pool 4. */
-#ifndef GKI_BUF4_SIZE
-#define GKI_BUF4_SIZE 0x2000
-#endif
-
-/* The number of buffers in buffer pool 4. */
-#ifndef GKI_BUF4_MAX
-/* (OBX_NUM_SERVERS + OBX_NUM_CLIENTS) */
-#define GKI_BUF4_MAX 96
-#endif
-
-/* The ID of buffer pool 4. */
-#ifndef GKI_POOL_ID_4
-#define GKI_POOL_ID_4 4
-#endif
-
-/* The number of fixed GKI buffer pools.
-If L2CAP_FCR_INCLUDED is FALSE, Pool ID 5 is unnecessary
-If BTM_SCO_HCI_INCLUDED is FALSE, Pool ID 6 is unnecessary, otherwise set to 7
-If BTA_HL_INCLUDED is FALSE then Pool ID 7 is uncessary and set the following to
-7, otherwise set to 8
-If GATT_SERVER_ENABLED is FALSE then Pool ID 8 is uncessary and set the
-following to 8, otherwise set to 9
-*/
-#ifndef GKI_NUM_FIXED_BUF_POOLS
-#define GKI_NUM_FIXED_BUF_POOLS 9
-#endif
-
-/* The buffer pool usage mask. */
-#ifndef GKI_DEF_BUFPOOL_PERM_MASK
-#define GKI_DEF_BUFPOOL_PERM_MASK 0xfff0
-#endif
-
-/* The number of fixed and dynamic buffer pools.
-If L2CAP_FCR_INCLUDED is FALSE, Pool ID 4 is unnecessary */
-#ifndef GKI_NUM_TOTAL_BUF_POOLS
-#define GKI_NUM_TOTAL_BUF_POOLS 10
-#endif
-
-/* The following is intended to be a reserved pool for L2CAP
-Flow control and retransmissions and intentionally kept out
-of order */
-
-/* The number of buffers in buffer pool 5. */
-#ifndef GKI_BUF5_MAX
-#define GKI_BUF5_MAX 64
-#endif
-
-/* The ID of buffer pool 5. */
-#ifndef GKI_POOL_ID_5
-#define GKI_POOL_ID_5 5
-#endif
-
-/* The size of the buffers in pool 5
-** Special pool used by l2cap retransmissions only. This size based on segment
-** that will fit into both DH5 and 2-DH3 packet types after accounting for GKI
-** header. 13 bytes of max headers allows us a 339 payload max.
-** (in btui_app.txt)
-** Note: 748 used for insight scriptwrapper with CAT-2 scripts.
-*/
-#ifndef GKI_BUF5_SIZE
-#define GKI_BUF5_SIZE 748
-#endif
-
-/* The buffer corruption check flag. */
-#ifndef GKI_ENABLE_BUF_CORRUPTION_CHECK
-#define GKI_ENABLE_BUF_CORRUPTION_CHECK TRUE
-#endif
-
-/* The GKI severe error macro. */
-#ifndef GKI_SEVERE
-#define GKI_SEVERE(code)
-#endif
-
-/* Maximum number of exceptions logged. */
-#ifndef GKI_MAX_EXCEPTION
-#define GKI_MAX_EXCEPTION 8
-#endif
-
-/* Maximum number of chars stored for each exception message. */
-#ifndef GKI_MAX_EXCEPTION_MSGLEN
-#define GKI_MAX_EXCEPTION_MSGLEN 64
-#endif
-
-#ifndef GKI_SEND_MSG_FROM_ISR
-#define GKI_SEND_MSG_FROM_ISR FALSE
-#endif
-
-/* The following is intended to be a reserved pool for SCO
-over HCI data and intentionally kept out of order */
-
-/* The ID of buffer pool 6. */
-#ifndef GKI_POOL_ID_6
-#define GKI_POOL_ID_6 6
-#endif
-
-/* The size of the buffers in pool 6,
- BUF_SIZE = max SCO data 255 + sizeof(NFC_HDR) = 8 + SCO packet header 3 +
- padding 2 = 268 */
-#ifndef GKI_BUF6_SIZE
-#define GKI_BUF6_SIZE 268
-#endif
-
-/* The number of buffers in buffer pool 6. */
-#ifndef GKI_BUF6_MAX
-#define GKI_BUF6_MAX 60
-#endif
-
-/* The following pool is a dedicated pool for HDP
- If a shared pool is more desirable then
- 1. set BTA_HL_LRG_DATA_POOL_ID to the desired Gki Pool ID
- 2. make sure that the shared pool size is larger than 9472
- 3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since
- POOL ID 7 is not needed
-*/
-
-/* The ID of buffer pool 7. */
-#ifndef GKI_POOL_ID_7
-#define GKI_POOL_ID_7 7
-#endif
-
-/* The size of the buffers in pool 7 */
-#ifndef GKI_BUF7_SIZE
-#define GKI_BUF7_SIZE 9472
-#endif
-
-/* The number of buffers in buffer pool 7. */
-#ifndef GKI_BUF7_MAX
-#define GKI_BUF7_MAX 2
-#endif
-
-/* The following pool is a dedicated pool for GATT
- If a shared pool is more desirable then
- 1. set GATT_DB_POOL_ID to the desired Gki Pool ID
- 2. make sure that the shared pool size fit a common GATT database needs
- 3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since
- POOL ID 8 is not needed
-*/
-
-/* The ID of buffer pool 8. */
-#ifndef GKI_POOL_ID_8
-#define GKI_POOL_ID_8 8
-#endif
-
-/* The size of the buffers in pool 8 */
-#ifndef GKI_BUF8_SIZE
-#define GKI_BUF8_SIZE 128
-#endif
-
-/* The number of buffers in buffer pool 8. */
-#ifndef GKI_BUF8_MAX
-#define GKI_BUF8_MAX 30
-#endif
-
-#endif /* GKI_TARGET_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/hardware_nfc.h b/libstpropnci/libstnfc-nci-headers/src/include/hardware_nfc.h
deleted file mode 100755
index 12545e8..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/hardware_nfc.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2021 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.
- */
-#pragma once
-
-typedef uint8_t nfc_event_t;
-typedef uint8_t nfc_status_t;
-
-/*
- * The callback passed in from the NFC stack that the HAL
- * can use to pass events back to the stack.
- */
-typedef void(nfc_stack_callback_t)(nfc_event_t event,
- nfc_status_t event_status);
-
-/*
- * The callback passed in from the NFC stack that the HAL
- * can use to pass incoming data to the stack.
- */
-typedef void(nfc_stack_data_callback_t)(uint16_t data_len, uint8_t* p_data);
-
-enum {
- HAL_NFC_OPEN_CPLT_EVT = 0u,
- HAL_NFC_CLOSE_CPLT_EVT = 1u,
- HAL_NFC_POST_INIT_CPLT_EVT = 2u,
- HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3u,
- HAL_NFC_REQUEST_CONTROL_EVT = 4u,
- HAL_NFC_RELEASE_CONTROL_EVT = 5u,
- HAL_NFC_ERROR_EVT = 6u,
- HAL_HCI_NETWORK_RESET = 7u,
-};
-
-enum {
- HAL_NFC_STATUS_OK = 0u,
- HAL_NFC_STATUS_FAILED = 1u,
- HAL_NFC_STATUS_ERR_TRANSPORT = 2u,
- HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3u,
- HAL_NFC_STATUS_REFUSED = 4u,
-};
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/metrics.h b/libstpropnci/libstnfc-nci-headers/src/include/metrics.h
deleted file mode 100755
index 2435a04..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/metrics.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2019 Google, Inc.
- *
- * 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.
- *
- ******************************************************************************/
-
-#pragma once
-
-enum ErrorType { UNKNOWN, NCI_TIMEOUT, ERROR_NTF, AID_OVERFLOW };
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nci_defs.h b/libstpropnci/libstnfc-nci-headers/src/include/nci_defs.h
deleted file mode 100755
index a7b41a7..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nci_defs.h
+++ /dev/null
@@ -1,742 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-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 the definition from NCI specification
- *
- ******************************************************************************/
-
-#ifndef NFC_NCI_DEFS_H
-#define NFC_NCI_DEFS_H
-
-#include <stdint.h>
-
-/* Define the message header size for all NCI Commands and Notifications. */
-#define NCI_MSG_HDR_SIZE 3 /* per NCI spec */
-#define NCI_DATA_HDR_SIZE 3 /* per NCI spec */
-#define NCI_MAX_PAYLOAD_SIZE 0xFE
-#define NCI_CTRL_INIT_SIZE 32 /* initial NFCC control payload size */
-#define NCI_MAX_VSC_SIZE 0xFF
-#define APPL_DTA_MODE FALSE
-/* NCI header (3) + callback function pointer(8; use 8 to be safe) + HCIT (1
- * byte) */
-#define NCI_VSC_MSG_HDR_SIZE 12
-
-/* Max frame size (256) - Prologue (1) - Epilogue (2) in ISO-DEP, CID and NAD
- * are not used*/
-#define NCI_ISO_DEP_MAX_INFO 253
-/* Max payload (254) - Protocol Header (3) in NFC-DEP, DID and NAD are not used
- */
-#define NCI_NFC_DEP_MAX_DATA 251
-
-/* NCI Command and Notification Format:
- * 3 byte message header:
- * byte 0: MT PBF GID
- * byte 1: OID
- * byte 2: Message Length */
-/* MT: Message Type (byte 0) */
-#define NCI_MT_MASK 0xE0
-#define NCI_MT_SHIFT 5
-#define NCI_MT_DATA 0x00
-#define NCI_MT_CMD 1 /* (NCI_MT_CMD << NCI_MT_SHIFT) = 0x20 */
-#define NCI_MT_RSP 2 /* (NCI_MT_RSP << NCI_MT_SHIFT) = 0x40 */
-#define NCI_MT_NTF 3 /* (NCI_MT_NTF << NCI_MT_SHIFT) = 0x60 */
-
-#define NCI_NTF_BIT 0x80 /* the tNFC_VS_EVT is a notification */
-#define NCI_RSP_BIT 0x40 /* the tNFC_VS_EVT is a response */
-
-/* for internal use only; not from specification */
-/* the following 2 flags are used in layer_specific for fragmentation/reassembly
- * of data packets */
-
-/* PBF: Packet Boundary Flag (byte 0) */
-#define NCI_PBF_MASK 0x10
-#define NCI_PBF_SHIFT 4
-
-/* GID: Group Identifier (byte 0) */
-#define NCI_GID_MASK 0x0F
-#define NCI_GID_CORE 0x00 /* 0000b NCI Core group */
-#define NCI_GID_RF_MANAGE 0x01 /* 0001b RF Management group */
-#define NCI_GID_EE_MANAGE 0x02 /* 0010b NFCEE Management group */
-#define NCI_GID_PROP 0x0F /* 1111b Proprietary */
-/* 0111b - 1110b RFU */
-
-/* OID: Opcode Identifier (byte 1) */
-#define NCI_OID_MASK 0x3F
-#define NCI_OID_SHIFT 0
-
-/* For routing */
-#define NCI_DH_ID 0 /* for DH */
-/* To identify the loopback test */
-#define NCI_TEST_ID 0xFE /* for loopback test */
-
-/* Destination Type */
-#define NCI_DEST_TYPE_NFCC 1 /* NFCC - loopback */
-#define NCI_DEST_TYPE_REMOTE 2 /* Remote NFC Endpoint */
-#define NCI_DEST_TYPE_NFCEE 3 /* NFCEE */
-#define NCI_DEST_TYPE_T4T_NFCEE 5 /* T4T NFCEE */
-
-/* builds byte0 of NCI Command and Notification packet */
-#define NCI_MSG_BLD_HDR0(p, mt, gid) \
- *(p)++ = (uint8_t)(((mt) << NCI_MT_SHIFT) | (gid));
-
-/* builds byte1 of NCI Command and Notification packet */
-#define NCI_MSG_BLD_HDR1(p, oid) *(p)++ = (uint8_t)(((oid) << NCI_OID_SHIFT));
-
-/* parse byte0 of NCI packet */
-#define NCI_MSG_PRS_HDR0(p, mt, pbf, gid) \
- (mt) = (*(p) & NCI_MT_MASK) >> NCI_MT_SHIFT; \
- (pbf) = (*(p) & NCI_PBF_MASK) >> NCI_PBF_SHIFT; \
- (gid) = *(p)++ & NCI_GID_MASK;
-
-/* parse byte1 of NCI Cmd/Ntf */
-#define NCI_MSG_PRS_HDR1(p, oid) \
- (oid) = (*(p) & NCI_OID_MASK); \
- (p)++;
-
-/* NCI Data Format:
- * byte 0: MT(0) PBF CID
- * byte 1: RFU
- * byte 2: Data Length */
-/* CID: Connection Identifier (byte 0) 1-0xF Dynamically assigned (by NFCC), 0
- * is predefined */
-#define NCI_CID_MASK 0x0F
-
-#define NCI_DATA_PBLD_HDR(p, pbf, cid, len) \
- *(p)++ = (uint8_t)(((pbf) << NCI_PBF_SHIFT) | (cid)); \
- *(p)++ = 0; \
- *(p)++ = (len);
-
-#define NCI_DATA_PRS_HDR(p, pbf, cid, len) \
- (pbf) = (*(p) & NCI_PBF_MASK) >> NCI_PBF_SHIFT; \
- (cid) = (*(p) & NCI_CID_MASK); \
- (p)++; \
- (p)++; \
- (len) = *(p)++;
-
-/* Logical target ID 0x01-0xFE */
-
-/* CORE_RESET_NTF reset trigger type*/
-#define NCI2_X_RESET_TRIGGER_TYPE_POWERED_ON 0x01
-#define NCI2_X_RESET_TRIGGER_TYPE_CORE_RESET_CMD_RECEIVED 0x02
-
-/* Status Codes */
-#define NCI_STATUS_OK 0x00
-#define NCI_STATUS_REJECTED 0x01
-#define NCI_STATUS_MESSAGE_CORRUPTED 0x02
-#define NCI_STATUS_BUFFER_FULL 0xE0
-#define NCI_STATUS_FAILED 0x03
-#define NCI_STATUS_NOT_INITIALIZED 0x04
-#define NCI_STATUS_SYNTAX_ERROR 0x05
-#define NCI_STATUS_SEMANTIC_ERROR 0x06
-#define NCI_STATUS_UNKNOWN_GID 0x07
-#define NCI_STATUS_UNKNOWN_OID 0x08
-#define NCI_STATUS_INVALID_PARAM 0x09
-#define NCI_STATUS_MSG_SIZE_TOO_BIG 0x0A
-#define NCI_STATUS_NOT_SUPPORTED 0x0B
-/* discovery */
-#define NCI_STATUS_ALREADY_STARTED 0xA0
-#define NCI_STATUS_ACTIVATION_FAILED 0xA1
-#define NCI_STATUS_TEAR_DOWN 0xA2
-/* RF Interface */
-#define NCI_STATUS_RF_FRAME_CORRUPTED 0x02
-#define NCI_STATUS_RF_TRANSMISSION_ERR 0xB0
-#define NCI_STATUS_RF_PROTOCOL_ERR 0xB1
-#define NCI_STATUS_TIMEOUT 0xB2
-#define NCI_STATUS_RF_UNEXPECTED_DATA 0xB3
-/* NFCEE Interface */
-#define NCI_STATUS_EE_INTF_ACTIVE_FAIL 0xC0
-#define NCI_STATUS_EE_TRANSMISSION_ERR 0xC1
-#define NCI_STATUS_EE_PROTOCOL_ERR 0xC2
-#define NCI_STATUS_EE_TIMEOUT 0xC3
-#define NFA_STATUS_READ_ONLY NCI_STATUS_READ_ONLY
-#define NCI_STATUS_READ_ONLY 0xC4
-
-/* RF Technologies */
-#define NCI_RF_TECHNOLOGY_A 0x00
-#define NCI_RF_TECHNOLOGY_B 0x01
-#define NCI_RF_TECHNOLOGY_F 0x02
-#define NCI_RF_TECHNOLOGY_V 0x03
-
-/* Bit Rates */
-#define NCI_BIT_RATE_106 0x00 /* 106 kbit/s */
-#define NCI_BIT_RATE_212 0x01 /* 212 kbit/s */
-#define NCI_BIT_RATE_424 0x02 /* 424 kbit/s */
-#define NCI_BIT_RATE_848 0x03 /* 848 Kbit/s */
-#define NCI_BIT_RATE_1696 0x04 /* 1696 Kbit/s*/
-#define NCI_BIT_RATE_3392 0x05 /* 3392 Kbit/s*/
-#define NCI_BIT_RATE_6784 0x06 /* 6784 Kbit/s*/
-
-/**********************************************
- * NCI Core Group Opcode - 0
- **********************************************/
-#define NCI_MSG_CORE_RESET 0
-#define NCI_MSG_CORE_INIT 1
-#define NCI_MSG_CORE_SET_CONFIG 2
-#define NCI_MSG_CORE_GET_CONFIG 3
-#define NCI_MSG_CORE_CONN_CREATE 4
-#define NCI_MSG_CORE_CONN_CLOSE 5
-#define NCI_MSG_CORE_CONN_CREDITS 6
-#define NCI_MSG_CORE_GEN_ERR_STATUS 7
-#define NCI_MSG_CORE_INTF_ERR_STATUS 8
-#define NCI_MSG_CORE_SET_POWER_SUB_STATE 9
-
-/**********************************************
- * RF MANAGEMENT Group Opcode - 1
- **********************************************/
-#define NCI_MSG_RF_DISCOVER_MAP 0
-#define NCI_MSG_RF_SET_ROUTING 1
-#define NCI_MSG_RF_GET_ROUTING 2
-#define NCI_MSG_RF_DISCOVER 3
-#define NCI_MSG_RF_DISCOVER_SELECT 4
-#define NCI_MSG_RF_INTF_ACTIVATED 5
-#define NCI_MSG_RF_DEACTIVATE 6
-#define NCI_MSG_RF_FIELD 7
-#define NCI_MSG_RF_T3T_POLLING 8
-#define NCI_MSG_RF_EE_ACTION 9
-#define NCI_MSG_RF_EE_DISCOVERY_REQ 10
-#define NCI_MSG_RF_PARAMETER_UPDATE 11
-#define NCI_MSG_RF_INTF_EXT_START 12
-#define NCI_MSG_RF_INTF_EXT_STOP 13
-#define NCI_MSG_RF_ISO_DEP_NAK_PRESENCE 16
-#define NCI_MSG_RF_REMOVAL_DETECTION 18
-#define NCI_MSG_WPT_START 21
-
-/**********************************************
- * NFCEE MANAGEMENT Group Opcode - 2
- **********************************************/
-#define NCI_MSG_NFCEE_DISCOVER 0
-#define NCI_MSG_NFCEE_MODE_SET 1
-#define NCI_MSG_NFCEE_STATUS 2
-#define NCI_MSG_NFCEE_POWER_LINK_CTRL 3
-/**********************************************
- * NCI Proprietary Group - F
- **********************************************/
-#define NCI_MSG_PROP_ANDROID 0x0C
-
-#define NCI_ANDROID_RESTART_RF_DISCOVERY_REQUEST_NTF 0x07
-
-/* Android Opcodes */
-#define NCI_ANDROID_GET_CAPS 0x0
-#define NCI_ANDROID_POWER_SAVING 0x1
-#define NCI_ANDROID_PASSIVE_OBSERVE 0x2
-#define NCI_ANDROID_POLLING_FRAME_NTF 0x03
-#define NCI_QUERY_ANDROID_PASSIVE_OBSERVE 0x4
-#define NCI_ANDROID_SET_PASSIVE_OBSERVER_TECH 0x05
-#define NCI_ANDROID_SET_PASSIVE_OBSERVER_EXIT_FRAME 0x06
-#define NCI_ANDROID_GET_PASSIVE_OBSERVER_EXIT_FRAME 0x07
-#define NCI_ANDROID_BLANK_NCI 0x8
-#define NCI_ANDROID_SET_TECH_A_POLLING_LOOP_ANNOTATION 0x9
-#define NCI_QUERY_ANDROID_POWER_SAVING 0x0A
-#define NCI_ANDROID_PASSIVE_OBSERVER_SUSPENDED_NTF 0x0B
-#define NCI_ANDROID_PASSIVE_OBSERVER_RESUMED_NTF 0x0C
-#ifdef ST21NFC
-#define NCI_ANDROID_SET_UID_AND_SAK 0x11
-#endif
-
-/* Android Get Proprietary Caps */
-#define NCI_ANDROID_GET_CAPS_PARAM_SIZE 0x1
-
-/* Android Power Saving Params */
-#define NCI_ANDROID_POWER_SAVING_PARAM_SIZE 0x2
-#define NCI_ANDROID_POWER_SAVING_PARAM_DISABLE 0x0
-#define NCI_ANDROID_POWER_SAVING_PARAM_ENABLE 0x1
-
-/* Android Passive Observer Settings */
-#define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_SIZE 0x2
-#define NCI_QUERY_ANDROID_PASSIVE_OBSERVE_PARAM_SIZE 0x1
-#define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_DISABLE 0x0
-#define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE 0x1
-
-/* Android Passive Observer per tech settings */
-
-#define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_DISABLE 0x0
-#define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_A 0x1
-#define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_B 0x2
-#define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_F 0x4
-#define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_V 0x8
-
-/* Android Blank NCI Settings */
-#define NCI_ANDROID_BLANK_COMMON 0x00
-#define NCI_ANDROID_BLANK_VENDOR 0x01
-#define NCI_ANDROID_BLANK_COMMON_ERROR 0xF0
-#define NCI_ANDROID_BLANK_VENDOR_ERROR 0xF1
-/**********************************************
- * NCI Core Group Params
- **********************************************/
-#define NCI_CORE_PARAM_SIZE_RESET 0x01
-
-/**********************************************
- * NCI Feature Bit
- **********************************************/
-#define NCI_FEAT_HCI_NETWORK 0x00000008
-#define NCI_POLL_REMOVAL_DETECTION 0x00000020
-
-#define NCI_CORE_PARAM_SIZE_INIT(X) (((X) >= NCI_VERSION_2_0) ? (0x02) : (0x00))
-#define NCI2_X_CORE_INIT_CMD_BYTE_0 0x00
-#define NCI2_X_CORE_INIT_CMD_BYTE_1 0x00
-
-/* Status (1 octet) and number of params */
-#define NCI_CORE_PARAM_SIZE_SET_POWER_SUB_STATE 0x01
-
-#define NCI_CORE_PARAM_SIZE_CON_CREATE 0x02 /* handle, num_tlv, (tlv) */
-/* status, size, credits, conn_id */
-#define NCI_CON_CREATE_TAG_RF_DISC_ID 0x00
-#define NCI_CON_CREATE_TAG_NFCEE_VAL 0x01
-
-#define NCI_CORE_PARAM_SIZE_CON_CLOSE 0x01 /* Conn ID (1 octet) */
-
-/* Keep the NCI configuration and perform NCI initialization. */
-#define NCI_RESET_TYPE_KEEP_CFG 0x00
-/* Reset the NCI configuration, and perform NCI initialization. */
-#define NCI_RESET_TYPE_RESET_CFG 0x01
-
-/* No operating field generated by remote device */
-#define NCI_RF_STS_NO_REMOTE 0x00
-/* Operating field generated by remote device */
-#define NCI_RF_STS_REMOTE 0x01
-
-/* Discovery Action (1 octet) */
-#define NCI_PARAM_SIZE_DISCOVER_NFCEE(X) \
- (((X) >= NCI_VERSION_2_0) ? 0X00 : 0X01)
-
-#define NCI_DISCOVER_ACTION_DISABLE 0
-#define NCI_DISCOVER_ACTION_ENABLE 1
-
-/* RF Technology and Mode */
-#define NCI_RF_PARAM_ID_TECH_N_MODE 0x00
-/* Transmit Bit Rate */
-#define NCI_RF_PARAM_ID_TX_BIT_RATE 0x01
-/* Receive Bit Rate */
-#define NCI_RF_PARAM_ID_RX_BIT_RATE 0x02
-/* B Data Exchange config param */
-#define NCI_RF_PARAM_ID_B_DATA_EX_PARAM 0x03
-
-#define NCI_NFCEE_INTERFACE_APDU 0x00
-#define NCI_NFCEE_INTERFACE_HCI_ACCESS 0x01
-#define NCI_NFCEE_INTERFACE_T3T 0x02
-#define NCI_NFCEE_INTERFACE_TRANSPARENT 0x03
-#define NCI_NFCEE_INTERFACE_PROPRIETARY 0x80
-/****************************************************
- * NCI NFCEE INterface specific status Codes
- ****************************************************/
-#define NCI_NFCEE_STS_UNRECOVERABLE_ERROR 0x00
-#define NCI_NFCEE_STS_INTF_ACTIVATION_FAILED 0xC0
-#define NCI_NFCEE_STS_TRANSMISSION_ERROR 0xC1
-#define NCI_NFCEE_STS_PROTOCOL_ERROR 0xC2
-#define NCI_NFCEE_STS_TIMEOUT_ERROR 0xC3
-
-#define NCI_NFCEE_STS_CONN_ACTIVE 0x00
-#define NCI_NFCEE_STS_CONN_INACTIVE 0x01
-#define NCI_NFCEE_STS_REMOVED 0x02
-
-/* Logical Target ID (1 octet)NFCEE Mode (1 octet) */
-#define NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET 0x02
-
-/* Deactivate the connected NFCEE */
-#define NCI_NFCEE_MD_DEACTIVATE 0x00
-/* Activate the connected NFCEE */
-#define NCI_NFCEE_MD_ACTIVATE 0x01
-#define NCI_NUM_NFCEE_MODE 2
-
-/**********************************************
- * NCI Deactivation Type
- **********************************************/
-#define NCI_DEACTIVATE_TYPE_IDLE 0 /* Idle Mode */
-#define NCI_DEACTIVATE_TYPE_SLEEP 1 /* Sleep Mode */
-#define NCI_DEACTIVATE_TYPE_SLEEP_AF 2 /* Sleep_AF Mode */
-#define NCI_DEACTIVATE_TYPE_DISCOVERY 3 /* Discovery */
-
-/**********************************************
- * NCI Deactivation Reasons
- **********************************************/
-#define NCI_DEACTIVATE_REASON_DH_REQ 0 /* DH Request */
-#define NCI_DEACTIVATE_REASON_ENDPOINT_REQ 1 /* Endpoint Request */
-#define NCI_DEACTIVATE_REASON_RF_LINK_LOSS 2 /* RF Link Loss */
-#define NCI_DEACTIVATE_REASON_NFCB_BAD_AFI 3 /* NFC-B Bad AFI */
-/* DH Request Failed due to error */
-#define NCI_DEACTIVATE_REASON_DH_REQ_FAILED 4
-#define NCI_DEACTIVATE_REASON_RF_REMOTE_EP_REMOVED 5
-#define NCI_DEACTIVATE_REASON_RF_TIMEOUT_EXCEPTION 6
-#define NCI_DEACTIVATE_REASON_RF_PROTOCOL_EXCEPTION 7
-#define NCI_DEACTIVATE_REASON_FO_DETECTED 8
-
-/* The NFCEE status in NFCEE Status Notification */
-typedef uint8_t tNCI_EE_NTF_STATUS;
-
-/* NFCEE Power and Link Configuration */
-typedef uint8_t tNCI_NFCEE_PL_CONFIG;
-
-/**********************************************
- * NCI Interface Mode
- **********************************************/
-#define NCI_INTERFACE_MODE_POLL_N_LISTEN 3
-
-/**********************************************
- * NCI Interface Types
- **********************************************/
-#define NCI_INTERFACE_EE_DIRECT_RF 0
-#define NCI_INTERFACE_FRAME 1
-#define NCI_INTERFACE_ISO_DEP 2
-#define NCI_INTERFACE_NFC_DEP 3
-#define NCI_INTERFACE_MAX NCI_INTERFACE_NFC_DEP
-#define NCI_INTERFACE_EXTENSION_MAX 2
-#define NCI_INTERFACE_FIRST_VS 0x80
-typedef uint8_t tNCI_INTF_TYPE;
-typedef uint8_t tNCI_INTF_EXT_TYPE;
-
-/**********************************************
- * NCI RF Interface Extensions Types
- **********************************************/
-#define NCI_INTF_EXT_WLCP_NON_AUTO 0x02
-#define NCI_INTF_EXT_WLCP_SEMI_AUTO 0x03
-
-/**********************************************
- * NCI RF Management / DISCOVERY Group Params
- **********************************************/
-
-#define NCI_DISCOVER_PARAM_SIZE_SELECT 0x03 /* ID, protocol, interface */
-#define NCI_DISCOVER_PARAM_SIZE_DEACT 0x01 /* type */
-#define NCI_DISCOVER_PARAM_SIZE_DETECT 0x01 /* waiting_time */
-#define NCI_DISCOVER_PARAM_SIZE_EXT 0x02 /* ID, parameter length */
-
-/**********************************************
- * Supported Protocols
- **********************************************/
-#define NCI_PROTOCOL_UNKNOWN 0x00
-#define NCI_PROTOCOL_T1T 0x01
-#define NCI_PROTOCOL_T2T 0x02
-#define NCI_PROTOCOL_T3T 0x03
-#define NCI_PROTOCOL_T5T 0x06
-#define NCI_PROTOCOL_ISO_DEP 0x04
-#define NCI_PROTOCOL_NFC_DEP 0x05
-
-/* Discovery Types/Detected Technology and Mode */
-#define NCI_DISCOVERY_TYPE_POLL_A 0x00
-#define NCI_DISCOVERY_TYPE_POLL_B 0x01
-#define NCI_DISCOVERY_TYPE_POLL_F 0x02
-#define NCI_DISCOVERY_TYPE_POLL_V 0x06
-#define NCI_DISCOVERY_TYPE_LISTEN_A 0x80
-#define NCI_DISCOVERY_TYPE_LISTEN_B 0x81
-#define NCI_DISCOVERY_TYPE_LISTEN_F 0x82
-#define NCI_DISCOVERY_TYPE_LISTEN_ISO15693 0x86
-
-typedef uint8_t tNCI_DISCOVERY_TYPE;
-
-#define NCI_EE_TRIG_7816_SELECT 0x00
-#define NCI_EE_TRIG_RF_PROTOCOL 0x01
-#define NCI_EE_TRIG_RF_TECHNOLOGY 0x02
-#define NCI_EE_TRIG_APP_INIT 0x10
-
-#define NCI_EE_ACT_TAG_AID 0xC0 /* AID */
-#define NCI_EE_ACT_TAG_DATA 0xC3 /* hex data for app */
-
-/* NFCEE ID (1 octet) PL config (1 octet) */
-#define NCI_CORE_PARAM_SIZE_NFCEE_PL_CTRL 0x02
-/* Status (1 octet) */
-/* Technology based routing */
-#define NCI_ROUTE_TAG_TECH 0x00
-/* Protocol based routing */
-#define NCI_ROUTE_TAG_PROTO 0x01
-#define NCI_ROUTE_TAG_AID 0x02 /* AID routing */
-#define NCI_ROUTE_TAG_SYSCODE 0x03 /* SystemCode routing */
-
-#define NCI_ROUTE_PWR_STATE_ON 0x01 /* The device is on */
-/* The device is switched off */
-#define NCI_ROUTE_PWR_STATE_SWITCH_OFF 0x02
-/* The device's battery is removed */
-#define NCI_ROUTE_PWR_STATE_BATT_OFF 0x04
-/* The device is screen off Unlock mode */
-#define NCI_ROUTE_PWR_STATE_SCREEN_OFF_UNLOCK() \
- ((NFC_GetNCIVersion() >= NCI_VERSION_2_0) ? 0x08 : 0x80)
-/* The device is screen on lock mode */
-#define NCI_ROUTE_PWR_STATE_SCREEN_ON_LOCK() \
- ((NFC_GetNCIVersion() >= NCI_VERSION_2_0) ? 0x10 : 0x40)
-/* The device is screen off lock mode */
-#define NCI_ROUTE_PWR_STATE_SCREEN_OFF_LOCK() \
- ((NFC_GetNCIVersion() >= NCI_VERSION_2_0) ? 0x20 : 0x00)
-
-/* Hardware / Registration Identification */
-#define NCI_NFCEE_TAG_HW_ID 0x00
-#define NCI_NFCEE_TAG_ATR_BYTES 0x01 /* ATR Bytes */
-/* T3T Command Set Interface Supplementary Info */
-#define NCI_NFCEE_TAG_T3T_INFO 0x02
-#define NCI_NFCEE_TAG_HCI_HOST_ID 0xA0 /* HCI host ID */
-
-#define NCI_DISCOVER_NTF_LAST 0x00
-#define NCI_DISCOVER_NTF_LAST_ABORT 0x01
-#define NCI_DISCOVER_NTF_MORE 0x02
-
-/* NCI RF Management Group Params */
-#define NCI_RF_PARAM_SIZE_T3T_POLLING 0x04 /* System Code, RC, TSN */
-
-/**********************************************
- * NCI Parameter IDs
- **********************************************/
-
-#define NCI_PARAM_ID_TOTAL_DURATION 0x00
-#define NCI_PARAM_ID_CON_DEVICES_LIMIT 0x01
-#define NCI_PARAM_ID_CON_DISCOVERY_PARAM 0x02
-#define NCI_PARAM_ID_PA_BAILOUT 0x08
-#define NCI_PARAM_ID_PA_DEVICES_LIMIT 0x09
-#define NCI_PARAM_ID_PB_AFI 0x10
-#define NCI_PARAM_ID_PB_BAILOUT 0x11
-#define NCI_PARAM_ID_PB_ATTRIB_PARAM1 0x12
-#define NCI_PARAM_ID_PB_DEVICES_LIMIT 0x14
-#define NCI_PARAM_ID_PF_BIT_RATE 0x18
-#define NCI_PARAM_ID_PF_RC 0x19
-#define NCI_PARAM_ID_PF_BAILOUT 0x19
-#define NCI_PARAM_ID_PF_DEVICES_LIMIT 0x1A
-#define NCI_PARAM_ID_PB_H_INFO 0x20
-#define NCI_PARAM_ID_PI_BIT_RATE 0x21
-#define NCI_PARAM_ID_ATR_REQ_CONFIG 0x2A
-#define NCI_PARAM_ID_PV_DEVICES_LIMIT 0x2F
-
-#define NCI_PARAM_ID_LA_BIT_FRAME_SDD 0x30
-#define NCI_PARAM_ID_LA_PLATFORM_CONFIG 0x31
-#define NCI_PARAM_ID_LA_SEL_INFO 0x32
-#define NCI_PARAM_ID_LA_NFCID1 0x33
-#define NCI_PARAM_ID_LB_SENSB_INFO 0x38
-#define NCI_PARAM_ID_LB_NFCID0 0x39
-#define NCI_PARAM_ID_LB_APPDATA 0x3A
-#define NCI_PARAM_ID_LB_SFGI 0x3B
-#define NCI_PARAM_ID_LB_ADC_FO 0x3C
-#define NCI_PARAM_ID_LB_PROTOCOL NCI_PARAM_ID_LB_SENSB_INFO
-
-#define NCI_PARAM_ID_LF_T3T_ID1 0x40
-#define NCI_PARAM_ID_LF_T3T_ID2 0x41
-#define NCI_PARAM_ID_LF_T3T_ID3 0x42
-#define NCI_PARAM_ID_LF_T3T_ID4 0x43
-#define NCI_PARAM_ID_LF_T3T_ID5 0x44
-#define NCI_PARAM_ID_LF_T3T_ID6 0x45
-#define NCI_PARAM_ID_LF_T3T_ID7 0x46
-#define NCI_PARAM_ID_LF_T3T_ID8 0x47
-#define NCI_PARAM_ID_LF_T3T_ID9 0x48
-#define NCI_PARAM_ID_LF_T3T_ID10 0x49
-#define NCI_PARAM_ID_LF_T3T_ID11 0x4A
-#define NCI_PARAM_ID_LF_T3T_ID12 0x4B
-#define NCI_PARAM_ID_LF_T3T_ID13 0x4C
-#define NCI_PARAM_ID_LF_T3T_ID14 0x4D
-#define NCI_PARAM_ID_LF_T3T_ID15 0x4E
-#define NCI_PARAM_ID_LF_T3T_ID16 0x4F
-#define NCI_PARAM_ID_LF_PROTOCOL 0x50
-#define NCI_PARAM_ID_LF_T3T_PMM 0x51
-/* max num of LF_T3T_ID supported by NFCC (1 for now) */
-#define NCI_PARAM_ID_LF_T3T_MAX 0x52
-#define NCI_PARAM_ID_LF_T3T_FLAGS2 0x53
-#define NCI_PARAM_ID_LF_CON_BITR_F 0x54
-#define NCI_PARAM_ID_LF_CON_ADV_FEAT 0x55
-/*LF_T3T name changed in NCI2.0*/
-#define NCI_PARAM_ID_LF_T3T_RD_ALLOWED 0x55
-
-#define NCI_PARAM_ID_FWI 0x58
-#define NCI_PARAM_ID_LA_HIST_BY 0x59
-#define NCI_PARAM_ID_LB_H_INFO_RSP 0x5A
-#define NCI_PARAM_ID_LI_BIT_RATE 0x5B
-
-#define NCI_PARAM_ID_WT 0x60
-#define NCI_PARAM_ID_ATR_RES_GEN_BYTES 0x61
-#define NCI_PARAM_ID_ATR_RSP_CONFIG 0x62
-#define NCI_PARAM_ID_PACM_BIT_RATE 0x68
-
-#define NCI_PARAM_ID_RF_FIELD_INFO 0x80
-#define NCI_PARAM_ID_NFC_DEP_OP 0x82
-
-#define NCI_PARAM_ID_NFCC_CONFIG_CONTROL 0x85
-
-/* Type A Parameters */
-#define NCI_PARAM_PLATFORM_T1T 0x0C
-#define NCI_PARAM_SEL_INFO_ISODEP 0x20
-/**********************************************
- * NCI Parameter ID Lens
- **********************************************/
-#define NCI_PARAM_LEN_TOTAL_DURATION 2
-
-#define NCI_PARAM_LEN_CON_DISCOVERY_PARAM 1
-
-#define NCI_PARAM_LEN_PF_RC 1
-
-#define NCI_PARAM_LEN_LA_BIT_FRAME_SDD 1
-#define NCI_PARAM_LEN_LA_PLATFORM_CONFIG 1
-#define NCI_PARAM_LEN_LA_SEL_INFO 1
-
-#define NCI_PARAM_LEN_LB_SENSB_INFO 1
-#define NCI_PARAM_LEN_LB_NFCID0 4
-#define NCI_PARAM_LEN_LB_APPDATA 4
-#define NCI_PARAM_LEN_LB_ADC_FO 1
-#define NCI_PARAM_LEN_RF_FIELD_INFO 1
-
-#define NCI_PARAM_LEN_LF_PROTOCOL 1
-#define NCI_PARAM_LEN_LF_T3T_FLAGS2 2
-#define NCI_PARAM_LEN_LF_T3T_PMM 8
-#define NCI_PARAM_LEN_LF_T3T_ID(X) (((X) >= NCI_VERSION_2_0) ? (0x12) : (0x0A))
-#define NCI_PARAM_LEN_LF_CON_ADV_FEAT 1
-
-#define NCI_PARAM_LEN_LF_T3T_RD_ALLOWED 1 // Listen F NCI2.0 Parameter
-
-#define NCI_PARAM_LEN_FWI 1
-#define NCI_PARAM_LEN_WT 1
-/* GEN_BYTES - variable */
-
-/* Listen protocol bits - NCI_PARAM_ID_LF_PROTOCOL and
- * NCI_PARAM_ID_LB_SENSB_INFO */
-#define NCI_LISTEN_PROTOCOL_ISO_DEP 0x01
-
-/* LF_T3T_FLAGS2 listen bits all-disabled definition */
-#define NCI_LF_T3T_FLAGS2_ALL_DISABLED 0x0000
-
-/* The DH-NFCEE listen is considered as a enable NFCEE */
-#define NCI_LISTEN_DH_NFCEE_ENABLE_MASK 0x00
-/* The DH-NFCEE listen is considered as a disable NFCEE */
-#define NCI_LISTEN_DH_NFCEE_DISABLE_MASK 0x02
-/* The DH polling is considered as a disable NFCEE */
-#define NCI_POLLING_DH_DISABLE_MASK 0x00
-/* The DH polling is considered as a enable NFCEE */
-#define NCI_POLLING_DH_ENABLE_MASK 0x01
-/* SCBR support check with Core Init resp OCT1 byte */
-#define NCI_SCBR_MASK 0x10
-
-/* AID matching is allowed when the SELECT AID is longer */
-#define NCI_ROUTE_QUAL_LONG_SELECT 0x10
-/* AID matching is allowed when the SELECT AID is shorter */
-#define NCI_ROUTE_QUAL_SHORT_SELECT 0x20
-/* AID is blocked in unsupported power mode */
-#define NCI_ROUTE_QUAL_BLOCK_ROUTE 0x40
-
-#ifndef NCI_GET_CMD_BUF
-#if (HCI_USE_VARIABLE_SIZE_CMD_BUF == FALSE)
-/* Allocate fixed-size buffer from HCI_CMD_POOL (default case) */
-#define NCI_GET_CMD_BUF(paramlen) \
- gki_utils ? (NFC_HDR*)gki_utils->getpoolbuf(NFC_NCI_POOL_ID) \
- : (NFC_HDR*)(new GkiUtils())->getpoolbuf(NFC_NCI_POOL_ID)
-#else
-/* Allocate smallest possible buffer (for platforms with limited RAM) */
-#define NCI_GET_CMD_BUF(paramlen) \
- ((NFC_HDR*)GKI_getbuf((uint16_t)(NFC_HDR_SIZE + NCI_MSG_HDR_SIZE + \
- NCI_MSG_OFFSET_SIZE + (paramlen))))
-#endif
-#endif /* NCI_GET_CMD_BUF */
-
-#define NCI_MAX_AID_LEN 16
-
-typedef struct {
- uint8_t type;
- uint8_t frequency;
-} tNCI_DISCOVER_PARAMS;
-
-typedef struct {
- uint8_t protocol;
- uint8_t mode;
- uint8_t intf_type;
-} tNCI_DISCOVER_MAPS;
-
-#define NCI_NFCID1_MAX_LEN 10
-#define NCI_T1T_HR_LEN 2
-typedef struct {
- uint8_t sens_res[2]; /* SENS_RES Response (ATQA). Available after Technology
- Detection */
- uint8_t nfcid1_len; /* 4, 7 or 10 */
- uint8_t nfcid1[NCI_NFCID1_MAX_LEN]; /* AKA NFCID1 */
- uint8_t sel_rsp; /* SEL_RSP (SAK) Available after Collision Resolution */
- uint8_t hr_len; /* 2, if T1T HR0/HR1 is reported */
- uint8_t hr[NCI_T1T_HR_LEN]; /* T1T HR0 is in hr[0], HR1 is in hr[1] */
-} tNCI_RF_PA_PARAMS;
-
-#define NCI_MAX_SENSB_RES_LEN 12
-typedef struct {
- uint8_t sensb_res_len; /* Length of SENSB_RES Response (Byte 2 - Byte 12 or
- 13) Available after Technology Detection */
- uint8_t sensb_res[NCI_MAX_SENSB_RES_LEN]; /* SENSB_RES Response (ATQ) */
-} tNCI_RF_PB_PARAMS;
-
-#define NCI_MAX_SENSF_RES_LEN 18
-#define NCI_NFCID2_LEN 8
-#define NCI_T3T_PMM_LEN 8
-#define NCI_SYSTEMCODE_LEN 2
-#define NCI_RF_F_UID_LEN NCI_NFCID2_LEN
-#define NCI_MRTI_CHECK_INDEX 13
-#define NCI_MRTI_UPDATE_INDEX 14
-typedef struct {
- uint8_t bit_rate; /* NFC_BIT_RATE_212 or NFC_BIT_RATE_424 */
- uint8_t sensf_res_len; /* Length of SENSF_RES Response (Byte 2 - Byte 17 or
- 19) Available after Technology Detection */
- uint8_t sensf_res[NCI_MAX_SENSF_RES_LEN]; /* SENSB_RES Response */
-} tNCI_RF_PF_PARAMS;
-
-typedef struct {
- uint8_t nfcid2[NCI_NFCID2_LEN]; /* NFCID2 generated by the Local NFCC for
- NFC-DEP Protocol.Available for Frame
- Interface */
-} tNCI_RF_LF_PARAMS;
-
-#ifndef NCI_MAX_ATS_LEN
-#define NCI_MAX_ATS_LEN 64
-#endif
-#ifndef NCI_MAX_HIS_BYTES_LEN
-#define NCI_MAX_HIS_BYTES_LEN 50
-#endif
-#ifndef NCI_MAX_GEN_BYTES_LEN
-#define NCI_MAX_GEN_BYTES_LEN 48
-#endif
-
-#define NCI_ATS_T0_INDEX 0
-#define NCI_ATS_TC_MASK 0x40
-#define NCI_ATS_TB_MASK 0x20
-#define NCI_ATS_TA_MASK 0x10
-typedef struct {
- uint8_t ats_res_len; /* Length of ATS RES */
- uint8_t ats_res[NCI_MAX_ATS_LEN]; /* ATS RES defined in [DIGPROT] */
-} tNCI_INTF_PA_ISO_DEP;
-
-typedef struct {
- uint8_t rats; /* RATS */
-} tNCI_INTF_LA_ISO_DEP;
-
-#define NCI_P_GEN_BYTE_INDEX 15
-#define NCI_L_GEN_BYTE_INDEX 14
-#define NCI_L_NFC_DEP_TO_INDEX 13
-
-#define NCI_MAX_ATTRIB_LEN (10 + NCI_MAX_GEN_BYTES_LEN)
-
-typedef struct {
- uint8_t attrib_res_len; /* Length of ATTRIB RES */
- uint8_t
- attrib_res[NCI_MAX_ATTRIB_LEN]; /* ATTRIB RES as defined in [DIGPROT] */
-} tNCI_INTF_PB_ISO_DEP;
-
-typedef struct {
- uint8_t attrib_req_len; /* Length of ATTRIB REQ */
- uint8_t attrib_req[NCI_MAX_ATTRIB_LEN]; /* ATTRIB REQ (Byte 2 - Byte 10+k) as
- defined in [DIGPROT] */
-} tNCI_INTF_LB_ISO_DEP;
-
-typedef struct {
- uint8_t atr_res_len; /* Length of ATR_RES */
- uint8_t atr_res[NCI_MAX_ATS_LEN]; /* ATR_RES (Byte 3 - Byte 17+n) */
- uint8_t max_payload_size; /* 64, 128, 192 or 254 */
- uint8_t gen_bytes_len; /* len of general bytes */
- uint8_t gen_bytes[NCI_MAX_GEN_BYTES_LEN]; /* general bytes */
- uint8_t waiting_time; /* WT -> Response Waiting Time
- RWT = (256 x 16/fC) x 2WT */
-} tNCI_RF_ACM_P_PARAMS;
-
-#define NCI_WPT_POWER_ADJ_REQ_TYPE 0x00
-#define NCI_WPT_TIME_INT_TYPE 0x01
-
-#endif /* NFC_NCI_DEFS_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nfc_brcm_defs.h b/libstpropnci/libstnfc-nci-headers/src/include/nfc_brcm_defs.h
deleted file mode 100755
index cf56139..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nfc_brcm_defs.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2012-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 the Broadcom-specific definitions that are shared
- * between HAL, nfc stack, adaptation layer and applications.
- *
- ******************************************************************************/
-
-#ifndef NFC_BRCM_DEFS_H
-#define NFC_BRCM_DEFS_H
-
-/**********************************************
- * NCI Message Proprietary Group - F
- **********************************************/
-#define NCI_MSG_GET_BUILD_INFO 0x04
-#define NCI_MSG_HCI_NETWK 0x05
-#define NCI_MSG_POWER_LEVEL 0x08
-#define NCI_MSG_UICC_READER_ACTION 0x0A
-/* reset HCI network/close all pipes (S,D) register */
-#define NCI_MSG_GET_NV_DEVICE 0x24
-#define NCI_MSG_LPTD 0x25
-#define NCI_MSG_EEPROM_RW 0x29
-#define NCI_MSG_GET_PATCH_VERSION 0x2D
-#define NCI_MSG_SECURE_PATCH_DOWNLOAD 0x2E
-
-/* Secure Patch Download definitions (patch type definitions) */
-#define NCI_SPD_TYPE_HEADER 0x00
-
-/**********************************************
- * NCI Interface Types
- **********************************************/
-#define NCI_INTERFACE_VS_MIFARE NCI_PROTOCOL_MIFARE
-#define NCI_INTERFACE_VS_T2T_CE 0x82 /* for Card Emulation side */
-
-#define NFC_SNOOZE_MODE_UART 0x01 /* Snooze mode for UART */
-
-#define NFC_SNOOZE_ACTIVE_LOW 0x00 /* high to low voltage is asserting */
-
-/**********************************************
- * HCI definitions
- **********************************************/
-#define NFC_HAL_HCI_SESSION_ID_LEN 8
-#define NFC_HAL_HCI_SYNC_ID_LEN 2
-
-/* Card emulation RF Gate A definitions */
-#define NFC_HAL_HCI_CE_RF_A_UID_REG_LEN 10
-#define NFC_HAL_HCI_CE_RF_A_ATQA_RSP_CODE_LEN 2
-#define NFC_HAL_HCI_CE_RF_A_MAX_HIST_DATA_LEN 15
-#define NFC_HAL_HCI_CE_RF_A_MAX_DATA_RATE_LEN 3
-
-/* Card emulation RF Gate B definitions */
-#define NFC_HAL_HCI_CE_RF_B_PUPI_LEN 4
-#define NFC_HAL_HCI_CE_RF_B_ATQB_LEN 4
-#define NFC_HAL_HCI_CE_RF_B_HIGHER_LAYER_RSP_LEN 61
-#define NFC_HAL_HCI_CE_RF_B_MAX_DATA_RATE_LEN 3
-
-/* Card emulation RF Gate BP definitions */
-#define NFC_HAL_HCI_CE_RF_BP_MAX_PAT_IN_LEN 8
-#define NFC_HAL_HCI_CE_RF_BP_DATA_OUT_LEN 40
-
-/* Reader RF Gate A definitions */
-#define NFC_HAL_HCI_RD_RF_B_HIGHER_LAYER_DATA_LEN 61
-
-/* DH HCI Network command definitions */
-#define NFC_HAL_HCI_DH_MAX_DYN_PIPES 20
-
-#endif /* NFC_BRCM_DEFS_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nfc_config.h b/libstpropnci/libstnfc-nci-headers/src/include/nfc_config.h
deleted file mode 100755
index f478179..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nfc_config.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2017 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.
- */
-#pragma once
-
-#include <config.h>
-
-#include <string>
-#include <vector>
-
-/* Configs from libnfc-nci.conf */
-#define NAME_NFC_DEBUG_ENABLED "NFC_DEBUG_ENABLED"
-#define NAME_NFA_STORAGE "NFA_STORAGE"
-#define NAME_PRESERVE_STORAGE "PRESERVE_STORAGE"
-#define NAME_POLLING_TECH_MASK "POLLING_TECH_MASK"
-#define NAME_UICC_LISTEN_TECH_MASK "UICC_LISTEN_TECH_MASK"
-#define NAME_OFFHOST_LISTEN_TECH_MASK "OFFHOST_LISTEN_TECH_MASK"
-#define NAME_HOST_LISTEN_TECH_MASK "HOST_LISTEN_TECH_MASK"
-#define NAME_NFA_DM_CFG "NFA_DM_CFG"
-#define NAME_NFA_MAX_EE_SUPPORTED "NFA_MAX_EE_SUPPORTED"
-#define NAME_NFA_DM_DISC_DURATION_POLL "NFA_DM_DISC_DURATION_POLL"
-#define NAME_POLL_FREQUENCY "POLL_FREQUENCY"
-#define NAME_NFA_AID_BLOCK_ROUTE "NFA_AID_BLOCK_ROUTE"
-#define NAME_AID_FOR_EMPTY_SELECT "AID_FOR_EMPTY_SELECT"
-#define NAME_AID_MATCHING_MODE "AID_MATCHING_MODE"
-#define NAME_OFFHOST_AID_ROUTE_PWR_STATE "OFFHOST_AID_ROUTE_PWR_STATE"
-#define NAME_RECOVERY_OPTION "RECOVERY_OPTION"
-#define NAME_ALWAYS_ON_SET_EE_POWER_AND_LINK_CONF \
- "ALWAYS_ON_SET_EE_POWER_AND_LINK_CONF"
-#define NAME_DISABLE_ALWAYS_ON_SET_EE_POWER_AND_LINK_CONF \
- "DISABLE_ALWAYS_ON_SET_EE_POWER_AND_LINK_CONF"
-#define NAME_NCI_RESET_TYPE "NCI_RESET_TYPE"
-#define NAME_MUTE_TECH_ROUTE_OPTION "MUTE_TECH_ROUTE_OPTION"
-#define NAME_NFA_DM_LISTEN_ACTIVE_DEACT_NTF_TIMEOUT \
- "NFA_DM_LISTEN_ACTIVE_DEACT_NTF_TIMEOUT"
-#define NAME_EUICC_MEP_MODE "EUICC_MEP_MODE"
-#define NAME_NFCEE_EVENT_RF_DISCOVERY_OPTION "NFCEE_EVENT_RF_DISCOVERY_OPTION"
-#define NAME_NFA_EE_ROUTE_DEBOUNCE_TIMER "NFA_EE_ROUTE_DEBOUNCE_TIMER"
-/* Configs from vendor interface */
-#define NAME_NFA_POLL_BAIL_OUT_MODE "NFA_POLL_BAIL_OUT_MODE"
-#define NAME_PRESENCE_CHECK_ALGORITHM "PRESENCE_CHECK_ALGORITHM"
-#define NAME_NFA_PROPRIETARY_CFG "NFA_PROPRIETARY_CFG"
-#define NAME_DEFAULT_OFFHOST_ROUTE "DEFAULT_OFFHOST_ROUTE"
-#define NAME_OFFHOST_ROUTE_ESE "OFFHOST_ROUTE_ESE"
-#define NAME_OFFHOST_ROUTE_UICC "OFFHOST_ROUTE_UICC"
-#define NAME_DEFAULT_NFCF_ROUTE "DEFAULT_NFCF_ROUTE"
-#define NAME_DEFAULT_SYS_CODE "DEFAULT_SYS_CODE"
-#define NAME_DEFAULT_SYS_CODE_ROUTE "DEFAULT_SYS_CODE_ROUTE"
-#define NAME_DEFAULT_SYS_CODE_PWR_STATE "DEFAULT_SYS_CODE_PWR_STATE"
-#define NAME_DEFAULT_ROUTE "DEFAULT_ROUTE"
-#define NAME_OFF_HOST_ESE_PIPE_ID "OFF_HOST_ESE_PIPE_ID"
-#define NAME_OFF_HOST_SIM_PIPE_ID "OFF_HOST_SIM_PIPE_ID"
-#define NAME_OFF_HOST_SIM_PIPE_IDS "OFF_HOST_SIM_PIPE_IDS"
-#define NAME_ISO_DEP_MAX_TRANSCEIVE "ISO_DEP_MAX_TRANSCEIVE"
-#define NAME_DEVICE_HOST_ALLOW_LIST "DEVICE_HOST_ALLOW_LIST"
-#define NAME_DEFAULT_ISODEP_ROUTE "DEFAULT_ISODEP_ROUTE"
-#define NAME_PRESENCE_CHECK_RETRY_COUNT "PRESENCE_CHECK_RETRY_COUNT"
-#define NAME_ISO15693_SKIP_GET_SYS_INFO_CMD "ISO15693_SKIP_GET_SYS_INFO_CMD"
-#define NAME_DEFAULT_T4TNFCEE_AID_POWER_STATE "DEFAULT_T4TNFCEE_AID_POWER_STATE"
-#define NAME_T4T_NDEF_NFCEE_AID "T4T_NDEF_NFCEE_AID"
-#define NAME_DEFAULT_NDEF_NFCEE_ROUTE "DEFAULT_NDEF_NFCEE_ROUTE"
-#define NAME_T4T_NFCEE_ENABLE "T4T_NFCEE_ENABLE"
-
-class NfcConfig {
- public:
- static bool hasKey(const std::string& key);
- static std::string getString(const std::string& key);
- static std::string getString(const std::string& key,
- std::string default_value);
- static unsigned getUnsigned(const std::string& key);
- static unsigned getUnsigned(const std::string& key, unsigned default_value);
- static std::vector<uint8_t> getBytes(const std::string& key);
- static void clear();
-
- private:
- void loadConfig();
- static NfcConfig& getInstance();
- NfcConfig() {};
-
- ConfigFile config_;
-};
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_api.h b/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_api.h
deleted file mode 100755
index 8934a63..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_api.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2012-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.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * NFC Hardware Abstraction Layer API
- *
- ******************************************************************************/
-#ifndef NFC_HAL_API_H
-#define NFC_HAL_API_H
-#include "data_types.h"
-#include "hardware_nfc.h"
-#include "nfc_hal_target.h"
-
-typedef uint8_t tHAL_NFC_STATUS;
-typedef void(tHAL_NFC_STATUS_CBACK)(tHAL_NFC_STATUS status);
-typedef void(tHAL_NFC_CBACK)(uint8_t event, tHAL_NFC_STATUS status);
-typedef void(tHAL_NFC_DATA_CBACK)(uint16_t data_len, uint8_t* p_data);
-
-/*******************************************************************************
-** tHAL_NFC_ENTRY HAL entry-point lookup table
-*******************************************************************************/
-
-typedef void(tHAL_API_INITIALIZE)(void);
-typedef void(tHAL_API_TERMINATE)(void);
-typedef void(tHAL_API_OPEN)(tHAL_NFC_CBACK* p_hal_cback,
- tHAL_NFC_DATA_CBACK* p_data_cback);
-typedef void(tHAL_API_CLOSE)(void);
-typedef void(tHAL_API_CORE_INITIALIZED)(uint16_t data_len,
- uint8_t* p_core_init_rsp_params);
-typedef void(tHAL_API_WRITE)(uint16_t data_len, uint8_t* p_data);
-typedef bool(tHAL_API_PREDISCOVER)(void);
-typedef void(tHAL_API_CONTROL_GRANTED)(void);
-typedef void(tHAL_API_POWER_CYCLE)(void);
-typedef uint8_t(tHAL_API_GET_MAX_NFCEE)(void);
-
-typedef struct {
- tHAL_API_INITIALIZE* initialize;
- tHAL_API_TERMINATE* terminate;
- tHAL_API_OPEN* open;
- tHAL_API_CLOSE* close;
- tHAL_API_CORE_INITIALIZED* core_initialized;
- tHAL_API_WRITE* write;
- tHAL_API_PREDISCOVER* prediscover;
- tHAL_API_CONTROL_GRANTED* control_granted;
- tHAL_API_POWER_CYCLE* power_cycle;
- tHAL_API_GET_MAX_NFCEE* get_max_ee;
-
-} tHAL_NFC_ENTRY;
-
-/*******************************************************************************
-** HAL API Function Prototypes
-*******************************************************************************/
-
-#endif /* NFC_HAL_API_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_int.h b/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_int.h
deleted file mode 100755
index 3c82f35..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_int.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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 the NCI transport internal definitions and functions.
- *
- ******************************************************************************/
-
-#ifndef NFC_HAL_INT_H
-#define NFC_HAL_INT_H
-
-#include "gki.h"
-#include "nci_defs.h"
-#include "nfc_brcm_defs.h"
-#include "nfc_hal_api.h"
-#include "nfc_hal_int_api.h"
-#include "nfc_hal_target.h"
-
-using android::base::StringPrintf;
-
-/* NFC HAL Task Timer events */
-#ifndef NFC_HAL_QUICK_TIMER_EVT_MASK
-#define NFC_HAL_QUICK_TIMER_EVT_MASK (TIMER_0_EVT_MASK)
-#endif
-
-#ifndef NFC_HAL_QUICK_TIMER_ID
-#define NFC_HAL_QUICK_TIMER_ID (TIMER_0)
-#endif
-
-typedef uint8_t tNFC_HAL_WAIT_RSP;
-
-#if (NFC_HAL_HCI_INCLUDED == TRUE)
-
-#endif
-
-/* NFC HAL transport configuration */
-typedef struct {
- bool shared_transport; /* TRUE if using shared HCI/NCI transport */
- uint8_t userial_baud;
- uint8_t userial_fc;
-} tNFC_HAL_TRANS_CFG;
-
-#ifdef TESTER
-/* For Insight, ncit_cfg is runtime-configurable */
-#define NFC_HAL_TRANS_CFG_QUALIFIER
-#else
-/* For all other platforms, ncit_cfg is constant */
-#define NFC_HAL_TRANS_CFG_QUALIFIER const
-#endif
-extern NFC_HAL_TRANS_CFG_QUALIFIER tNFC_HAL_TRANS_CFG nfc_hal_trans_cfg;
-
-/****************************************************************************
-** Internal constants and definitions
-****************************************************************************/
-
-typedef uint8_t tNFC_HAL_NCI_RAS;
-
-typedef uint8_t tNFC_HAL_POWER_MODE;
-
-#define NFC_HAL_SAVED_HDR_SIZE (2)
-#define NFC_HAL_SAVED_CMD_SIZE (2)
-
-#ifndef NFC_HAL_DEBUG
-#define NFC_HAL_DEBUG TRUE
-#endif
-
-#if (NFC_HAL_DEBUG == TRUE)
-extern const char* const nfc_hal_init_state_str[];
-#define NFC_HAL_SET_INIT_STATE(state) \
- LOG(VERBOSE) << StringPrintf("init state=%d->%d(%s)", \
- nfc_hal_cb.dev_cb.initializing_state, state, \
- nfc_hal_init_state_str[state]); \
- nfc_hal_cb.dev_cb.initializing_state = state;
-#else
-#define NFC_HAL_SET_INIT_STATE(state) \
- nfc_hal_cb.dev_cb.initializing_state = state;
-#endif
-
-typedef uint8_t tNFC_HAL_INIT_STATE;
-
-typedef uint8_t tNFC_HAL_DM_CONFIG;
-
-/* callback function prototype */
-typedef struct {
- uint16_t opcode;
- uint16_t param_len;
- uint8_t* p_param_buf;
-} tNFC_HAL_BTVSC_CPLT;
-
-#if (NFC_HAL_HCI_INCLUDED == TRUE)
-
-/* data type for NFC_HAL_HCI_RSP_NV_READ_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint8_t block;
- uint16_t size;
- tHAL_NFC_STATUS status;
-} tNFC_HAL_HCI_RSP_NV_READ_EVT;
-
-/* data type for NFC_HAL_HCI_RSP_NV_WRITE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tHAL_NFC_STATUS status;
-} tNFC_HAL_HCI_RSP_NV_WRITE_EVT;
-
-/* union of all event data types */
-typedef union {
- NFC_HDR hdr;
- /* Internal events */
- tNFC_HAL_HCI_RSP_NV_READ_EVT nv_read;
- tNFC_HAL_HCI_RSP_NV_WRITE_EVT nv_write;
-} tNFC_HAL_HCI_EVENT_DATA;
-
-#endif
-/*****************************************************************************
-** Control block for NFC HAL
-*****************************************************************************/
-
-/* Information about current patch in NVM */
-typedef struct {
- uint16_t project_id; /* Current project_id of patch in nvm */
- uint16_t ver_major; /* Current major version of patch in nvm */
- uint16_t ver_minor; /* Current minor version of patch in nvm */
- uint16_t fpm_size; /* Current size of FPM patch in nvm */
- uint16_t lpm_size; /* Current size of LPM patch in nvm */
- uint8_t flags; /* See NFC_HAL_NVM_FLAGS_* flag definitions */
- uint8_t nvm_type; /* Current NVM Type - UICC/EEPROM */
- uint8_t chip_ver[NFC_HAL_PRM_MAX_CHIP_VER_LEN]; /* patch chip version */
-} tNFC_HAL_NVM;
-
-/* Patch for I2C fix */
-typedef struct {
- uint8_t* p_patch; /* patch for i2c fix */
- uint32_t prei2c_delay; /* the dealy after preI2C patch */
- uint16_t len; /* i2c patch length */
-} tNFC_HAL_PRM_I2C_FIX_CB;
-
-/* Control block for NCI transport */
-typedef struct {
- uint8_t nci_ctrl_size; /* Max size for NCI messages */
- uint8_t rcv_state; /* current rx state */
- uint16_t rcv_len; /* bytes remaining to be received in current rx state */
- NFC_HDR* p_rcv_msg; /* buffer to receive NCI message */
- NFC_HDR* p_frag_msg; /* fragmented NCI message; waiting for last fragment */
- NFC_HDR*
- p_pend_cmd; /* pending NCI message; waiting for NFCC state to be free */
- tNFC_HAL_NCI_RAS nci_ras; /* nci reassembly error status */
- TIMER_LIST_ENT
- nci_wait_rsp_timer; /* Timer for waiting for nci command response */
- tNFC_HAL_WAIT_RSP nci_wait_rsp; /* nci wait response flag */
- uint8_t
- last_hdr[NFC_HAL_SAVED_HDR_SIZE]; /* part of last NCI command header */
- uint8_t
- last_cmd[NFC_HAL_SAVED_CMD_SIZE]; /* part of last NCI command payload */
- void* p_vsc_cback; /* the callback function for last VSC command */
-} tNFC_HAL_NCIT_CB;
-
-/* Control block for device initialization */
-typedef struct {
- tNFC_HAL_INIT_STATE initializing_state; /* state of initializing NFCC */
-
- uint32_t brcm_hw_id; /* BRCM NFCC HW ID */
- tNFC_HAL_DM_CONFIG next_dm_config; /* next config in post initialization */
- uint8_t next_startup_vsc; /* next start-up VSC offset in post init */
-
- tNFC_HAL_POWER_MODE power_mode; /* NFCC power mode */
- uint8_t snooze_mode; /* current snooze mode */
- uint8_t new_snooze_mode; /* next snooze mode after receiving cmpl */
- uint8_t nfc_wake_active_mode; /* NFC_HAL_LP_ACTIVE_LOW/HIGH */
- TIMER_LIST_ENT lp_timer; /* timer for low power mode */
-
- tHAL_NFC_STATUS_CBACK*
- p_prop_cback; /* callback to notify complete of proprietary update */
-} tNFC_HAL_DEV_CB;
-
-#if (NFC_HAL_HCI_INCLUDED == TRUE)
-
-/* data members for NFC_HAL-HCI */
-typedef struct {
- TIMER_LIST_ENT
- hci_timer; /* Timer to avoid indefinitely waiting for response */
- uint8_t*
- p_hci_netwk_info_buf; /* Buffer for reading HCI Network information */
- uint8_t* p_hci_netwk_dh_info_buf; /* Buffer for reading HCI Network DH
- information */
- uint8_t hci_netwk_config_block; /* Rsp awaiting for hci network configuration
- block */
- bool b_wait_hcp_conn_create_rsp; /* Waiting for hcp connection create response
- */
- bool clear_all_pipes_to_uicc1; /* UICC1 was restarted for patch download */
- bool update_session_id; /* Next response from NFCC is to Get Session id cmd */
- bool hci_fw_workaround; /* HAL HCI Workaround need */
- bool hci_fw_validate_netwk_cmd; /* Flag to indicate if hci network ntf to
- validate */
- uint8_t hcp_conn_id; /* NCI Connection id for HCP */
- uint8_t dh_session_id[1]; /* Byte 0 of DH Session ID */
-} tNFC_HAL_HCI_CB;
-
-#endif
-
-typedef uint8_t tNFC_HAL_FLAGS;
-
-typedef struct {
- tHAL_NFC_CBACK* p_stack_cback; /* Callback for HAL event notification */
- tHAL_NFC_DATA_CBACK* p_data_cback; /* Callback for data event notification */
-
- TIMER_LIST_Q quick_timer_queue; /* timer list queue */
- TIMER_LIST_ENT timer; /* timer for NCI transport task */
-
- tNFC_HAL_NCIT_CB ncit_cb; /* NCI transport */
- tNFC_HAL_DEV_CB dev_cb; /* device initialization */
- tNFC_HAL_NVM nvm_cb; /* Information about current patch in NVM */
-
- /* Patchram control block */
- tNFC_HAL_PRM_CB prm;
- tNFC_HAL_PRM_I2C_FIX_CB prm_i2c;
-
-#if (NFC_HAL_HCI_INCLUDED == TRUE)
- /* data members for NFC_HAL-HCI */
- tNFC_HAL_HCI_CB hci_cb;
-#endif
-
- uint8_t pre_discover_done; /* TRUE, when the prediscover config is complete */
- tNFC_HAL_FLAGS hal_flags;
- uint8_t pre_set_mem_idx;
-
- uint8_t max_rf_credits; /* NFC Max RF data credits */
- uint8_t max_ee; /* NFC Max number of NFCEE supported by NFCC */
-} tNFC_HAL_CB;
-
-/* Global NCI data */
-extern tNFC_HAL_CB nfc_hal_cb;
-
-extern uint8_t* p_nfc_hal_pre_discover_cfg;
-
-/****************************************************************************
-** Internal nfc functions
-****************************************************************************/
-
-#if (NFC_HAL_HCI_INCLUDED == TRUE)
-/* nfc_hal_hci.c */
-void nfc_hal_hci_enable(void);
-void nfc_hal_hci_evt_hdlr(tNFC_HAL_HCI_EVENT_DATA* p_evt_data);
-
-void nfc_hal_hci_handle_build_info(uint8_t chipverlen, uint8_t* p_chipverstr);
-#else
-#define nfc_hal_hci_enable() NFC_HAL_SET_INIT_STATE(NFC_HAL_INIT_STATE_IDLE);
-#define nfc_hal_hci_handle_build_info(p, a)
-#define nfc_hal_hci_evt_hdlr(p) ;
-#endif
-
-#endif /* NFC_HAL_INT_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_int_api.h b/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_int_api.h
deleted file mode 100755
index 42caf03..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_int_api.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * Internal NFC HAL API functions.
- *
- ******************************************************************************/
-#ifndef NFC_HAL_INT_API_H
-#define NFC_HAL_INT_API_H
-
-/****************************************************************************
-** Device Configuration definitions
-****************************************************************************/
-
-/* Broadcom specific device initialization before sending NCI reset */
-
-typedef struct {
- uint32_t brcm_hw_id;
- uint16_t xtal_freq;
- uint8_t xtal_index;
-} tNFC_HAL_DEV_INIT_XTAL_CFG;
-
-#define NFC_HAL_DEV_INIT_MAX_XTAL_CFG 5
-
-/*****************************************************************************
-** Patch RAM Constants
-*****************************************************************************/
-
-/* patch format type */
-typedef uint8_t tNFC_HAL_PRM_FORMAT;
-
-/*****************************************************************************
-** Patch RAM Callback for event notification
-*****************************************************************************/
-
-typedef uint8_t tNFC_HAL_NCI_EVT; /* MT + Opcode */
-
-/*******************************************************************************
-**
-** Function HAL_NfcPrmSetSpdNciCmdPayloadSize
-**
-** Description Set Host-to-NFCC NCI message size for secure patch download
-**
-** This API must be called before calling
-** HAL_NfcPrmDownloadStart. If the API is not called, then PRM
-** will use the default message size.
-**
-** Typically, this API is only called for platforms that have
-** message-size limitations in the transport/driver.
-**
-** Valid message size range:
-** NFC_HAL_PRM_MIN_NCI_CMD_PAYLOAD_SIZE to 255.
-**
-** Returns HAL_NFC_STATUS_OK if successful
-** HAL_NFC_STATUS_FAILED otherwise
-**
-**
-*******************************************************************************/
-tHAL_NFC_STATUS HAL_NfcPrmSetSpdNciCmdPayloadSize(uint8_t max_payload_size);
-
-#endif /* NFC_HAL_INT_API_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_nv_ci.h b/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_nv_ci.h
deleted file mode 100755
index a9ec13d..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_nv_ci.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2003-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 is the interface file for non valtile memory call-in functions.
- *
- ******************************************************************************/
-#ifndef NFC_HAL_NV_CI_H
-#define NFC_HAL_NV_CI_H
-
-#include "nfc_hal_target.h"
-
-#if (NFC_HAL_HCI_INCLUDED == TRUE)
-
-#include "nfc_hal_nv_co.h"
-
-/*****************************************************************************
-** Function Declarations
-*****************************************************************************/
-
-#endif /* NFC_HAL_HCI_INCLUDED */
-
-#endif /* NFC_HAL_NV_CI_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_nv_co.h b/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_nv_co.h
deleted file mode 100755
index 7fffb65..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_nv_co.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2003-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 is the interface file for storing nv data
- *
- ******************************************************************************/
-#ifndef NFC_HAL_NV_CO_H
-#define NFC_HAL_NV_CO_H
-
-#include "nfc_hal_target.h"
-
-#if (NFC_HAL_HCI_INCLUDED == TRUE)
-
-#include <time.h>
-
-/*****************************************************************************
-** Constants and Data Types
-*****************************************************************************/
-
-/**************************
-** Common Definitions
-***************************/
-
-typedef uint8_t tNFC_HAL_NV_CO_STATUS;
-
-#define DH_NV_BLOCK 0x01
-#define HC_F3_NV_BLOCK 0x02
-#define HC_F4_NV_BLOCK 0x03
-#define HC_F2_NV_BLOCK 0x04
-#define HC_F5_NV_BLOCK 0x05
-
-/*****************************************************************************
-** Function Declarations
-*****************************************************************************/
-/**************************
-** Common Functions
-***************************/
-
-#endif /* NFC_HAL_HCI_INCLUDED */
-#endif /* NFC_HAL_NV_CO_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_post_reset.h b/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_post_reset.h
deleted file mode 100755
index cc703a1..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_post_reset.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * Post NCI reset routines
- *
- ******************************************************************************/
-#ifndef NFC_HAL_POST_RESET_H
-#define NFC_HAL_POST_RESET_H
-
-/*****************************************************************************
-** Application control block definitions
-******************************************************************************/
-#define NFA_APP_PATCHFILE_MAX_PATH 255
-
-typedef struct {
- uint8_t prm_file[NFA_APP_PATCHFILE_MAX_PATH + 1]; /* Filename of patchram */
- uint8_t* p_prm_buf; /* Pointer to buffer for holding patchram data */
-
- /* Patchfile for I2C fix */
- uint8_t prm_i2c_patchfile[NFA_APP_PATCHFILE_MAX_PATH + 1];
- uint8_t* p_prm_i2c_buf;
-
- uint8_t userial_baud;
-
- tNFC_HAL_DEV_INIT_CFG dev_init_config;
-
- /* snooze mode setting */
- uint8_t snooze_mode;
- uint8_t idle_threshold_dh;
- uint8_t idle_threshold_nfcc;
- uint8_t nfc_wake_active_mode;
- uint8_t dh_wake_active_mode;
-
- /* NVM detection retry (some platforms require re-attempts to detect NVM) */
- uint8_t spd_nvm_detection_max_count; /* max retry to get NVM type */
- uint8_t spd_nvm_detection_cur_count; /* current retry count */
-
- /* handling for failure to download patch */
- bool spd_debug_mode; /* debug mode for downloading patchram, report failure
- immediately and obviously */
- bool spd_skip_on_power_cycle; /* skip downloading patchram after power cycle
- because of patch download failure */
-} tNFC_POST_RESET_CB;
-extern tNFC_POST_RESET_CB nfc_post_reset_cb;
-
-#endif /* NFC_HAL_POST_RESET_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_target.h b/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_target.h
deleted file mode 100755
index 38b2fb3..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nfc_hal_target.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2012-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.
- *
- ******************************************************************************/
-
-#ifndef NFC_HAL_TARGET_H
-#define NFC_HAL_TARGET_H
-
-#include "data_types.h"
-#include "gki.h"
-
-/****************************************************************************
-** NCI related configuration
-****************************************************************************/
-
-/* Initial Max Control Packet Payload Size (until receiving payload size in
- * INIT_CORE_RSP) */
-#ifndef NFC_HAL_NCI_INIT_CTRL_PAYLOAD_SIZE
-#define NFC_HAL_NCI_INIT_CTRL_PAYLOAD_SIZE 0xFF
-#endif
-
-/* Number of bytes to reserve in front of NCI messages (e.g. for transport
- * header) */
-#ifndef NFC_HAL_NCI_MSG_OFFSET_SIZE
-#define NFC_HAL_NCI_MSG_OFFSET_SIZE 1
-#endif
-
-/* NFC-WAKE */
-#ifndef NFC_HAL_LP_NFC_WAKE_GPIO
-#define NFC_HAL_LP_NFC_WAKE_GPIO UPIO_GENERAL3
-#endif
-
-/* NFCC snooze mode idle timeout before deassert NFC_WAKE in ms */
-#ifndef NFC_HAL_LP_IDLE_TIMEOUT
-#define NFC_HAL_LP_IDLE_TIMEOUT 100
-#endif
-
-/* NFC snooze mode */
-#ifndef NFC_HAL_LP_SNOOZE_MODE
-#define NFC_HAL_LP_SNOOZE_MODE NFC_HAL_LP_SNOOZE_MODE_UART
-#endif
-
-/* Idle Threshold Host in 100ms unit */
-#ifndef NFC_HAL_LP_IDLE_THRESHOLD_HOST
-#define NFC_HAL_LP_IDLE_THRESHOLD_HOST 0
-#endif
-
-/* Idle Threshold HC in 100ms unit */
-#ifndef NFC_HAL_LP_IDLE_THRESHOLD_HC
-#define NFC_HAL_LP_IDLE_THRESHOLD_HC 0
-#endif
-
-/* Default NFCC power-up baud rate */
-#ifndef NFC_HAL_DEFAULT_BAUD
-#define NFC_HAL_DEFAULT_BAUD USERIAL_BAUD_115200
-#endif
-
-/* time (in ms) between power off and on NFCC */
-#ifndef NFC_HAL_POWER_CYCLE_DELAY
-#define NFC_HAL_POWER_CYCLE_DELAY 100
-#endif
-
-/* time (in ms) between power off and on NFCC */
-#ifndef NFC_HAL_NFCC_ENABLE_TIMEOUT
-#define NFC_HAL_NFCC_ENABLE_TIMEOUT 1000
-#endif
-
-#ifndef NFC_HAL_PRM_DEBUG
-#define NFC_HAL_PRM_DEBUG TRUE
-#endif
-
-/* max patch data length (Can be overridden by platform for ACL HCI command
- * size) */
-#ifndef NFC_HAL_PRM_HCD_CMD_MAXLEN
-#define NFC_HAL_PRM_HCD_CMD_MAXLEN 250
-#endif
-
-/* Require PreI2C patch by default */
-#ifndef NFC_HAL_PRE_I2C_PATCH_INCLUDED
-#define NFC_HAL_PRE_I2C_PATCH_INCLUDED TRUE
-#endif
-
-/* over-riden for platforms that have transport packet limitations */
-#ifndef NFC_HAL_PRM_MIN_NCI_CMD_PAYLOAD_SIZE
-#define NFC_HAL_PRM_MIN_NCI_CMD_PAYLOAD_SIZE (32)
-#endif
-
-/* amount of time to wait for authenticating/committing patch to NVM */
-#ifndef NFC_HAL_PRM_COMMIT_DELAY
-#define NFC_HAL_PRM_COMMIT_DELAY (30000)
-#endif
-
-/* amount of time to wait after downloading preI2C patch before downloading
- * LPM/FPM patch */
-#ifndef NFC_HAL_PRM_POST_I2C_FIX_DELAY
-#define NFC_HAL_PRM_POST_I2C_FIX_DELAY (200)
-#endif
-
-/* NFCC will respond to more than one technology during listen discovery */
-#ifndef NFC_HAL_DM_MULTI_TECH_RESP
-#define NFC_HAL_DM_MULTI_TECH_RESP TRUE
-#endif
-
-/* Data rate for 15693 command/response, it must be same as
- * RW_I93_FLAG_DATA_RATE in nfc_target.h */
-#define NFC_HAL_I93_FLAG_DATA_RATE_HIGH 0x02
-
-#ifndef NFC_HAL_I93_FLAG_DATA_RATE
-#define NFC_HAL_I93_FLAG_DATA_RATE NFC_HAL_I93_FLAG_DATA_RATE_HIGH
-#endif
-
-/* NFC HAL HCI */
-#ifndef NFC_HAL_HCI_INCLUDED
-#define NFC_HAL_HCI_INCLUDED TRUE
-#endif
-
-/* Quick Timer */
-#ifndef QUICK_TIMER_TICKS_PER_SEC
-#define QUICK_TIMER_TICKS_PER_SEC 100 /* 10ms timer */
-#endif
-
-#ifndef NFC_HAL_SHARED_TRANSPORT_ENABLED
-#define NFC_HAL_SHARED_TRANSPORT_ENABLED FALSE
-#endif
-
-/* Enable verbose tracing by default */
-#ifndef NFC_HAL_TRACE_VERBOSE
-#define NFC_HAL_TRACE_VERBOSE TRUE
-#endif
-
-#ifndef NFC_HAL_INITIAL_TRACE_LEVEL
-#define NFC_HAL_INITIAL_TRACE_LEVEL 5
-#endif
-
-/* Map NFC serial port to USERIAL_PORT_6 by default */
-#ifndef USERIAL_NFC_PORT
-#define USERIAL_NFC_PORT (USERIAL_PORT_6)
-#endif
-
-/* Restore NFCC baud rate to default on shutdown if baud rate was updated */
-#ifndef NFC_HAL_RESTORE_BAUD_ON_SHUTDOWN
-#define NFC_HAL_RESTORE_BAUD_ON_SHUTDOWN TRUE
-#endif
-
-/* Enable protocol tracing by default */
-#ifndef NFC_HAL_TRACE_PROTOCOL
-#define NFC_HAL_TRACE_PROTOCOL TRUE
-#endif
-
-#endif /* GKI_TARGET_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nfc_target.h b/libstpropnci/libstnfc-nci-headers/src/include/nfc_target.h
deleted file mode 100755
index 3579cc0..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nfc_target.h
+++ /dev/null
@@ -1,539 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-2012 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.
- *
- ******************************************************************************/
-
-#ifndef NFC_TARGET_H
-#define NFC_TARGET_H
-
-#include "data_types.h"
-
-#ifdef BUILDCFG
-#include "buildcfg.h"
-#endif
-
-/* Include common GKI definitions used by this platform */
-#include "bt_types.h" /* This must be defined AFTER buildcfg.h */
-#include "gki_target.h"
-
-#ifndef USERIAL_DEBUG
-#define USERIAL_DEBUG FALSE
-#endif
-
-/******************************************************************************
-**
-** GKI Mail Box and Timer
-**
-******************************************************************************/
-
-/* Mailbox event mask for NFC stack */
-#ifndef NFC_MBOX_EVT_MASK
-#define NFC_MBOX_EVT_MASK (TASK_MBOX_0_EVT_MASK)
-#endif
-
-/* Mailbox ID for NFC stack */
-#ifndef NFC_MBOX_ID
-#define NFC_MBOX_ID (TASK_MBOX_0)
-#endif
-
-/* Mailbox event mask for NFA */
-#ifndef NFA_MBOX_EVT_MASK
-#define NFA_MBOX_EVT_MASK (TASK_MBOX_2_EVT_MASK)
-#endif
-
-/* Mailbox ID for NFA */
-#ifndef NFA_MBOX_ID
-#define NFA_MBOX_ID (TASK_MBOX_2)
-#endif
-
-/* GKI timer id used for protocol timer in NFC stack */
-#ifndef NFC_TIMER_ID
-#define NFC_TIMER_ID (TIMER_0)
-#endif
-
-/* GKI timer event mask used for protocol timer in NFC stack */
-#ifndef NFC_TIMER_EVT_MASK
-#define NFC_TIMER_EVT_MASK (TIMER_0_EVT_MASK)
-#endif
-
-/* GKI timer id used for quick timer in NFC stack */
-#ifndef NFC_QUICK_TIMER_ID
-#define NFC_QUICK_TIMER_ID (TIMER_1)
-#endif
-
-/* GKI timer event mask used for quick timer in NFC stack */
-#ifndef NFC_QUICK_TIMER_EVT_MASK
-#define NFC_QUICK_TIMER_EVT_MASK (TIMER_1_EVT_MASK)
-#endif
-
-/* GKI timer id used for protocol timer in NFA */
-#ifndef NFA_TIMER_ID
-#define NFA_TIMER_ID (TIMER_2)
-#endif
-
-/* GKI timer event mask used for protocol timer in NFA */
-#ifndef NFA_TIMER_EVT_MASK
-#define NFA_TIMER_EVT_MASK (TIMER_2_EVT_MASK)
-#endif
-
-/******************************************************************************
-**
-** GKI Buffer Pools
-**
-******************************************************************************/
-
-/* NCI command/notification/data */
-#ifndef NFC_NCI_POOL_ID
-#define NFC_NCI_POOL_ID GKI_POOL_ID_2
-#endif
-
-#ifndef NFC_NCI_POOL_BUF_SIZE
-#define NFC_NCI_POOL_BUF_SIZE GKI_BUF2_SIZE
-#endif
-
-/* Reader/Write commands (NCI data payload) */
-#ifndef NFC_RW_POOL_ID
-#define NFC_RW_POOL_ID GKI_POOL_ID_2
-#endif
-
-#ifndef NFC_RW_POOL_BUF_SIZE
-#define NFC_RW_POOL_BUF_SIZE GKI_BUF2_SIZE
-#endif
-
-/* Card Emulation responses (NCI data payload) */
-#ifndef NFC_CE_POOL_ID
-#define NFC_CE_POOL_ID GKI_POOL_ID_2
-#endif
-
-#ifndef NFC_CE_POOL_BUF_SIZE
-#define NFC_CE_POOL_BUF_SIZE GKI_BUF2_SIZE
-#endif
-
-/* NCI msg pool for HAL (for shared NFC/HAL GKI)*/
-#ifndef NFC_HAL_NCI_POOL_ID
-#define NFC_HAL_NCI_POOL_ID NFC_NCI_POOL_ID
-#endif
-
-#ifndef NFC_HAL_NCI_POOL_BUF_SIZE
-#define NFC_HAL_NCI_POOL_BUF_SIZE NFC_NCI_POOL_BUF_SIZE
-#endif
-
-/******************************************************************************
-**
-** NCI Transport definitions
-**
-******************************************************************************/
-/* offset of the first NCI packet in buffer for outgoing */
-#ifndef NCI_MSG_OFFSET_SIZE
-#define NCI_MSG_OFFSET_SIZE 1
-#endif
-
-/* Restore NFCC baud rate to default on shutdown if NFC_UpdateBaudRate was
- * called */
-#ifndef NFC_RESTORE_BAUD_ON_SHUTDOWN
-#define NFC_RESTORE_BAUD_ON_SHUTDOWN TRUE
-#endif
-
-/******************************************************************************
-**
-** NCI
-**
-******************************************************************************/
-#define NCI_VERSION_UNKNOWN 0x00
-#define NCI_VERSION_1_0 0x10
-#define NCI_VERSION_2_0 0x20
-#ifndef NCI_VERSION
-#define NCI_VERSION NCI_VERSION_2_0
-#endif
-#define NCI_CORE_RESET_RSP_LEN(X) (((X) >= NCI_VERSION_2_0) ? (0x01) : (0x03))
-
-/* TRUE I2C patch is needed */
-#ifndef NFC_I2C_PATCH_INCLUDED
-#define NFC_I2C_PATCH_INCLUDED TRUE /* NFC-Android uses this!!! */
-#endif
-
-/******************************************************************************
-**
-** NFC
-**
-******************************************************************************/
-
-/* Define to TRUE to include Broadcom Vendor Specific implementation */
-#ifndef NFC_BRCM_VS_INCLUDED
-#define NFC_BRCM_VS_INCLUDED TRUE
-#endif
-
-/* Define to TRUE if compling for NFC Reader/Writer Only mode */
-#ifndef NFC_RW_ONLY
-#define NFC_RW_ONLY FALSE
-#endif
-
-/* Timeout for receiving response to NCI command */
-#ifndef NFC_CMD_CMPL_TIMEOUT
-#define NFC_CMD_CMPL_TIMEOUT 2
-#endif
-
-/* Timeout for waiting on data credit/NFC-DEP */
-#ifndef NFC_DEACTIVATE_TIMEOUT
-#define NFC_DEACTIVATE_TIMEOUT 2
-#endif
-
-/* the maximum number of Vendor Specific callback functions allowed to be
- * registered. 1-14 */
-#ifndef NFC_NUM_VS_CBACKS
-#define NFC_NUM_VS_CBACKS 3
-#endif
-
-/* the maximum number of NCI connections allowed. 1-14 */
-#ifndef NCI_MAX_CONN_CBS
-#define NCI_MAX_CONN_CBS 4
-#endif
-
-/* the maximum number of NCI connections allowed. 1-14 */
-#ifndef NCI_MAX_STATIC_CONN_CBS
-#define NCI_MAX_STATIC_CONN_CBS 2
-#endif
-
-/* Maximum number of NCI commands that the NFCC accepts without needing to wait
- * for response */
-#ifndef NCI_MAX_CMD_WINDOW
-#define NCI_MAX_CMD_WINDOW 1
-#endif
-
-/* Define to TRUE to include the NFCEE related functionalities */
-#ifndef NFC_NFCEE_INCLUDED
-#define NFC_NFCEE_INCLUDED TRUE
-#endif
-
-/* the maximum number of NFCEE interface supported */
-#ifndef NFC_MAX_EE_INTERFACE
-#define NFC_MAX_EE_INTERFACE 3
-#endif
-
-/* the maximum number of NFCEE information supported. */
-#ifndef NFC_MAX_EE_INFO
-#define NFC_MAX_EE_INFO 8
-#endif
-
-/* the maximum number of NFCEE TLVs supported */
-#ifndef NFC_MAX_EE_TLVS
-#define NFC_MAX_EE_TLVS 1
-#endif
-
-/* the maximum size of NFCEE TLV list supported */
-#ifndef NFC_MAX_EE_TLV_SIZE
-#define NFC_MAX_EE_TLV_SIZE 150
-#endif
-
-/* Maximum time to discover NFCEE */
-#ifndef NFA_EE_DISCV_TIMEOUT_VAL
-#define NFA_EE_DISCV_TIMEOUT_VAL 2000
-#endif
-
-/* Number of times reader/writer should attempt to resend a command on failure
- */
-#ifndef RW_MAX_RETRIES
-#define RW_MAX_RETRIES 5
-#endif
-
-/* RW NDEF Support */
-#ifndef RW_NDEF_INCLUDED
-#define RW_NDEF_INCLUDED TRUE
-#endif
-
-/* RW Type 1 Tag timeout for each API call, in ms */
-#ifndef RW_T1T_TOUT_RESP
-#define RW_T1T_TOUT_RESP 100
-#endif
-
-/* CE Type 2 Tag timeout for controller command, in ms */
-#ifndef CE_T2T_TOUT_RESP
-#define CE_T2T_TOUT_RESP 1000
-#endif
-
-/* RW Type 2 Tag timeout for each API call, in ms */
-#ifndef RW_T2T_TOUT_RESP
-/* Android requires 150 instead of 100 for presence-check*/
-#define RW_T2T_TOUT_RESP 150
-#endif
-
-/* RW Type 2 Tag timeout for each API call, in ms */
-#ifndef RW_T2T_SEC_SEL_TOUT_RESP
-#define RW_T2T_SEC_SEL_TOUT_RESP 10
-#endif
-
-/* RW Type 3 Tag timeout for each API call, in ms */
-#ifndef RW_T3T_TOUT_RESP
-/* NFC-Android will use 100 instead of 75 for T3t presence-check */
-#define RW_T3T_TOUT_RESP 100
-#endif
-
-/* CE Type 3 Tag maximum response timeout index (for check and update, used in
- * SENSF_RES) */
-#ifndef CE_T3T_MRTI_C
-#define CE_T3T_MRTI_C 0xFF
-#endif
-#ifndef CE_T3T_MRTI_U
-#define CE_T3T_MRTI_U 0xFF
-#endif
-
-/* Default maxblocks for CE_T3T UPDATE/CHECK operations */
-#ifndef CE_T3T_DEFAULT_UPDATE_MAXBLOCKS
-#define CE_T3T_DEFAULT_UPDATE_MAXBLOCKS 3
-#endif
-
-#ifndef CE_T3T_DEFAULT_CHECK_MAXBLOCKS
-#define CE_T3T_DEFAULT_CHECK_MAXBLOCKS 3
-#endif
-
-/* CE Type 4 Tag, Frame Waiting time Integer */
-#ifndef CE_T4T_ISO_DEP_FWI
-#define CE_T4T_ISO_DEP_FWI 0x70
-#endif
-#ifndef RW_CI_TOUT_RESP
-#define RW_CI_TOUT_RESP 1000
-#endif
-
-/* RW Type 4 Tag timeout for each API call, in ms */
-#ifndef RW_T4T_TOUT_RESP
-#define RW_T4T_TOUT_RESP 1000
-#endif
-
-/* CE Type 4 Tag timeout for update file, in ms */
-#ifndef CE_T4T_TOUT_UPDATE
-#define CE_T4T_TOUT_UPDATE 1000
-#endif
-
-/* CE Type 4 Tag, mandatory NDEF File ID */
-#ifndef CE_T4T_MANDATORY_NDEF_FILE_ID
-#define CE_T4T_MANDATORY_NDEF_FILE_ID 0x1000
-#endif
-
-/* CE Type 4 Tag, max number of AID supported */
-#ifndef CE_T4T_MAX_REG_AID
-#define CE_T4T_MAX_REG_AID 4
-#endif
-
-/* Sub carrier */
-#ifndef RW_I93_FLAG_SUB_CARRIER
-#define RW_I93_FLAG_SUB_CARRIER I93_FLAG_SUB_CARRIER_SINGLE
-#endif
-
-/* Data rate for 15693 command/response */
-#ifndef RW_I93_FLAG_DATA_RATE
-#define RW_I93_FLAG_DATA_RATE I93_FLAG_DATA_RATE_HIGH
-#endif
-
-/* RW Mifare Classic Tag timeout for each API call, in ms */
-#ifndef RW_MFC_TOUT_RESP
-#define RW_MFC_TOUT_RESP 300
-#endif
-
-/* TRUE, to include Card Emulation related test commands */
-#ifndef CE_TEST_INCLUDED
-#define CE_TEST_INCLUDED FALSE
-#endif
-
-/* Quick Timer */
-#ifndef QUICK_TIMER_TICKS_PER_SEC
-#define QUICK_TIMER_TICKS_PER_SEC 100 /* 10ms timer */
-#endif
-
-/******************************************************************************
-**
-** NFA
-**
-******************************************************************************/
-
-/* Maximum Idle time (no hcp) to wait for EE DISC REQ Ntf(s) */
-#ifndef NFA_HCI_NETWK_INIT_IDLE_TIMEOUT
-#define NFA_HCI_NETWK_INIT_IDLE_TIMEOUT 1000
-#endif
-
-#ifndef NFA_HCI_MAX_HOST_IN_NETWORK
-#define NFA_HCI_MAX_HOST_IN_NETWORK 0x06
-#endif
-
-/* Max number of Application that can be registered to NFA-HCI */
-#ifndef NFA_HCI_MAX_APP_CB
-#define NFA_HCI_MAX_APP_CB 0x05
-#endif
-
-/* Max number of HCI gates that can be created */
-#ifndef NFA_HCI_MAX_GATE_CB
-#define NFA_HCI_MAX_GATE_CB 0x06
-#endif
-
-/* Max number of HCI pipes that can be created for the whole system */
-#ifndef NFA_HCI_MAX_PIPE_CB
-#define NFA_HCI_MAX_PIPE_CB 0x0A
-#endif
-
-/* Timeout for waiting for the response to HCP Command packet */
-#ifndef NFA_HCI_RESPONSE_TIMEOUT
-#define NFA_HCI_RESPONSE_TIMEOUT 1000
-#endif
-
-/* Default poll duration (may be over-ridden using NFA_SetRfDiscoveryDuration)
- */
-#ifndef NFA_DM_DISC_DURATION_POLL
-#define NFA_DM_DISC_DURATION_POLL 500 /* Android requires 500 */
-#endif
-
-/* Automatic NDEF detection (when not in exclusive RF mode) */
-#ifndef NFA_DM_AUTO_DETECT_NDEF
-#define NFA_DM_AUTO_DETECT_NDEF FALSE /* !!!!! NFC-Android needs FALSE */
-#endif
-
-/* Automatic NDEF read (when not in exclusive RF mode) */
-#ifndef NFA_DM_AUTO_READ_NDEF
-#define NFA_DM_AUTO_READ_NDEF FALSE /* !!!!! NFC-Android needs FALSE */
-#endif
-
-/* Automatic NDEF presence check (when not in exclusive RF mode) */
-#ifndef NFA_DM_AUTO_PRESENCE_CHECK
-#define NFA_DM_AUTO_PRESENCE_CHECK FALSE /* Android requires FALSE */
-#endif
-
-/* Presence check option: 0x01: use sleep/wake for none-NDEF ISO-DEP tags */
-#ifndef NFA_DM_PRESENCE_CHECK_OPTION
-/* !!!!! Android needs value 3 */
-#define NFA_DM_PRESENCE_CHECK_OPTION 0x03
-#endif
-
-/* Maximum time to wait for presence check response */
-#ifndef NFA_DM_MAX_PRESENCE_CHECK_TIMEOUT
-#define NFA_DM_MAX_PRESENCE_CHECK_TIMEOUT 500
-#endif
-
-/* Default delay to auto presence check after sending raw frame */
-#ifndef NFA_DM_DEFAULT_PRESENCE_CHECK_START_DELAY
-#define NFA_DM_DEFAULT_PRESENCE_CHECK_START_DELAY 750
-#endif
-
-/* Timeout for reactivation of Kovio bar code tag (presence check) */
-#ifndef NFA_DM_DISC_TIMEOUT_KOVIO_PRESENCE_CHECK
-#define NFA_DM_DISC_TIMEOUT_KOVIO_PRESENCE_CHECK (1000)
-#endif
-
-/* timeout for waiting deactivation NTF,
-** possible delay to send deactivate CMD if all credit wasn't returned
-** transport delay (1sec) and max RWT (5sec)
-*/
-#define NFA_DM_DISC_TIMEOUT_W4_DEACT_NTF (NFC_DEACTIVATE_TIMEOUT * 1000 + 6000)
-
-#ifdef ST21NFC
-#ifndef NFA_DM_DISC_TIMEOUT_MIFARE_IDLE_PRESENCE_CHECK
-#define NFA_DM_DISC_TIMEOUT_MIFARE_IDLE_PRESENCE_CHECK (200)
-#endif
-#endif
-
-/* Max number of NDEF type handlers that can be registered (including the
- * default handler) */
-#ifndef NFA_NDEF_MAX_HANDLERS
-#define NFA_NDEF_MAX_HANDLERS 8
-#endif
-
-/* Maximum number of listen entries configured/registered with
- * NFA_CeConfigureUiccListenTech, */
-/* NFA_CeRegisterFelicaSystemCodeOnDH, or NFA_CeRegisterT4tAidOnDH */
-#ifndef NFA_CE_LISTEN_INFO_MAX
-#define NFA_CE_LISTEN_INFO_MAX 5
-#endif
-
-#ifndef NFA_SNEP_INCLUDED
-/* Android must use FALSE to exclude SNEP */
-#define NFA_SNEP_INCLUDED FALSE
-#endif
-
-/* Max acceptable length */
-#ifndef NFA_SNEP_DEFAULT_SERVER_MAX_NDEF_SIZE
-#define NFA_SNEP_DEFAULT_SERVER_MAX_NDEF_SIZE 500000
-#endif
-
-/* Max number of SNEP server/client and data link connection */
-#ifndef NFA_SNEP_MAX_CONN
-#define NFA_SNEP_MAX_CONN 6
-#endif
-
-/* Max number data link connection of SNEP default server*/
-#ifndef NFA_SNEP_DEFAULT_MAX_CONN
-#define NFA_SNEP_DEFAULT_MAX_CONN 3
-#endif
-
-/* MIU for SNEP */
-#ifndef NFA_SNEP_MIU
-#define NFA_SNEP_MIU 1980 /* Modified for NFC-A */
-#endif
-
-/* Receiving Window for SNEP */
-#ifndef NFA_SNEP_RW
-#define NFA_SNEP_RW 2 /* Modified for NFC-A */
-#endif
-
-/* Max number of NFCEE supported */
-#ifndef NFA_EE_MAX_EE_SUPPORTED
-/* Modified for NFC-A until we add dynamic support */
-#define NB_MEP_CONFIG 2
-#define NFA_EE_MAX_EE_SUPPORTED (5 + NB_MEP_CONFIG)
-#endif
-
-/* Maximum number of AID entries per target_handle */
-#ifndef NFA_EE_MAX_AID_ENTRIES
-#define NFA_EE_MAX_AID_ENTRIES (32)
-#endif
-
-/* Maximum number of callback functions can be registered through
- * NFA_EeRegister() */
-#ifndef NFA_EE_MAX_CBACKS
-#define NFA_EE_MAX_CBACKS (3)
-#endif
-
-#ifndef NFA_DTA_INCLUDED
-#define NFA_DTA_INCLUDED TRUE
-#endif
-
-/*****************************************************************************
-** Define HAL_WRITE depending on whether HAL is using shared GKI resources
-** as the NFC stack.
-*****************************************************************************/
-#ifndef HAL_WRITE
-#define HAL_WRITE(p) \
- { \
- nfc_cb.p_hal->write((p)->len, (uint8_t*)((p) + 1) + (p)->offset); \
- GKI_freebuf(p); \
- }
-
-#ifdef NFC_HAL_SHARED_GKI
-
-/* NFC HAL Included if NFC_NFCEE_INCLUDED */
-#if (NFC_NFCEE_INCLUDED == TRUE)
-
-#ifndef NFC_HAL_HCI_INCLUDED
-#define NFC_HAL_HCI_INCLUDED TRUE
-#endif
-#else /* NFC_NFCEE_INCLUDED == TRUE */
-#ifndef NFC_HAL_HCI_INCLUDED
-#define NFC_HAL_HCI_INCLUDED FALSE
-#endif
-
-#endif /* NFC_NFCEE_INCLUDED == FALSE */
-
-#endif /* NFC_HAL_SHARED_GKI */
-
-#endif /* HAL_WRITE */
-
-#endif /* NFC_TARGET_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/nfc_types.h b/libstpropnci/libstnfc-nci-headers/src/include/nfc_types.h
deleted file mode 100755
index 5e3c4b3..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/nfc_types.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2012-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.
- *
- ******************************************************************************/
-
-#ifndef NFC_TYPES_H
-#define NFC_TYPES_H
-
-/****************************************************************************
-** NFC_HDR header definition for NFC messages
-*****************************************************************************/
-typedef struct {
- uint16_t event;
- uint16_t len;
- uint16_t offset;
- uint16_t layer_specific;
-} NFC_HDR;
-#define NFC_HDR_SIZE (sizeof(NFC_HDR))
-
-/* Mask for NFC_HDR event field */
-#define NFC_EVT_MASK 0xFF00
-
-/****************************************************************************
-** NFC_HAL_TASK definitions
-*****************************************************************************/
-
-/* NCI message for hci persistency data */
-#define NFC_HAL_EVT_HCI 0x0400
-
-/* NCI message for sending to host stack */
-#define NFC_EVT_TO_NFC_NCI 0x4000
-
-/*****************************************************************************
-** Macros to get and put bytes to and from a stream (Little Endian format).
-*****************************************************************************/
-
-#define UINT32_TO_STREAM(p, u32) \
- { \
- *(p)++ = (uint8_t)(u32); \
- *(p)++ = (uint8_t)((u32) >> 8); \
- *(p)++ = (uint8_t)((u32) >> 16); \
- *(p)++ = (uint8_t)((u32) >> 24); \
- }
-#define UINT16_TO_STREAM(p, u16) \
- { \
- *(p)++ = (uint8_t)(u16); \
- *(p)++ = (uint8_t)((u16) >> 8); \
- }
-#define UINT8_TO_STREAM(p, u8) \
- { \
- *(p)++ = (uint8_t)(u8); \
- }
-#define INT8_TO_STREAM(p, u8) \
- { \
- *(p)++ = (int8_t)(u8); \
- }
-#define ARRAY8_TO_STREAM(p, a) \
- { \
- int ijk; \
- for (ijk = 0; ijk < 8; ijk++) *(p)++ = (uint8_t)(a)[7 - ijk]; \
- }
-#define ARRAY_TO_STREAM(p, a, len) \
- { \
- int ijk; \
- for (ijk = 0; ijk < (len); ijk++) *(p)++ = (uint8_t)(a)[ijk]; \
- }
-#define STREAM_TO_UINT8(u8, p) \
- { \
- (u8) = (uint8_t)(*(p)); \
- (p) += 1; \
- }
-#define STREAM_TO_UINT16(u16, p) \
- { \
- (u16) = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); \
- (p) += 2; \
- }
-#define STREAM_TO_UINT32(u32, p) \
- { \
- (u32) = (((uint32_t)(*(p))) + ((((uint32_t)(*((p) + 1)))) << 8) + \
- ((((uint32_t)(*((p) + 2)))) << 16) + \
- ((((uint32_t)(*((p) + 3)))) << 24)); \
- (p) += 4; \
- }
-#define STREAM_TO_ARRAY8(a, p) \
- { \
- int ijk; \
- uint8_t* _pa = (uint8_t*)(a) + 7; \
- for (ijk = 0; ijk < 8; ijk++) *_pa-- = *(p)++; \
- }
-#define STREAM_TO_ARRAY(a, p, len) \
- { \
- int ijk; \
- for (ijk = 0; ijk < (len); ijk++) ((uint8_t*)(a))[ijk] = *(p)++; \
- }
-
-/*****************************************************************************
-** Macros to get and put bytes to and from a stream (Big Endian format)
-*****************************************************************************/
-
-#define UINT32_TO_BE_STREAM(p, u32) \
- { \
- *(p)++ = (uint8_t)((u32) >> 24); \
- *(p)++ = (uint8_t)((u32) >> 16); \
- *(p)++ = (uint8_t)((u32) >> 8); \
- *(p)++ = (uint8_t)(u32); \
- }
-#define UINT24_TO_BE_STREAM(p, u24) \
- { \
- *(p)++ = (uint8_t)((u24) >> 16); \
- *(p)++ = (uint8_t)((u24) >> 8); \
- *(p)++ = (uint8_t)(u24); \
- }
-#define UINT16_TO_BE_STREAM(p, u16) \
- { \
- *(p)++ = (uint8_t)((u16) >> 8); \
- *(p)++ = (uint8_t)(u16); \
- }
-#define UINT8_TO_BE_STREAM(p, u8) \
- { \
- *(p)++ = (uint8_t)(u8); \
- }
-#define ARRAY_TO_BE_STREAM(p, a, len) \
- { \
- int ijk; \
- for (ijk = 0; ijk < (len); ijk++) *(p)++ = (uint8_t)(a)[ijk]; \
- }
-
-#define BE_STREAM_TO_UINT8(u8, p) \
- { \
- (u8) = (uint8_t)(*(p)); \
- (p) += 1; \
- }
-#define BE_STREAM_TO_UINT16(u16, p) \
- { \
- (u16) = (uint16_t)(((uint16_t)(*(p)) << 8) + (uint16_t)(*((p) + 1))); \
- (p) += 2; \
- }
-#define BE_STREAM_TO_UINT32(u32, p) \
- { \
- (u32) = ((uint32_t)(*((p) + 3)) + ((uint32_t)(*((p) + 2)) << 8) + \
- ((uint32_t)(*((p) + 1)) << 16) + ((uint32_t)(*(p)) << 24)); \
- (p) += 4; \
- }
-
-/*****************************************************************************
-** Macros to get and put bytes to and from a field (Big Endian format).
-** These are the same as to stream, except the pointer is not incremented.
-*****************************************************************************/
-
-#define UINT8_TO_BE_FIELD(p, u8) \
- { \
- *(uint8_t*)(p) = (uint8_t)(u8); \
- }
-
-#endif /* NFC_TYPES_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/include/vendor_cfg.h b/libstpropnci/libstnfc-nci-headers/src/include/vendor_cfg.h
deleted file mode 100755
index 2ba9722..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/include/vendor_cfg.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-/******************************************************************************
- *
- * This file contains compile-time configurable constants for vendor specific
- *proprietary protocols
- *
- ******************************************************************************/
-#ifndef __NFC_VENDOR_CFG_H__
-#define __NFC_VENDOR_CFG_H__
-
-/* compile-time configuration structure for proprietary protocol and discovery
- * value */
-typedef struct {
- uint8_t pro_protocol_18092_active;
- uint8_t pro_protocol_b_prime;
- uint8_t pro_protocol_dual;
- uint8_t pro_protocol_15693;
- uint8_t pro_protocol_kovio;
- uint8_t pro_protocol_mfc;
-
- uint8_t pro_discovery_kovio_poll;
- uint8_t pro_discovery_b_prime_poll;
- uint8_t pro_discovery_b_prime_listen;
- uint8_t pro_protocol_chinese_id;
-} tNFA_PROPRIETARY_CFG;
-
-extern tNFA_PROPRIETARY_CFG* p_nfa_proprietary_cfg;
-
-/**********************************************
- * Proprietary Protocols
- **********************************************/
-#ifndef NCI_PROTOCOL_18092_ACTIVE
-#define NCI_PROTOCOL_18092_ACTIVE \
- (p_nfa_proprietary_cfg->pro_protocol_18092_active)
-#endif
-#ifndef NCI_PROTOCOL_B_PRIME
-#define NCI_PROTOCOL_B_PRIME (p_nfa_proprietary_cfg->pro_protocol_b_prime)
-#endif
-#ifndef NCI_PROTOCOL_DUAL
-#define NCI_PROTOCOL_DUAL (p_nfa_proprietary_cfg->pro_protocol_dual)
-#endif
-#ifndef NCI_PROTOCOL_15693
-#define NCI_PROTOCOL_15693 (p_nfa_proprietary_cfg->pro_protocol_15693)
-#endif
-#ifndef NCI_PROTOCOL_KOVIO
-#define NCI_PROTOCOL_KOVIO (p_nfa_proprietary_cfg->pro_protocol_kovio)
-#endif
-#ifndef NCI_PROTOCOL_MIFARE
-#define NCI_PROTOCOL_MIFARE (p_nfa_proprietary_cfg->pro_protocol_mfc)
-#endif
-#ifndef NCI_PROTOCOL_CI
-#define NCI_PROTOCOL_CI (p_nfa_proprietary_cfg->pro_protocol_chinese_id)
-#endif
-
-/**********************************************
- * Proprietary Discovery technology and mode
- **********************************************/
-#ifndef NCI_DISCOVERY_TYPE_POLL_KOVIO
-#define NCI_DISCOVERY_TYPE_POLL_KOVIO \
- (p_nfa_proprietary_cfg->pro_discovery_kovio_poll)
-#endif
-
-#ifndef NCI_DISCOVERY_TYPE_POLL_B_PRIME
-#define NCI_DISCOVERY_TYPE_POLL_B_PRIME \
- (p_nfa_proprietary_cfg->pro_discovery_b_prime_poll)
-#endif
-
-#ifndef NCI_DISCOVERY_TYPE_LISTEN_B_PRIME
-#define NCI_DISCOVERY_TYPE_LISTEN_B_PRIME \
- (p_nfa_proprietary_cfg->pro_discovery_b_prime_listen)
-#endif
-
-#endif /* __NFC_VENDOR_CFG_H__ */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_api.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_api.h
deleted file mode 100755
index 4be62ad..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_api.h
+++ /dev/null
@@ -1,1438 +0,0 @@
-/******************************************************************************
- *
- * 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 is the public interface file for NFA, Broadcom's NFC application
- * layer for mobile phones.
- *
- ******************************************************************************/
-#ifndef NFA_API_H
-#define NFA_API_H
-
-#include "gki.h"
-#include "nci_defs.h"
-#include "nfc_api.h"
-#include "nfc_hal_api.h"
-#include "nfc_target.h"
-#include "rw_api.h"
-#include "tags_defs.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-/* Max length of Appliction ID in 7816-4 */
-#define NFA_MAX_AID_LEN NFC_MAX_AID_LEN
-#define NFA_MIN_AID_LEN 5 /* per NCI specification */
-
-/* Command succeeded */
-#define NFA_STATUS_OK NCI_STATUS_OK
-/* Command is rejected. */
-#define NFA_STATUS_REJECTED NCI_STATUS_REJECTED
-/* buffer full */
-#define NFA_STATUS_BUFFER_FULL NCI_STATUS_BUFFER_FULL
-/* failed */
-#define NFA_STATUS_FAILED NCI_STATUS_FAILED
-/* Optional feature of NCI Spec not supported */
-#define NFA_STATUS_NOT_SUPPORTED NCI_STATUS_NOT_SUPPORTED
-/* Semantic error */
-#define NFA_STATUS_SEMANTIC_ERROR NCI_STATUS_SEMANTIC_ERROR
-/* Unknown NCI Group ID */
-#define NFA_STATUS_UNKNOWN_GID NCI_STATUS_UNKNOWN_GID
-/* Invalid Parameter */
-#define NFA_STATUS_INVALID_PARAM NCI_STATUS_INVALID_PARAM
-/* Already started */
-#define NFA_STATUS_ALREADY_STARTED NCI_STATUS_ALREADY_STARTED
-#define NFA_STATUS_RF_UNEXPECTED_DATA NCI_STATUS_RF_UNEXPECTED_DATA
-/* RF frame error */
-#define NFA_STATUS_RF_FRAME_CORRUPTED NCI_STATUS_RF_FRAME_CORRUPTED
-/* RF protocol error */
-#define NFA_STATUS_RF_PROTOCOL_ERR NCI_STATUS_RF_PROTOCOL_ERR
-/* RF Timeout */
-#define NFA_STATUS_TIMEOUT NCI_STATUS_TIMEOUT
-
-#define NFA_STATUS_CONTINUE NFC_STATUS_CONTINUE
-/* Out of GKI buffers */
-#define NFA_STATUS_NO_BUFFERS NFC_STATUS_NO_BUFFERS
-/* Protocol mismatch between API and activated one */
-#define NFA_STATUS_WRONG_PROTOCOL NFC_STATUS_WRONG_PROTOCOL
-/* Another Tag command is already in progress */
-#define NFA_STATUS_BUSY NFC_STATUS_BUSY
-
-/* data len exceeds MIU */
-#define NFA_STATUS_BAD_LENGTH NFC_STATUS_BAD_LENGTH
-/* invalid handle */
-#define NFA_STATUS_BAD_HANDLE NFC_STATUS_BAD_HANDLE
-/* congested */
-#define NFA_STATUS_CONGESTED NFC_STATUS_CONGESTED
-typedef uint8_t tNFA_STATUS;
-
-/* Handle for NFA registrations and connections */
-typedef uint16_t tNFA_HANDLE;
-#define NFA_HANDLE_INVALID (0xFFFF)
-/* NFA Handle definitions */
-
-/* The upper byte of NFA_HANDLE signifies the handle group */
-/* NDEF Type Handler handles */
-#define NFA_HANDLE_GROUP_NDEF_HANDLER 0x0200
-/* DH Card Emulation handles */
-#define NFA_HANDLE_GROUP_CE 0x0300
-/* Handles to identify NFCEE */
-#define NFA_HANDLE_GROUP_EE 0x0400
-/* HCI handles */
-#define NFA_HANDLE_GROUP_HCI 0x0800
-/* Local NDEF message handle */
-#define NFA_HANDLE_GROUP_MASK 0xFF00
-#define NFA_HANDLE_MASK 0x00FF
-
-/* NCI Parameter IDs */
-typedef uint8_t tNFA_PMID;
-
-/* Definitions for tNFA_TECHNOLOGY_MASK */
-#define NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
-#define NFA_TECHNOLOGY_MASK_B 0x02 /* NFC Technology B */
-#define NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
-/* TECHNOLOGY_MASK_V in NCI2.0 and TECHNOLOGY_MASK_15693 proprietary in NCI1.0*/
-#define NFA_TECHNOLOGY_MASK_V 0x08
-#define NFA_TECHNOLOGY_MASK_B_PRIME 0x10 /* Proprietary Technology */
-#define NFA_TECHNOLOGY_MASK_KOVIO 0x20 /* Proprietary Technology */
-/* NFC technology NFC-DEP protocol active mode */
-#define NFA_TECHNOLOGY_MASK_ACTIVE 0x40
-/* NFC Technology A active mode */
-#define NFA_TECHNOLOGY_MASK_A_ACTIVE 0x40
-/* NFC Technology F active mode */
-#define NFA_TECHNOLOGY_MASK_F_ACTIVE 0x80
-/* All supported technologies */
-typedef uint8_t tNFA_TECHNOLOGY_MASK;
-
-/* Definitions for NFC protocol for RW, CE and P2P APIs */
-/* Type1Tag - NFC-A */
-#define NFA_PROTOCOL_T1T NFC_PROTOCOL_T1T
-/* MIFARE/Type2Tag - NFC-A */
-#define NFA_PROTOCOL_T2T NFC_PROTOCOL_T2T
-/* Felica/Type3Tag - NFC-F */
-#define NFA_PROTOCOL_T3T NFC_PROTOCOL_T3T
-/* Type 4A,4B - NFC-A or NFC-B */
-#define NFA_PROTOCOL_ISO_DEP NFC_PROTOCOL_ISO_DEP
-/* NFCDEP/LLCP - NFC-A or NFC-F */
-#define NFA_PROTOCOL_NFC_DEP NFC_PROTOCOL_NFC_DEP
-/* NFC_PROTOCOL_T5T in NCI2.0 and NFC_PROTOCOL_ISO15693 proprietary in NCI1.0*/
-#define NFA_PROTOCOL_T5T NFC_PROTOCOL_T5T
-#define NFA_PROTOCOL_CI NFC_PROTOCOL_CI
-#define NFA_PROTOCOL_INVALID 0xFF
-typedef uint8_t tNFA_NFC_PROTOCOL;
-
-/* Definitions for tNFA_PROTOCOL_MASK */
-#define NFA_PROTOCOL_MASK_T1T 0x01 /* Type 1 tag */
-#define NFA_PROTOCOL_MASK_T2T 0x02 /* MIFARE / Type 2 tag */
-#define NFA_PROTOCOL_MASK_T3T 0x04 /* FeliCa / Type 3 tag */
-#define NFA_PROTOCOL_MASK_ISO_DEP 0x08 /* ISODEP/4A,4B */
-typedef uint8_t tNFA_PROTOCOL_MASK;
-
-/* NFA_DM callback events */
-/* Result of NFA_Enable */
-#define NFA_DM_ENABLE_EVT 0
-/* Result of NFA_Disable */
-#define NFA_DM_DISABLE_EVT 1
-/* Result of NFA_SetConfig */
-#define NFA_DM_SET_CONFIG_EVT 2
-/* Result of NFA_GetConfig */
-#define NFA_DM_GET_CONFIG_EVT 3
-/* Result of NFA_PowerOffSleepMode */
-#define NFA_DM_PWR_MODE_CHANGE_EVT 4
-#define NFA_DM_RF_FIELD_EVT 5 /* Status of RF Field */
-/* NFCC is not responding */
-#define NFA_DM_NFCC_TIMEOUT_EVT 6
-/* NCI Tranport error */
-#define NFA_DM_NFCC_TRANSPORT_ERR_EVT 7
-/* Result of NFA_SetPowerSubStateForScreenState */
-#define NFA_DM_SET_POWER_SUB_STATE_EVT 11
-/* T1T HR length */
-#define NFA_T1T_HR_LEN T1T_HR_LEN
-/* Max UID length of T1/T2 */
-#define NFA_MAX_UID_LEN TAG_MAX_UID_LEN
-/* UID len for T1T cmds */
-#define NFA_T1T_CMD_UID_LEN T1T_CMD_UID_LEN
-/* T2T UID length */
-
-/* Tag formatted for NDEF */
-#define NFA_RW_NDEF_FL_FORMATED RW_NDEF_FL_FORMATED
-/* NDEF supported by the tag */
-#define NFA_RW_NDEF_FL_SUPPORTED RW_NDEF_FL_SUPPORTED
-/* Unable to find if tag is ndef capable/formatted/read only */
-#define NFA_RW_NDEF_FL_UNKNOWN RW_NDEF_FL_UNKNOWN
-/* Tag supports format operation */
-#define NFA_RW_NDEF_FL_FORMATABLE RW_NDEF_FL_FORMATABLE
-
-typedef uint8_t tNFA_RW_NDEF_FLAG;
-
-/* Data for NFA_DM_SET_CONFIG_EVT */
-typedef struct {
- tNFA_STATUS status; /* NFA_STATUS_OK if successful */
- uint8_t num_param_id; /* Number of rejected Param ID */
- tNFA_PMID param_ids[NFC_MAX_NUM_IDS]; /* Rejected Param ID */
-} tNFA_SET_CONFIG;
-
-/* Data for NFA_DM_GET_CONFIG_EVT */
-typedef struct {
- tNFA_STATUS status; /* NFA_STATUS_OK if successful */
- uint16_t tlv_size; /* The length of TLV */
- uint8_t* param_tlvs; /* TLV (Parameter ID-Len-Value byte stream) */
-} tNFA_GET_CONFIG;
-
-/* Structure to store screen state */
-typedef enum screen_state {
- NFA_SCREEN_STATE_UNKNOWN = 0x00,
- NFA_SCREEN_STATE_OFF_UNLOCKED = 0x01,
- NFA_SCREEN_STATE_OFF_LOCKED = 0x02,
- NFA_SCREEN_STATE_ON_LOCKED = 0x04,
- NFA_SCREEN_STATE_ON_UNLOCKED = 0x08
-} eScreenState_t;
-
-typedef enum power_substate {
- SCREEN_STATE_ON_UNLOCKED = 0x00,
- SCREEN_STATE_OFF_UNLOCKED,
- SCREEN_STATE_ON_LOCKED,
- SCREEN_STATE_OFF_LOCKED,
- SCREEN_STATE_INVALID = 0xFF
-} epower_substate_t;
-
-#define NFA_SCREEN_STATE_MASK 0x0F
-
-/* CONN_DISCOVER_PARAM */
-#define NFA_DM_PWR_MODE_FULL 0x04
-#define NFA_DM_PWR_MODE_OFF_SLEEP 0x00
-
-typedef uint8_t tNFA_DM_PWR_MODE;
-
-/* Data for NFA_DM_PWR_MODE_CHANGE_EVT */
-typedef struct {
- tNFA_STATUS status; /* NFA_STATUS_OK if successful */
- /* NFA_DM_PWR_MODE_FULL or NFA_DM_PWR_MODE_OFF_SLEEP */
- tNFA_DM_PWR_MODE power_mode;
-} tNFA_DM_PWR_MODE_CHANGE;
-
-/* Data for NFA_DM_RF_FIELD_EVT */
-#define NFA_DM_RF_FIELD_OFF 0x00
-#define NFA_DM_RF_FIELD_ON 0x01
-
-typedef struct {
- tNFA_STATUS status; /* NFA_STATUS_OK if successful */
- /* NFA_DM_RF_FIELD_ON if operating field generated by remote */
- uint8_t rf_field_status;
-} tNFA_DM_RF_FIELD;
-
-typedef struct {
- tNFA_STATUS status; /* NFA_STATUS_OK if successful */
- uint8_t power_state; /* current screen/power state */
-} tNFA_DM_POWER_STATE;
-
-/* Union of all DM callback structures */
-typedef union {
- tNFA_STATUS status; /* NFA_DM_ENABLE_EVT */
- tNFA_SET_CONFIG set_config; /* NFA_DM_SET_CONFIG_EVT */
- tNFA_GET_CONFIG get_config; /* NFA_DM_GET_CONFIG_EVT */
- tNFA_DM_PWR_MODE_CHANGE power_mode; /* NFA_DM_PWR_MODE_CHANGE_EVT */
- tNFA_DM_RF_FIELD rf_field; /* NFA_DM_RF_FIELD_EVT */
- void* p_vs_evt_data; /* Vendor-specific evt data */
- tNFA_DM_POWER_STATE power_sub_state; /* power sub state */
-} tNFA_DM_CBACK_DATA;
-
-/* NFA_DM callback */
-typedef void(tNFA_DM_CBACK)(uint8_t event, tNFA_DM_CBACK_DATA* p_data);
-
-/* NFA Enable DTA Type Mode */
-typedef enum {
- NFA_DTA_APPL_MODE = 0x00000000,
- NFA_DTA_DEFAULT_MODE = 0x00000001,
- NFA_DTA_LLCP_MODE = 0x00000002,
- NFA_DTA_HCEF_MODE = 0x00000004,
- NFA_DTA_CR8 = 0x00000080,
-} tNFA_eDtaModes;
-
-/* NFA Connection Callback Events */
-#define NFA_POLL_ENABLED_EVT 0 /* Polling enabled event */
-#define NFA_POLL_DISABLED_EVT 1 /* Polling disabled event */
-/* NFC link/protocol discovery notification */
-#define NFA_DISC_RESULT_EVT 2
-/* NFC link/protocol discovery select response */
-#define NFA_SELECT_RESULT_EVT 3
-#define NFA_DEACTIVATE_FAIL_EVT 4 /* NFA_Deactivate failure */
-/* NFC link/protocol activated */
-#define NFA_ACTIVATED_EVT 5
-/* NFC link/protocol deactivated */
-#define NFA_DEACTIVATED_EVT 6
-#define NFA_TLV_DETECT_EVT 7 /* TLV Detection complete */
-/* NDEF Detection complete */
-#define NFA_NDEF_DETECT_EVT 8
-#define NFA_DATA_EVT 9 /* Data message received */
-#define NFA_SELECT_CPLT_EVT 10 /* Select completed */
-#define NFA_READ_CPLT_EVT 11 /* Read completed */
-#define NFA_WRITE_CPLT_EVT 12 /* Write completed */
-/* Response to NFA_RwPresenceCheck */
-#define NFA_PRESENCE_CHECK_EVT 15
-/* Tag Formatting completed */
-#define NFA_FORMAT_CPLT_EVT 16
-/* ISO 15693 command completed */
-#define NFA_I93_CMD_CPLT_EVT 17
-#define NFA_SET_TAG_RO_EVT 18 /* Tag set as Read only */
-/* Result for NFA_RequestExclusiveRfControl */
-#define NFA_EXCLUSIVE_RF_CONTROL_STARTED_EVT 19
-/* Result for NFA_ReleaseExclusiveRfControl */
-#define NFA_EXCLUSIVE_RF_CONTROL_STOPPED_EVT 20
-/* DH Card emulation: AID or System code reg'd */
-#define NFA_CE_REGISTERED_EVT 21
-/* DH Card emulation: AID or System code dereg'd */
-#define NFA_CE_DEREGISTERED_EVT 22
-/* DH Card emulation: data received event */
-#define NFA_CE_DATA_EVT 23
-/* DH Card emulation: activation event */
-#define NFA_CE_ACTIVATED_EVT 24
-/* DH Card emulation: deactivation event */
-#define NFA_CE_DEACTIVATED_EVT 25
-/* DH Card emulation: local NDEF configured */
-#define NFA_CE_LOCAL_TAG_CONFIGURED_EVT 26
-/* DH Card emulation: NDEF write started */
-#define NFA_CE_NDEF_WRITE_START_EVT 27
-/* DH Card emulation: NDEF write completed */
-#define NFA_CE_NDEF_WRITE_CPLT_EVT 28
-#define NFA_CE_UICC_LISTEN_CONFIGURED_EVT 29 /* UICC Listen configured */
-/* RF Discovery started event */
-#define NFA_RF_DISCOVERY_STARTED_EVT 30
-/* RF Discovery stopped event */
-#define NFA_RF_DISCOVERY_STOPPED_EVT 31
-/* status of updating RF communication parameters */
-#define NFA_UPDATE_RF_PARAM_RESULT_EVT 32
-/* RF Interface error event */
-#define NFA_RW_INTF_ERROR_EVT 34
-/* Listening enabled event */
-#define NFA_LISTEN_ENABLED_EVT 36
-/* Listening disabled event */
-#define NFA_LISTEN_DISABLED_EVT 37
-/* T2T command completed */
-#define NFA_T2T_CMD_CPLT_EVT 40
-/* EP removal detection response */
-#define NFA_DETECT_REMOVAL_STARTED_EVT 51
-/* EP removal detection notification */
-#define NFA_DETECT_REMOVAL_RESULT_EVT 52
-/* RF Interface Extension result event */
-#define NFA_RF_INTF_EXT_RESULT_EVT 43
-
-/* NFC deactivation type */
-#define NFA_DEACTIVATE_TYPE_IDLE NFC_DEACTIVATE_TYPE_IDLE
-#define NFA_DEACTIVATE_TYPE_SLEEP NFC_DEACTIVATE_TYPE_SLEEP
-#define NFA_DEACTIVATE_TYPE_DISCOVERY NFC_DEACTIVATE_TYPE_DISCOVERY
-
-typedef uint8_t tNFA_DEACTIVATE_TYPE;
-
-/* Data for NFA_DISC_RESULT_EVT */
-typedef struct {
- tNFA_STATUS status; /* NFA_STATUS_OK if successful */
- tNFC_RESULT_DEVT discovery_ntf; /* RF discovery notification details */
-} tNFA_DISC_RESULT;
-
-/* Data for NFA_ACTIVATED_EVT */
-typedef struct {
- uint8_t hr[NFA_T1T_HR_LEN]; /* HR of Type 1 tag */
- uint8_t uid[NFA_T1T_CMD_UID_LEN]; /* UID used in T1T Commands */
-} tNFA_T1T_PARAMS;
-
-typedef struct {
- uint8_t uid[NFA_MAX_UID_LEN]; /* UID of T2T tag */
-} tNFA_T2T_PARAMS;
-
-typedef struct {
- uint8_t num_system_codes; /* Number of system codes supporte by tag */
- uint16_t* p_system_codes; /* Pointer to list of system codes */
-} tNFA_T3T_PARAMS;
-
-typedef struct {
- uint8_t uid[I93_UID_BYTE_LEN]; /* UID[0]:MSB, ... UID[7]:LSB */
- uint8_t info_flags; /* information flags */
- uint8_t dsfid; /* DSFID if I93_INFO_FLAG_DSFID */
- uint8_t afi; /* AFI if I93_INFO_FLAG_AFI */
- uint16_t num_block; /* number of blocks if I93_INFO_FLAG_MEM_SIZE */
- uint8_t block_size; /* block size in byte if I93_INFO_FLAG_MEM_SIZE */
- uint8_t IC_reference; /* IC Reference if I93_INFO_FLAG_IC_REF */
-} tNFA_I93_PARAMS;
-
-typedef struct {
- uint8_t mbi;
- uint8_t uid[8]; /* UID of Chinese Id Card */
-} tNFA_CI_PARAMS;
-typedef union {
- tNFA_T1T_PARAMS t1t; /* HR and UID of T1T */
- tNFA_T2T_PARAMS t2t; /* UID of T2T */
- tNFA_T3T_PARAMS t3t; /* System codes */
- tNFA_I93_PARAMS i93; /* System Information of ISO 15693 */
- tNFA_CI_PARAMS ci;
-} tNFA_TAG_PARAMS;
-
-typedef struct {
- tNFC_ACTIVATE_DEVT activate_ntf; /* RF discovery activation details */
- tNFA_TAG_PARAMS params; /* additional information of tag */
-} tNFA_ACTIVATED;
-
-/* Data for NFA_DEACTIVATED_EVT */
-typedef struct {
- /* NFA_DEACTIVATE_TYPE_IDLE or NFA_DEACTIVATE_TYPE_SLEEP */
- tNFA_DEACTIVATE_TYPE type;
-} tNFA_DEACTIVATED;
-
-/* Structure for NFA_NDEF_DETECT_EVT event data */
-typedef struct {
- tNFA_STATUS status; /* Status of the ndef detection */
- tNFA_NFC_PROTOCOL protocol; /* protocol used to detect NDEF */
- uint32_t max_size; /* max number of bytes available for NDEF data */
- uint32_t cur_size; /* current size of stored NDEF data (in bytes) */
- /* Flags to indicate NDEF capability, is formatted, soft/hard lockable,
- * formatable, otp and read only */
- tNFA_RW_NDEF_FLAG flags;
-} tNFA_NDEF_DETECT;
-
-/* Structure for NFA_TLV_DETECT_EVT event data */
-typedef struct {
- tNFA_STATUS status; /* Status of the tlv detection */
- tNFA_NFC_PROTOCOL protocol; /* protocol used to detect TLV */
- uint8_t num_tlvs; /* number of tlvs present in the tag */
- uint8_t num_bytes; /* number of lock/reserved bytes */
-} tNFA_TLV_DETECT;
-
-/* Structure for NFA_DATA_EVT data */
-typedef struct {
- tNFA_STATUS status; /* Status of Data received */
- uint8_t* p_data; /* Data buffer */
- uint16_t len; /* Length of data */
-} tNFA_RX_DATA;
-
-/* Structure for NFA_CE_NDEF_WRITE_CPLT_EVT data */
-typedef struct {
- tNFA_STATUS status; /* Status of the ndef write op */
- uint32_t len; /* Update length of NDEF data */
- uint8_t* p_data; /* data buffer */
-} tNFA_CE_NDEF_WRITE_CPLT;
-
-/* Data for NFA_I93_CMD_CPLT_EVT */
-typedef struct {
- uint8_t dsfid; /* DSFID */
- uint8_t uid[I93_UID_BYTE_LEN]; /* UID[0]:MSB, ... UID[7]:LSB */
-} tNFA_I93_INVENTORY;
-
-typedef struct /* RW_I93_SYS_INFO_EVT */
-{
- uint8_t info_flags; /* information flags */
- uint8_t uid[I93_UID_BYTE_LEN]; /* UID */
- uint8_t dsfid; /* DSFID if I93_INFO_FLAG_DSFID */
- uint8_t afi; /* AFI if I93_INFO_FLAG_AFI */
- uint16_t num_block; /* number of blocks if I93_INFO_FLAG_MEM_SIZE */
- uint8_t block_size; /* block size in byte if I93_INFO_FLAG_MEM_SIZE */
- uint8_t IC_reference; /* IC Reference if I93_INFO_FLAG_IC_REF */
-} tNFA_I93_SYS_INFO;
-
-typedef struct {
- tNFA_STATUS status; /* Status of sending command */
- uint8_t sent_command; /* sent command to tag */
- union {
- uint8_t error_code; /* error code defined in ISO 15693 */
- tNFA_I93_INVENTORY inventory; /* inventory response */
- tNFA_I93_SYS_INFO sys_info; /* system information */
- } params;
-} tNFA_I93_CMD_CPLT;
-
-/* Data for NFA_CE_REGISTERED_EVT */
-typedef struct {
- tNFA_STATUS status; /* NFA_STATUS_OK if successful */
- tNFA_HANDLE handle; /* handle for NFA_CeRegisterFelicaSystemCodeOnDH () */
- /* NFA_CeRegisterT4tAidOnDH () */
-} tNFA_CE_REGISTERED;
-
-/* Data for NFA_CE_DEREGISTERED_EVT */
-typedef struct {
- tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT */
-} tNFA_CE_DEREGISTERED;
-
-/* Data for NFA_CE_ACTIVATED_EVT */
-typedef struct {
- tNFA_STATUS status; /* NFA_STATUS_OK if successful */
- tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT */
- tNFC_ACTIVATE_DEVT activate_ntf; /* RF discovery activation details */
-} tNFA_CE_ACTIVATED;
-
-/* Data for NFA_CE_DEACTIVATED_EVT */
-typedef struct {
- tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT */
- /* NFA_DEACTIVATE_TYPE_IDLE or NFA_DEACTIVATE_TYPE_SLEEP */
- tNFA_DEACTIVATE_TYPE type;
-} tNFA_CE_DEACTIVATED;
-
-/* Structure for NFA_CE_DATA_EVT data */
-typedef struct {
- tNFA_STATUS status; /* NFA_STATUS_OK if complete packet */
- tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT */
- uint8_t* p_data; /* Data buffer */
- uint16_t len; /* Length of data */
-} tNFA_CE_DATA;
-
-/* Structure for NFA_EP_REMOVAL_DETECTION_EVT data */
-typedef struct {
- uint8_t reason; /* Reason from RF_DEACTIVATE_NTF */
-} tNFA_EP_REMOVED;
-
-/* Union of all connection callback structures */
-typedef union {
- tNFA_STATUS status; /* NFA_POLL_ENABLED_EVT */
- tNFA_DISC_RESULT disc_result; /* NFA_DISC_RESULT_EVT */
- tNFA_ACTIVATED activated; /* NFA_ACTIVATED_EVT */
- tNFA_DEACTIVATED deactivated; /* NFA_DEACTIVATED_EVT */
- tNFA_NDEF_DETECT ndef_detect; /* NFA_NDEF_DETECT_EVT */
- tNFA_TLV_DETECT tlv_detect; /* NFA_TLV_DETECT_EVT */
- tNFA_RX_DATA data; /* NFA_DATA_EVT */
- tNFA_CE_NDEF_WRITE_CPLT ndef_write_cplt; /* NFA_CE_NDEF_WRITE_CPLT_EVT */
- tNFA_I93_CMD_CPLT i93_cmd_cplt; /* NFA_I93_CMD_CPLT_EVT */
- tNFA_CE_REGISTERED ce_registered; /* NFA_CE_REGISTERED_EVT */
- tNFA_CE_DEREGISTERED ce_deregistered; /* NFA_CE_DEREGISTERED_EVT */
- tNFA_CE_ACTIVATED ce_activated; /* NFA_CE_ACTIVATED_EVT */
- tNFA_CE_DEACTIVATED ce_deactivated; /* NFA_CE_DEACTIVATED_EVT */
- tNFA_CE_DATA ce_data; /* NFA_CE_DATA_EVT */
- tNFA_EP_REMOVED removal_detect; /* NFA_EP_REMOVAL_DETECTION_EVT */
-
-} tNFA_CONN_EVT_DATA;
-
-/* NFA Connection Callback */
-typedef void(tNFA_CONN_CBACK)(uint8_t event, tNFA_CONN_EVT_DATA* p_data);
-
-#ifndef NFA_DM_NUM_INTERFACE_MAP
-#define NFA_DM_NUM_INTERFACE_MAP 3
-#endif
-
-/* compile-time configuration structure for the RF Discovery Frequency for each
- * technology */
-typedef struct {
- uint8_t pa; /* Frequency for NFC Technology A */
- uint8_t pb; /* Frequency for NFC Technology B */
- uint8_t pf; /* Frequency for NFC Technology F */
- uint8_t pi93; /* Frequency for Proprietary Technology/15693 */
- uint8_t pbp; /* Frequency for Proprietary Technology/B-Prime */
- uint8_t pk; /* Frequency for Proprietary Technology/Kovio */
- uint8_t paa; /* Frequency for NFC Technology A active mode */
- uint8_t pfa; /* Frequency for NFC Technology F active mode */
- uint8_t pacm; /* Frequency for NFC Technology active mode */
-} tNFA_DM_DISC_FREQ_CFG;
-
-/* definitions for tNFA_DM_CFG.presence_check_option */
-/* if NDEF is not supported by the tag, use sleep/wake(last interface) */
-#define NFA_DM_PCO_ISO_SLEEP_WAKE 0x01
-/* NFA_SendRawFrame() has been used, use empty I block for presence check
- * if this bit is not set, use read-binary on channel 3 for presence check */
-#define NFA_DM_PCO_EMPTY_I_BLOCK 0x02
-
-/* compile-time configuration structure */
-typedef struct {
- /* Automatic NDEF detection (when not in exclusive RF mode) */
- bool auto_detect_ndef;
- /* Automatic NDEF read (when not in exclusive RF mode) */
- bool auto_read_ndef;
- /* Automatic presence check */
- bool auto_presence_check;
- /* Use sleep/wake(last interface) for ISODEP presence check */
- uint8_t presence_check_option;
- /* Maximum time to wait for presence check response */
- uint16_t presence_check_timeout;
- /* timeout for rf deactivate in rf listen active state */
- uint16_t deact_ntf_listen_active_timeout;
-} tNFA_DM_CFG;
-
-/* compile-time configuration structure for HCI */
-typedef struct {
- /* Maximum idle(no HCP Pkt) time to wait for EE DISC REQ Ntf(s) */
- uint16_t hci_netwk_enable_timeout;
- /* Maximum time to wait for EE DISC REQ NTF(s) after HOT PLUG EVT(s) */
- uint16_t hcp_response_timeout;
- /* Number of host in the allowlist of Terminal host */
- uint8_t num_allowlist_host;
- /* Allowlist of Terminal Host */
- uint8_t* p_allowlist;
-} tNFA_HCI_CFG;
-
-/*
-** Exclusive RF mode listen configuration
-*/
-
-#define NFA_LB_MAX_NFCID0_LEN 4
-#define NFA_LF_MAX_SC_NFCID2 1
-#define NFA_LA_MAX_HIST_BYTES 15
-#define NFA_LB_MAX_H_INFO_LEN 15
-
-typedef struct {
- /*
- ** Discovery Configuration Parameters for Listen A
- */
- bool la_enable; /* TRUE if listening A */
- uint8_t la_bit_frame_sdd; /* Bit Frame SDD in Byte 1 of SENS_RES */
- uint8_t la_platform_config; /* Platform Config in Byte 2 of SENS_RES */
- uint8_t la_sel_info; /* Byte of SEL_RES */
- uint8_t la_nfcid1_len; /* NFCID1 (0, 4, 7 or 10 bytes) */
- uint8_t la_nfcid1[NCI_NFCID1_MAX_LEN]; /* if empty, NFCC will decide */
-
- /*
- ** Discovery Configuration Parameters for Listen B
- */
- bool lb_enable; /* TRUE if listening B */
- uint8_t lb_sensb_info; /* Byte 2 of Protocol Info within SENSB_RES */
- uint8_t lb_nfcid0_len; /* NFCID0 (0, 1 or 4 bytes) */
- uint8_t
- lb_nfcid0[NFA_LB_MAX_NFCID0_LEN]; /* if empty, NFCC will decide */
- uint8_t lb_app_data[NCI_PARAM_LEN_LB_APPDATA]; /* Bytes 6 - 9 in SENSB_RES */
- uint8_t lb_sfgi; /* Start-Up Frame Guard Time */
- uint8_t lb_adc_fo; /* Byte 12 in SENSB_RES */
-
- /*
- ** Discovery Configuration Parameters for Listen F
- */
- bool lf_enable; /* TRUE if listening F */
- uint8_t lf_con_bitr_f; /* bit rate to listen */
- uint8_t lf_protocol_type; /* Supported Protocols */
- /* bit field indicating which lf_t3t_identifier are enabled */
- uint16_t lf_t3t_flags;
- uint8_t lf_t3t_identifier[NFA_LF_MAX_SC_NFCID2]
- [NCI_SYSTEMCODE_LEN + NCI_NFCID2_LEN];
- /* System Code and NFCID2 */
- uint8_t lf_t3t_pmm[NCI_T3T_PMM_LEN]; /* Bytes 10 - 17 in SENSF_RES */
-
- /*
- ** Discovery Configuration Parameters for Listen ISO-DEP
- */
- bool li_enable; /* TRUE if listening ISO-DEP */
- uint8_t li_fwi; /* Frame Waiting Time Integer */
- uint8_t la_hist_bytes_len; /* historical bytes for Listen-A */
- uint8_t la_hist_bytes[NFA_LA_MAX_HIST_BYTES];
- uint8_t lb_h_info_resp_len; /* higher layer response for Listen-B */
- uint8_t lb_h_info_resp[NFA_LB_MAX_H_INFO_LEN];
-
- /*
- ** Discovery Configuration Parameters for Listen NFC-DEP
- */
- bool ln_enable; /* TRUE if listening NFC-DEP */
- uint8_t ln_wt; /* Waiting Time Integer */
- uint8_t ln_atr_res_gen_bytes_len; /* General bytes in ATR_RES */
- uint8_t ln_atr_res_gen_bytes[NCI_MAX_GEN_BYTES_LEN];
- uint8_t ln_atr_res_config; /* Optional parameters (PPt) in ATR_RES */
-} tNFA_LISTEN_CFG;
-
-/* Data for NFA_UpdateRFCommParams () */
-typedef tNFC_RF_COMM_PARAMS tNFA_RF_COMM_PARAMS;
-
-/* RF Interface type */
-#define NFA_INTERFACE_FRAME NFC_INTERFACE_FRAME
-#define NFA_INTERFACE_ISO_DEP NFC_INTERFACE_ISO_DEP
-#define NFA_INTERFACE_MIFARE NFC_INTERFACE_MIFARE
-typedef tNFC_INTF_TYPE tNFA_INTF_TYPE;
-typedef tNFC_INTF_EXT_TYPE tNFA_INTF_EXT_TYPE;
-
-/*******************************************************************************
-** NDEF Definitions
-*******************************************************************************/
-
-/* Definitions for tNFA_TNF (NDEF type name format ID) */
-/* Empty or no type specified */
-#define NFA_TNF_EMPTY NDEF_TNF_EMPTY
-/* NFC Forum well-known type [NFC RTD] */
-#define NFA_TNF_WKT NDEF_TNF_WKT
-/* Media-type as defined in RFC 2046 [RFC 2046] */
-#define NFA_TNF_RFC2046_MEDIA NDEF_TNF_MEDIA
-/* Absolute URI as defined in RFC 3986 [RFC 3986] */
-#define NFA_TNF_RFC3986_URI NDEF_TNF_URI
-/* NFC Forum external type [NFC RTD] */
-#define NFA_TNF_EXTERNAL NDEF_TNF_EXT
-/* Unknown */
-#define NFA_TNF_UNKNOWN NDEF_TNF_UNKNOWN
-/* Unchanged */
-#define NFA_TNF_UNCHANGED NDEF_TNF_UNCHANGED
-/* Reserved */
-#define NFA_TNF_RESERVED NDEF_TNF_RESERVED
-/* Used to register default NDEF type handler */
-#define NFA_TNF_DEFAULT 0xFF
-typedef uint8_t tNFA_TNF;
-
-/* Definitions for tNFA_NDEF_URI_ID (Frequently used prefixes. For additional
- * values, see [NFC RTD URI] */
-#define NFA_NDEF_URI_ID_ABSOLUTE 0x00 /* Unabridged URI. */
-#define NFA_NDEF_URI_ID_HTTP 0x03 /* http:// */
-#define NFA_NDEF_URI_ID_HTTPS 0x04 /* https:// */
-#define NFA_NDEF_URI_ID_TEL 0x05 /* tel: */
-#define NFA_NDEF_URI_ID_MAILTO 0x06 /* mailto: */
-#define NFA_NDEF_URI_ID_FTP 0x0D /* ftp:// */
-#define NFA_NDEF_URI_ID_FILE 0x1D /* file:// */
-
-typedef uint8_t tNFA_NDEF_URI_ID;
-
-/* Events for tNFA_NDEF_CBACK */
-/* NDEF record type registered. (In response to NFA_RegisterNDefTypeHandler) */
-#define NFA_NDEF_REGISTER_EVT 0
-/* Received an NDEF message with the registered type. See [tNFA_NDEF_DATA] */
-#define NFA_NDEF_DATA_EVT 1
-typedef uint8_t tNFA_NDEF_EVT;
-
-/* Structure for NFA_NDEF_REGISTER_EVT event data */
-typedef struct {
- tNFA_STATUS status; /* Status of the registration */
- tNFA_HANDLE ndef_type_handle; /* Handle for this NDEF type registration. */
-} tNFA_NDEF_REGISTER;
-
-/* Structure for NFA_NDEF_DATA_EVT event data */
-typedef struct {
- tNFA_HANDLE ndef_type_handle; /* Handle for NDEF type registration. */
- uint8_t* p_data; /* Data buffer */
- uint32_t len; /* Length of data */
-} tNFA_NDEF_DATA;
-
-/* Union of all NDEF callback structures */
-typedef union {
- /* Structure for NFA_NDEF_REGISTER_EVT event data */
- tNFA_NDEF_REGISTER ndef_reg;
- /* Structure for NFA_NDEF_DATA_EVT event data */
- tNFA_NDEF_DATA ndef_data;
-} tNFA_NDEF_EVT_DATA;
-
-/* NFA_NDEF callback */
-typedef void(tNFA_NDEF_CBACK)(tNFA_NDEF_EVT event, tNFA_NDEF_EVT_DATA* p_data);
-
-/* NFA VSC Callback */
-typedef void(tNFA_VSC_CBACK)(uint8_t event, uint16_t param_len,
- uint8_t* p_param);
-/* Modes used by setNfcControllerAlwaysOn */
-#define ENABLE_MODE_DEFAULT 1
-#define ENABLE_MODE_TRANSPARENT 2
-#define ENABLE_MODE_EE 3
-
-/*****************************************************************************
-** External Function Declarations
-*****************************************************************************/
-/*******************************************************************************
-**
-** Function NFA_SetNfccMode
-**
-** Description This function sets the control blocks nfcc mode
-**
-** mode ENABLE_MODE_DEFAULT or ENABLE_MODE_TRANSPARENT
-** or ENABLE_MODE_EE
-**
-** Returns none
-**
-*******************************************************************************/
-extern void NFA_SetNfccMode(uint8_t mode);
-
-/*******************************************************************************
-**
-** Function NFA_Init
-**
-** Description This function initializes control blocks for NFA
-**
-** p_hal_entry_tbl points to a table of HAL entry points
-**
-** NOTE: the buffer that p_hal_entry_tbl points must be
-** persistent until NFA is disabled.
-**
-**
-** Returns none
-**
-*******************************************************************************/
-extern void NFA_Init(tHAL_NFC_ENTRY* p_hal_entry_tbl);
-
-/*******************************************************************************
-**
-** Function NFA_Partial_Init
-**
-** Description This function initializes control blocks for NFA based on
-** mode
-**
-** p_hal_entry_tbl points to a table of HAL entry points
-** mode ENABLE_MODE_DEFAULT or ENABLE_MODE_TRANSPARENT
-** or ENABLE_MODE_EE
-**
-** NOTE: the buffer that p_hal_entry_tbl points must be
-** persistent until NFA is disabled.
-**
-**
-** Returns none
-**
-*******************************************************************************/
-extern void NFA_Partial_Init(tHAL_NFC_ENTRY* p_hal_entry_tbl, uint8_t mode);
-
-/*******************************************************************************
-**
-** Function NFA_Enable
-**
-** Description This function enables NFC. Prior to calling NFA_Enable,
-** the NFCC must be powered up, and ready to receive commands.
-** This function enables the tasks needed by NFC, opens the NCI
-** transport, resets the NFC controller, downloads patches to
-** the NFCC (if necessary), and initializes the NFC subsystems.
-**
-** This function should only be called once - typically when
-** NFC is enabled during boot-up, or when NFC is enabled from a
-** settings UI. Subsequent calls to NFA_Enable while NFA is
-** enabling or enabled will be ignored. When the NFC startup
-** procedure is completed, an NFA_DM_ENABLE_EVT is returned to
-** the application using the tNFA_DM_CBACK.
-**
-** The tNFA_CONN_CBACK parameter is used to register a callback
-** for polling and card emulation events.
-**
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_Enable(tNFA_DM_CBACK* p_dm_cback,
- tNFA_CONN_CBACK* p_conn_cback);
-
-/*******************************************************************************
-**
-** Function NFA_Disable
-**
-** Description This function is called to shutdown NFC. The tasks for NFC
-** are terminated, and clean up routines are performed. This
-** function is typically called during platform shut-down, or
-** when NFC is disabled from a settings UI. When the NFC
-** shutdown procedure is completed, an NFA_DM_DISABLE_EVT is
-** returned to the application using the tNFA_DM_CBACK.
-**
-** The platform should wait until the NFC_DISABLE_REVT is
-** received before powering down the NFC chip and NCI
-** transport. This is required to so that NFA can gracefully
-** shut down any open connections.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_Disable(bool graceful);
-
-/*******************************************************************************
-**
-** Function NFA_SetConfig
-**
-** Description Set the configuration parameters to NFCC. The result is
-** reported with an NFA_DM_SET_CONFIG_EVT in the tNFA_DM_CBACK
-** callback.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function. Most Configuration
-** parameters are related to RF discovery.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_BUSY if previous setting is on-going
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_SetConfig(tNFA_PMID param_id, uint8_t length,
- uint8_t* p_data);
-
-/*******************************************************************************
-**
-** Function NFA_GetConfig
-**
-** Description Get the configuration parameters from NFCC. The result is
-** reported with an NFA_DM_GET_CONFIG_EVT in the tNFA_DM_CBACK
-** callback.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_GetConfig(uint8_t num_ids, tNFA_PMID* p_param_ids);
-
-/*******************************************************************************
-**
-** Function NFA_RequestExclusiveRfControl
-**
-** Description Request exclusive control of NFC.
-** - Previous behavior (polling/tag reading, DH card emulation)
-** will be suspended .
-** - Polling and listening will be done based on the specified
-** params
-**
-** The NFA_EXCLUSIVE_RF_CONTROL_STARTED_EVT event of
-** tNFA_CONN_CBACK indicates the status of the operation.
-**
-** NFA_ACTIVATED_EVT and NFA_DEACTIVATED_EVT indicates link
-** activation/deactivation.
-**
-** NFA_SendRawFrame is used to send data to the peer.
-** NFA_DATA_EVT indicates data from the peer.
-**
-** If a tag is activated, then the NFA_RW APIs may be used to
-** send commands to the tag. Incoming NDEF messages are sent to
-** the NDEF callback.
-**
-** Once exclusive RF control has started, NFA will not activate
-** LLCP internally. The application has exclusive control of
-** the link.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RequestExclusiveRfControl(tNFA_TECHNOLOGY_MASK poll_mask,
- tNFA_LISTEN_CFG* p_listen_cfg,
- tNFA_CONN_CBACK* p_conn_cback,
- tNFA_NDEF_CBACK* p_ndef_cback);
-
-/*******************************************************************************
-**
-** Function NFA_ReleaseExclusiveRfControl
-**
-** Description Release exclusive control of NFC. Once released, behavior
-** prior to obtaining exclusive RF control will resume.
-**
-Note??
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_ReleaseExclusiveRfControl(void);
-
-/*******************************************************************************
-**
-** Function NFA_EnablePolling
-**
-** Description Enable polling for technologies specified by poll_mask.
-**
-** The following events (notified using the connection
-** callback registered with NFA_Enable) are generated during
-** polling:
-**
-** - NFA_POLL_ENABLED_EVT indicates whether or not polling
-** successfully enabled.
-** - NFA_DISC_RESULT_EVT indicates there are more than one
-** devices, so application must select one of tags by calling
-** NFA_Select().
-** - NFA_SELECT_RESULT_EVT indicates whether previous selection
-** was successful or not. If it was failed then application
-** must select again or deactivate by calling
-** NFA_Deactivate().
-** - NFA_ACTIVATED_EVT is generated when an NFC link is
-** activated.
-** - NFA_NDEF_DETECT_EVT is generated if tag is activated
-** - NFA_DEACTIVATED_EVT will be returned after deactivating
-** NFC link.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EnablePolling(tNFA_TECHNOLOGY_MASK poll_mask);
-
-/*******************************************************************************
-**
-** Function NFA_DisablePolling
-**
-** Description Disable polling
-** NFA_POLL_DISABLED_EVT will be returned after stopping
-** polling.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_DisablePolling(void);
-
-/*******************************************************************************
-**
-** Function NFA_EnableListening
-**
-** Description Enable listening.
-** NFA_LISTEN_ENABLED_EVT will be returned after listening is
-** allowed.
-**
-** The actual listening technologies are specified by other NFA
-** API functions. Such functions include (but not limited to)
-** NFA_CeConfigureUiccListenTech.
-** If NFA_DisableListening () is called to ignore the listening
-** technologies, NFA_EnableListening () is called to restore
-** the listening technologies set by these functions.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EnableListening(void);
-
-/*******************************************************************************
-**
-** Function NFA_DisableListening
-**
-** Description Disable listening
-** NFA_LISTEN_DISABLED_EVT will be returned after stopping
-** listening. This function is called to exclude listen at RF
-** discovery.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_DisableListening(void);
-
-/*******************************************************************************
-**
-** Function NFA_StartRfDiscovery
-**
-** Description Start RF discovery
-** RF discovery parameters shall be set by other APIs.
-**
-** An NFA_RF_DISCOVERY_STARTED_EVT indicates whether starting
-** was successful or not.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_StartRfDiscovery(void);
-
-/*******************************************************************************
-**
-** Function NFA_StopRfDiscovery
-**
-** Description Stop RF discovery
-**
-** An NFA_RF_DISCOVERY_STOPPED_EVT indicates whether stopping
-** was successful or not.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_StopRfDiscovery(void);
-
-/*******************************************************************************
-**
-** Function NFA_SetRfDiscoveryDuration
-**
-** Description Set the duration of the single discovery period in [ms].
-** Allowable range: 0 ms to 0xFFFF ms.
-**
-** Note: If discovery is already started, the application should
-** call NFA_StopRfDiscovery prior to calling
-** NFA_SetRfDiscoveryDuration, and then call
-** NFA_StartRfDiscovery afterwards to restart discovery using
-** the new duration.
-**
-** Returns:
-** NFA_STATUS_OK, if command accepted
-** NFA_STATUS_FAILED: otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_SetRfDiscoveryDuration(uint16_t discovery_period_ms);
-
-/*******************************************************************************
-**
-** Function NFA_Select
-**
-** Description Select one from detected devices by NFA_DISC_RESULT_EVT
-** after the last discovery result is received.
-** An NFA_SELECT_RESULT_EVT indicates whether selection was
-** successful or not. If failed then application must select
-** again or deactivate by NFA_Deactivate ().
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_INVALID_PARAM if RF interface is not matched
-** protocol
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_Select(uint8_t rf_disc_id, tNFA_NFC_PROTOCOL protocol,
- tNFA_INTF_TYPE rf_interface);
-
-/*******************************************************************************
-**
-** Function NFA_UpdateRFCommParams
-**
-** Description This function is called to update RF Communication
-** parameters once the Frame RF Interface has been activated.
-**
-** An NFA_UPDATE_RF_PARAM_RESULT_EVT indicates whether updating
-** was successful or not.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_UpdateRFCommParams(tNFA_RF_COMM_PARAMS* p_params);
-
-/*******************************************************************************
-**
-** Function NFA_StartRemovalDetection
-**
-** Description Start the detection of RF endpoint removal when data
-*exchange
-** ore charging with listener completed.
-**
-** An NFA_DETECT_REMOVAL_RESULT_EVT indicates whether start
-** was successful or not.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-tNFA_STATUS NFA_StartRemovalDetection(uint8_t waiting_time_int);
-
-/*******************************************************************************
-**
-** Function NFA_Deactivate
-**
-** Description
-** If sleep_mode=TRUE:
-** Deselect the activated device by deactivating into sleep
-** mode.
-**
-** An NFA_DEACTIVATE_FAIL_EVT indicates that selection was
-** not successful. Application can select another
-** discovered device or deactivate by NFA_Deactivate ()
-** after receiving NFA_DEACTIVATED_EVT.
-**
-** Deactivating to sleep mode is not allowed when NFCC is
-** in wait-for-host-select mode, or in listen-sleep states;
-** NFA will deactivate to idle or discovery state for these
-** cases respectively.
-**
-**
-** If sleep_mode=FALSE:
-** Deactivate the connection (e.g. as a result of presence
-** check failure) NFA_DEACTIVATED_EVT will indicate that
-** link is deactivated. Polling/listening will resume
-** (unless the nfcc is in wait_for-all-discoveries state)
-**
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_Deactivate(bool sleep_mode);
-
-/*******************************************************************************
-**
-** Function NFA_SendRawFrame
-**
-** Description Send a raw frame over the activated interface with the NFCC.
-** This function can only be called after NFC link is
-** activated.
-**
-** If the activated interface is a tag and auto-presence check
-** is enabled then presence_check_start_delay can be used to
-** indicate the delay in msec after which the next auto
-** presence check command can be sent.
-** NFA_DM_DEFAULT_PRESENCE_CHECK_START_DELAY can be used as the
-** default value for the delay.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_SendRawFrame(uint8_t* p_raw_data, uint16_t data_len,
- uint16_t presence_check_start_delay);
-
-/*******************************************************************************
-** NDEF APIs
-*******************************************************************************/
-
-/*******************************************************************************
-**
-** Function NFA_RegisterNDefTypeHandler
-**
-** Description This function allows the applications to register for
-** specific types of NDEF records. When NDEF records are
-** received, NFA will parse the record-type field, and pass
-** the record to the registered tNFA_NDEF_CBACK.
-**
-** For records types which were not registered, the record will
-** be sent to the default handler. A default type-handler may
-** be registered by calling this NFA_RegisterNDefTypeHandler
-** with tnf=NFA_TNF_DEFAULT. In this case, all un-registered
-** record types will be sent to the callback. Only one default
-** handler may be registered at a time.
-**
-** An NFA_NDEF_REGISTER_EVT will be sent to the tNFA_NDEF_CBACK
-** to indicate that registration was successful, and provide a
-** handle for this record type.
-**
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RegisterNDefTypeHandler(bool handle_whole_message,
- tNFA_TNF tnf,
- uint8_t* p_type_name,
- uint8_t type_name_len,
- tNFA_NDEF_CBACK* p_ndef_cback);
-
-/*******************************************************************************
-**
-** Function NFA_RegisterNDefUriHandler
-**
-** Description This API is a special-case of NFA_RegisterNDefTypeHandler
-** with TNF=NFA_TNF_WKT, and type_name='U' (URI record); and
-** allows registering for specific URI types (e.g. 'tel:' or
-** 'mailto:').
-**
-** An NFA_NDEF_REGISTER_EVT will be sent to the tNFA_NDEF_CBACK
-** to indicate that registration was successful, and provide a
-** handle for this registration.
-**
-** If uri_id=NFA_NDEF_URI_ID_ABSOLUTE, then p_abs_uri contains
-** the unabridged URI. For all other uri_id values, the
-** p_abs_uri parameter is ignored (i.e the URI prefix is
-** implied by uri_id).
-**
-** See [NFC RTD URI] for more information.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RegisterNDefUriHandler(bool handle_whole_message,
- tNFA_NDEF_URI_ID uri_id,
- uint8_t* p_abs_uri,
- uint8_t uri_id_len,
- tNFA_NDEF_CBACK* p_ndef_cback);
-
-/*******************************************************************************
-**
-** Function NFA_DeregisterNDefTypeHandler
-**
-** Description Deregister NDEF record type handler.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_DeregisterNDefTypeHandler(tNFA_HANDLE ndef_type_handle);
-
-/*******************************************************************************
-**
-** Function NFA_PowerOffSleepMode
-**
-** Description This function is called to enter or leave NFCC Power Off
-** Sleep mode
-** NFA_DM_PWR_MODE_CHANGE_EVT will be sent to indicate status.
-**
-** start_stop : TRUE if entering Power Off Sleep mode
-** FALSE if leaving Power Off Sleep mode
-**
-Note??
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_PowerOffSleepMode(bool start_stop);
-
-/*******************************************************************************
-**
-** Function NFA_RegVSCback
-**
-** Description This function is called to register or de-register a
-** callback function to receive Proprietary NCI response and
-** notification events.
-** The maximum number of callback functions allowed is
-** NFC_NUM_VS_CBACKS
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFA_RegVSCback(bool is_register, tNFA_VSC_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFA_SendVsCommand
-**
-** Description This function is called to send an NCI Vendor Specific
-** command to NFCC.
-**
-** oid - The opcode of the VS command.
-** cmd_params_len - The command parameter len
-** p_cmd_params - The command parameter
-** p_cback - The callback function to receive the
-** command status
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_SendVsCommand(uint8_t oid, uint8_t cmd_params_len,
- uint8_t* p_cmd_params,
- tNFA_VSC_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFA_SendRawVsCommand
-**
-** Description This function is called to send raw vendor specific
-** command to NFCC.
-**
-** cmd_params_len - The command parameter len
-** p_cmd_params - The command parameter
-** p_cback - The callback function to receive the
-** command
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-
-extern tNFA_STATUS NFA_SendRawVsCommand(uint8_t cmd_params_len,
- uint8_t* p_cmd_params,
- tNFA_VSC_CBACK* p_cback);
-
-/*******************************************************************************
-** Function: NFA_EnableDTA_TypeMode
-**
-** Description: Initialize and get global DTA type mode from .conf
-**
-** Returns: none:
-**
-*******************************************************************************/
-extern void NFA_EnableDtamode(tNFA_eDtaModes eDtaMode);
-
-/*******************************************************************************
-**
-** Function: NFA_SetNfcSecure
-**
-** Description: Set NFC secure flag
-**
-** Returns: none:
-**
-*******************************************************************************/
-extern void NFA_SetNfcSecure(bool status);
-
-/*******************************************************************************
-**
-** Function: NFA_DisableDtamode
-**
-** Description: Disable DTA Mode
-**
-** Returns: none:
-**
-*******************************************************************************/
-extern void NFA_DisableDtamode(void);
-
-/*******************************************************************************
-** Function NFA_GetNCIVersion
-**
-** Description Called by higher layer to get the current nci
-** version of nfc.
-**
-** Returns NCI version NCI2.0 / NCI1.0
-**
-*******************************************************************************/
-extern uint8_t NFA_GetNCIVersion();
-
-/*******************************************************************************
-** Function: NFA_SetPowerSubStateForScreenState
-**
-** Description: This function send the current screen state
-**
-** Returns: NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-*******************************************************************************/
-extern tNFA_STATUS NFA_SetPowerSubStateForScreenState(uint8_t ScreenState);
-
-/*******************************************************************************
-**
-** Function NFA_ChangeDiscoveryTech
-**
-** Description Change RF discoverying technologies specified by
-** pollTech and listenTech.
-**
-** NFA_DM_API_CHANGE_DISCOVERY_TECH_EVT will be returned.
-**
-** If pollTech/listenTech are set to 0xFF, it revert to
-** the polling/listening technologies
-** before NFA_ChangeDiscoveryTech() was called.
-**
-** is_revert_poll : TRUE if reverting RF polling tech
-** before calling NFA_StopRfDiscovery
-** FALSE if changing RF polling tech according
-** to pollTech
-** is_revert_listen : TRUE if reverting RF listening tech
-** before calling NFA_StopRfDiscovery
-** FALSE if changing RF listening tech according
-** to listenTech
-** change_default_tech : TRUE if the default technolofy mask
-** has to be changed according to listenTech
-** and pollTech settings
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT
-** should happen before calling this function
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-tNFA_STATUS NFA_ChangeDiscoveryTech(tNFA_TECHNOLOGY_MASK pollTech,
- tNFA_TECHNOLOGY_MASK listenTech,
- bool is_revert_poll, bool is_revert_listen,
- bool change_default_tech = false);
-
-/*******************************************************************************
-**
-** Function NFA_IsRfRemovalDetectionSupported
-**
-** Description Indicates if RF Removal Detection mode is supported by NFCC
-**
-** Returns true if supported else false.
-**
-*******************************************************************************/
-bool NFA_IsRfRemovalDetectionSupported();
-
-#ifdef ST21NFC
-/*******************************************************************************
-**
-** Function: NFA_SetCustomConfig
-**
-** Description: Allow to set NCI config for Listen A from upper layer
-**
-** Returns: none:
-**
-*******************************************************************************/
-extern void NFA_SetCustomConfig(bool status);
-#endif
-#endif /* NFA_API_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ce_api.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ce_api.h
deleted file mode 100755
index 55412b3..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ce_api.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/******************************************************************************
- *
- * 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.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * NFA card emulation API functions
- *
- ******************************************************************************/
-#ifndef NFA_CE_API_H
-#define NFA_CE_API_H
-
-#include "nfa_api.h"
-#include "nfc_target.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-/*****************************************************************************
-** External Function Declarations
-*****************************************************************************/
-
-/*******************************************************************************
-**
-** Function NFA_CeConfigureLocalTag
-**
-** Description Configure local NDEF tag.
-**
-** Tag events will be notifed using the tNFA_CONN_CBACK
-** (registered during NFA_Enable)
-**
-** The NFA_CE_LOCAL_TAG_CONFIGURED_EVT reports the status of
-** the operation.
-**
-** Activation and deactivation are reported using the
-** NFA_ACTIVATED_EVT and NFA_DEACTIVATED_EVT events
-**
-** If a write-request is received to update the tag memory,
-** an NFA_CE_NDEF_WRITE_CPLT_EVT will notify the application,
-** along with a buffer containing the updated contents.
-**
-** To disable the local NDEF tag, set protocol_mask=0
-**
-** The NDEF data provided by p_ndef_data must be persistent
-** as long as the local NDEF tag is enabled. Also, Input
-** parameters p_uid and uid_len are reserved for future use.
-**
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function.
-**
-** Returns:
-** NFA_STATUS_OK, if command accepted
-** NFA_STATUS_INVALID_PARAM,
-** if protocol_maks is not 0 and p_ndef_data is NULL
-** (or) uid_len is not 0
-** (or) if protocol mask is set for Type 1 or Type 2
-**
-** NFA_STATUS_FAILED: otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_CeConfigureLocalTag(tNFA_PROTOCOL_MASK protocol_mask,
- uint8_t* p_ndef_data,
- uint16_t ndef_cur_size,
- uint16_t ndef_max_size,
- bool read_only, uint8_t uid_len,
- uint8_t* p_uid);
-
-/*******************************************************************************
-**
-** Function NFA_CeConfigureUiccListenTech
-**
-** Description Configure listening for the UICC, using the specified
-** technologies.
-**
-** Events will be notifed using the tNFA_CONN_CBACK
-** (registered during NFA_Enable)
-**
-** The NFA_CE_UICC_LISTEN_CONFIGURED_EVT reports the status of
-** the operation.
-**
-** Activation and deactivation are reported using the
-** NFA_ACTIVATED_EVT and NFA_DEACTIVATED_EVT events
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Returns:
-** NFA_STATUS_OK, if command accepted
-** NFA_STATUS_FAILED: otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_CeConfigureUiccListenTech(
- tNFA_HANDLE ee_handle, tNFA_TECHNOLOGY_MASK tech_mask);
-
-/*******************************************************************************
-**
-** Function NFA_CeRegisterFelicaSystemCodeOnDH
-**
-** Description Register listening callback for Felica system code
-**
-** The NFA_CE_REGISTERED_EVT reports the status of the
-** operation.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Returns:
-** NFA_STATUS_OK, if command accepted
-** NFA_STATUS_FAILED: otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_CeRegisterFelicaSystemCodeOnDH(
- uint16_t system_code, uint8_t nfcid2[NCI_RF_F_UID_LEN],
- uint8_t t3tPmm[NCI_T3T_PMM_LEN], tNFA_CONN_CBACK* p_conn_cback);
-
-/*******************************************************************************
-**
-** Function NFA_CeDeregisterFelicaSystemCodeOnDH
-**
-** Description Deregister listening callback for Felica
-** (previously registered using
-** NFA_CeRegisterFelicaSystemCodeOnDH)
-**
-** The NFA_CE_DEREGISTERED_EVT reports the status of the
-** operation.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_BAD_HANDLE if invalid handle
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_CeDeregisterFelicaSystemCodeOnDH(tNFA_HANDLE handle);
-
-/*******************************************************************************
-**
-** Function NFA_CeRegisterAidOnDH
-**
-** Description Register listening callback for the specified ISODEP AID
-**
-** The NFA_CE_REGISTERED_EVT reports the status of the
-** operation.
-**
-** If no AID is specified (aid_len=0), then p_conn_cback will
-** will get notifications for any AIDs routed to the DH. This
-** over-rides callbacks registered for specific AIDs.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Returns:
-** NFA_STATUS_OK, if command accepted
-** NFA_STATUS_FAILED: otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_CeRegisterAidOnDH(uint8_t aid[NFC_MAX_AID_LEN],
- uint8_t aid_len,
- tNFA_CONN_CBACK* p_conn_cback);
-
-/*******************************************************************************
-**
-** Function NFA_CeDeregisterAidOnDH
-**
-** Description Deregister listening callback for ISODEP AID
-** (previously registered using NFA_CeRegisterAidOnDH)
-**
-** The NFA_CE_DEREGISTERED_EVT reports the status of the
-** operation.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_BAD_HANDLE if invalid handle
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_CeDeregisterAidOnDH(tNFA_HANDLE handle);
-
-/*******************************************************************************
-**
-** Function NFA_CeSetIsoDepListenTech
-**
-** Description Set the technologies (NFC-A and/or NFC-B) to listen for when
-** NFA_CeConfigureLocalTag or NFA_CeDeregisterAidOnDH are
-** called.
-**
-** By default (if this API is not called), NFA will listen
-** for both NFC-A and NFC-B for ISODEP.
-**
-** Note: If listening for ISODEP on UICC, the DH listen callbacks
-** may still get activate notifications for ISODEP if the
-** reader/writer selects an AID that is not routed to the UICC
-** (regardless of whether A or B was disabled using
-** NFA_CeSetIsoDepListenTech)
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Returns:
-** NFA_STATUS_OK, if command accepted
-** NFA_STATUS_FAILED: otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_CeSetIsoDepListenTech(tNFA_TECHNOLOGY_MASK tech_mask);
-
-#endif /* NFA_CE_API_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ce_int.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ce_int.h
deleted file mode 100755
index 915224b..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ce_int.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2011-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 is the private interface file for NFA_CE
- *
- ******************************************************************************/
-#ifndef NFA_CE_INT_H
-#define NFA_CE_INT_H
-
-#include "nfa_api.h"
-#include "nfa_ce_api.h"
-#include "nfa_dm_int.h"
-#include "nfa_sys.h"
-#include "nfc_api.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-/* CE events */
-enum {
- /* device manager local device API events */
- NFA_CE_API_CFG_LOCAL_TAG_EVT = NFA_SYS_EVT_START(NFA_ID_CE),
- NFA_CE_API_REG_LISTEN_EVT,
- NFA_CE_API_DEREG_LISTEN_EVT,
- NFA_CE_API_CFG_ISODEP_TECH_EVT,
- NFA_CE_ACTIVATE_NTF_EVT,
- NFA_CE_DEACTIVATE_NTF_EVT
-
-};
-
-/* Listen registration types */
-enum { NFA_CE_REG_TYPE_ISO_DEP, NFA_CE_REG_TYPE_FELICA, NFA_CE_REG_TYPE_UICC };
-typedef uint8_t tNFA_CE_REG_TYPE;
-
-/* data type for NFA_CE_API_CFG_LOCAL_TAG_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_PROTOCOL_MASK protocol_mask;
- uint8_t* p_ndef_data;
- uint16_t ndef_cur_size;
- uint16_t ndef_max_size;
- bool read_only;
- uint8_t uid_len;
- uint8_t uid[NFA_MAX_UID_LEN];
-} tNFA_CE_API_CFG_LOCAL_TAG;
-
-/* data type for NFA_CE_ACTIVATE_NTF_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFC_ACTIVATE_DEVT* p_activation_params;
-} tNFA_CE_ACTIVATE_NTF;
-
-/* data type for NFA_CE_API_REG_LISTEN_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_CONN_CBACK* p_conn_cback;
-
- tNFA_CE_REG_TYPE listen_type;
-
- /* For registering Felica */
- uint16_t system_code;
- uint8_t nfcid2[NCI_RF_F_UID_LEN];
- uint8_t t3tPmm[NCI_T3T_PMM_LEN];
-
- /* For registering Type-4 */
- uint8_t aid[NFC_MAX_AID_LEN]; /* AID to listen for (For type-4 only) */
- uint8_t aid_len; /* AID length */
-
- /* For registering UICC */
- tNFA_HANDLE ee_handle;
- tNFA_TECHNOLOGY_MASK tech_mask;
-} tNFA_CE_API_REG_LISTEN;
-
-/* data type for NFA_CE_API_DEREG_LISTEN_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE handle;
- uint32_t listen_info;
-} tNFA_CE_API_DEREG_LISTEN;
-
-/* union of all data types */
-typedef union {
- /* GKI event buffer header */
- NFC_HDR hdr;
- tNFA_CE_API_CFG_LOCAL_TAG local_tag;
- tNFA_CE_API_REG_LISTEN reg_listen;
- tNFA_CE_API_DEREG_LISTEN dereg_listen;
- tNFA_CE_ACTIVATE_NTF activate_ntf;
-} tNFA_CE_MSG;
-
-/****************************************************************************
-** LISTEN_INFO definitions
-*****************************************************************************/
-/* Entry 0 is reserved for local NDEF tag */
-#define NFA_CE_LISTEN_INFO_IDX_NDEF 0
-#define NFA_CE_LISTEN_INFO_IDX_INVALID (NFA_CE_LISTEN_INFO_MAX)
-
-/* Flags for listen request */
-/* LISTEN_INFO entry is in use */
-#define NFA_CE_LISTEN_INFO_IN_USE 0x00000001
-/* NDEF is read-only */
-#define NFC_CE_LISTEN_INFO_READONLY_NDEF 0x00000010
-/* App has not been notified of ACTIVATE_EVT yet for this T4T AID */
-#define NFA_CE_LISTEN_INFO_T4T_ACTIVATE_PND 0x00000040
-/* This is a listen_info for T4T AID */
-#define NFA_CE_LISTEN_INFO_T4T_AID 0x00000080
-/* App has not been notified of LISTEN_START yet */
-#define NFA_CE_LISTEN_INFO_START_NTF_PND 0x00000100
-/* This is a listen_info for non-NDEF Felica */
-#define NFA_CE_LISTEN_INFO_FELICA 0x00000200
-/* This is a listen_info for UICC */
-#define NFA_CE_LISTEN_INFO_UICC 0x00000400
-/* App has not been notified of ACTIVATE_EVT yet for this HCEF NFCID2 */
-#define NFA_CE_LISTEN_INFO_T3T_ACTIVATE_PND 0x00010000
-
-/* Structure for listen look up table */
-typedef struct {
- uint32_t flags;
- tNFA_CONN_CBACK* p_conn_cback; /* Callback for this listen request */
- tNFA_PROTOCOL_MASK
- protocol_mask; /* Mask of protocols for this listen request */
- tNFA_HANDLE rf_disc_handle; /* RF Discover handle */
-
- /* For host tag emulation (NFA_CeRegisterVirtualT4tSE and
- * NFA_CeRegisterT4tAidOnDH) */
- uint8_t t3t_pmm[NCI_T3T_PMM_LEN];
- uint8_t t3t_nfcid2[NCI_RF_F_UID_LEN];
- uint16_t t3t_system_code; /* Type-3 system code */
- uint8_t
- t4t_aid_handle; /* Type-4 aid callback handle (from CE_T4tRegisterAID) */
-
- /* For UICC */
- tNFA_HANDLE ee_handle;
- tNFA_TECHNOLOGY_MASK tech_mask; /* listening technologies */
- tNFA_DM_DISC_TECH_PROTO_MASK
- tech_proto_mask; /* listening technologies and protocols */
-} tNFA_CE_LISTEN_INFO;
-
-/****************************************************************************/
-
-/* Internal flags for nfa_ce */
-/* Deactivation locally initiated by application */
-#define NFA_CE_FLAGS_APP_INIT_DEACTIVATION 0x00000001
-/* Tag is in listen active or sleep state */
-#define NFA_CE_FLAGS_LISTEN_ACTIVE_SLEEP 0x00000002
-typedef uint32_t tNFA_CE_FLAGS;
-
-/* NFA_CE control block */
-typedef struct {
- uint8_t* p_scratch_buf; /* Scratch buffer for write requests */
- uint32_t scratch_buf_size;
-
- tNFC_ACTIVATE_DEVT activation_params; /* Activation params */
- tNFA_CE_FLAGS flags; /* internal flags */
- tNFA_CONN_CBACK* p_active_conn_cback; /* Callback of activated CE */
-
- /* listen_info table (table of listen parameters and app callbacks) */
- tNFA_CE_LISTEN_INFO
- listen_info[NFA_CE_LISTEN_INFO_MAX]; /* listen info table */
- uint8_t idx_cur_active; /* listen_info index for currently activated CE */
- uint8_t idx_wild_card; /* listen_info index for T4T wild card CE */
-
- tNFA_DM_DISC_TECH_PROTO_MASK
- isodep_disc_mask; /* the technology/protocol mask for ISO-DEP */
-
- /* Local ndef tag info */
- uint8_t* p_ndef_data;
- uint16_t ndef_cur_size;
- uint16_t ndef_max_size;
-
- tNFA_SYS_EVT_HDLR* p_vs_evt_hdlr; /* VS event handler */
-} tNFA_CE_CB;
-extern tNFA_CE_CB nfa_ce_cb;
-
-/* type definition for action functions */
-typedef bool (*tNFA_CE_ACTION)(tNFA_CE_MSG* p_data);
-
-extern uint8_t NFC_GetNCIVersion();
-
-/* Action function prototypes */
-bool nfa_ce_api_cfg_local_tag(tNFA_CE_MSG* p_ce_msg);
-bool nfa_ce_api_reg_listen(tNFA_CE_MSG* p_ce_msg);
-bool nfa_ce_api_dereg_listen(tNFA_CE_MSG* p_ce_msg);
-bool nfa_ce_api_cfg_isodep_tech(tNFA_CE_MSG* p_ce_msg);
-bool nfa_ce_activate_ntf(tNFA_CE_MSG* p_ce_msg);
-bool nfa_ce_deactivate_ntf(tNFA_CE_MSG* p_ce_msg);
-
-/* Internal function prototypes */
-void nfa_ce_t3t_generate_rand_nfcid(uint8_t nfcid2[NCI_RF_F_UID_LEN]);
-bool nfa_ce_hdl_event(NFC_HDR* p_msg);
-tNFC_STATUS nfa_ce_set_content(void);
-tNFA_STATUS nfa_ce_start_listening(void);
-void nfa_ce_remove_listen_info_entry(uint8_t listen_info_idx, bool notify_app);
-void nfa_ce_sys_disable(void);
-void nfa_ce_free_scratch_buf(void);
-bool nfa_ce_restart_listen_check(void);
-#endif /* NFA_DM_INT_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_dm_int.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_dm_int.h
deleted file mode 100755
index 1b40999..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_dm_int.h
+++ /dev/null
@@ -1,739 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2003-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 is the private interface file for the NFA device manager.
- *
- ******************************************************************************/
-#ifndef NFA_DM_INT_H
-#define NFA_DM_INT_H
-
-#include <string>
-#include "nfa_api.h"
-#include "nfa_sys.h"
-#include "nfc_api.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-/* DM events */
-enum {
- /* device manager local device API events */
- NFA_DM_API_ENABLE_EVT = NFA_SYS_EVT_START(NFA_ID_DM),
- NFA_DM_API_DISABLE_EVT,
- NFA_DM_API_SET_CONFIG_EVT,
- NFA_DM_API_GET_CONFIG_EVT,
- NFA_DM_API_REQUEST_EXCL_RF_CTRL_EVT,
- NFA_DM_API_RELEASE_EXCL_RF_CTRL_EVT,
- NFA_DM_API_ENABLE_POLLING_EVT,
- NFA_DM_API_DISABLE_POLLING_EVT,
- NFA_DM_API_ENABLE_LISTENING_EVT,
- NFA_DM_API_DISABLE_LISTENING_EVT,
- NFA_DM_API_RAW_FRAME_EVT,
- NFA_DM_API_START_RF_DISCOVERY_EVT,
- NFA_DM_API_STOP_RF_DISCOVERY_EVT,
- NFA_DM_API_SET_RF_DISC_DURATION_EVT,
- NFA_DM_API_SELECT_EVT,
- NFA_DM_API_UPDATE_RF_PARAMS_EVT,
- NFA_DM_API_START_REMOVAL_DETECT_EVT,
- NFA_DM_API_DEACTIVATE_EVT,
- NFA_DM_API_POWER_OFF_SLEEP_EVT,
- NFA_DM_API_REG_NDEF_HDLR_EVT,
- NFA_DM_API_DEREG_NDEF_HDLR_EVT,
- NFA_DM_API_REG_VSC_EVT,
- NFA_DM_API_SEND_VSC_EVT,
- NFA_DM_TIMEOUT_DISABLE_EVT,
- NFA_DM_API_SET_POWER_SUB_STATE_EVT,
- NFA_DM_API_SEND_RAW_VS_EVT,
- NFA_DM_API_CHANGE_DISCOVERY_TECH_EVT,
- NFA_DM_MAX_EVT
-};
-
-/* data type for NFA_DM_API_ENABLE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_DM_CBACK* p_dm_cback;
- tNFA_CONN_CBACK* p_conn_cback;
-} tNFA_DM_API_ENABLE;
-
-/* data type for NFA_DM_API_DISABLE_EVT */
-typedef struct {
- NFC_HDR hdr;
- bool graceful;
-} tNFA_DM_API_DISABLE;
-
-/* data type for NFA_DM_API_SET_CONFIG_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_PMID param_id;
- uint8_t length;
- uint8_t* p_data;
-} tNFA_DM_API_SET_CONFIG;
-
-/* data type for NFA_DM_API_GET_CONFIG_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint8_t num_ids;
- tNFA_PMID* p_pmids;
-} tNFA_DM_API_GET_CONFIG;
-
-/* data type for NFA_DM_API_REQ_EXCL_RF_CTRL_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_TECHNOLOGY_MASK poll_mask;
- tNFA_LISTEN_CFG listen_cfg;
- tNFA_CONN_CBACK* p_conn_cback;
- tNFA_NDEF_CBACK* p_ndef_cback;
-} tNFA_DM_API_REQ_EXCL_RF_CTRL;
-
-/* data type for NFA_DM_API_ENABLE_POLLING_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_TECHNOLOGY_MASK poll_mask;
-} tNFA_DM_API_ENABLE_POLL;
-
-/* data type for NFA_DM_API_CHANGE_DISCOVERY_TECH_EVT*/
-typedef struct {
- NFC_HDR hdr;
- bool is_revert_poll;
- bool is_revert_listen;
- bool change_default_tech;
- tNFA_TECHNOLOGY_MASK change_listen_mask;
- tNFA_TECHNOLOGY_MASK change_poll_mask;
-} tNFA_DM_API_CHANGE_DISCOVERY_TECH;
-
-/* data type for NFA_DM_API_SELECT_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint8_t rf_disc_id;
- tNFA_NFC_PROTOCOL protocol;
- tNFA_INTF_TYPE rf_interface;
-} tNFA_DM_API_SELECT;
-
-/* data type for NFA_DM_API_UPDATE_RF_PARAMS_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_RF_COMM_PARAMS params;
-} tNFA_DM_API_UPDATE_RF_PARAMS;
-
-/* data type for NFA_DM_API_START_REMOVAL_DETECT_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint8_t waiting_time_int;
-} tNFA_DM_API_START_REMOVAL_DETECT;
-
-/* data type for NFA_DM_API_DEACTIVATE_EVT */
-typedef struct {
- NFC_HDR hdr;
- bool sleep_mode;
-} tNFA_DM_API_DEACTIVATE;
-
-/* data type for NFA_DM_API_SET_RF_DISC_DURATION_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint16_t rf_disc_dur_ms;
-} tNFA_DM_API_SET_RF_DISC_DUR;
-
-/* data type for NFA_DM_API_REG_NDEF_HDLR_EVT */
-#define NFA_NDEF_FLAGS_HANDLE_WHOLE_MESSAGE 0x01
-#define NFA_NDEF_FLAGS_WKT_URI 0x02
-#define NFA_NDEF_FLAGS_WHOLE_MESSAGE_NOTIFIED 0x04
-
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE ndef_type_handle;
- uint8_t flags;
- tNFA_NDEF_CBACK* p_ndef_cback;
- tNFA_TNF tnf; /* Type-name field of record-type that was registered. */
- tNFA_NDEF_URI_ID
- uri_id; /* URI prefix abrieviation (for NFA_RegisterNDefUriHandler) */
- uint8_t name_len; /* Length of type name or absolute URI */
- uint8_t name[1]; /* Type name or absolute URI of record-type that got was
- registered. */
-} tNFA_DM_API_REG_NDEF_HDLR;
-
-/* data type for NFA_DM_API_DEREG_NDEF_HDLR_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE ndef_type_handle;
-} tNFA_DM_API_DEREG_NDEF_HDLR;
-
-/* data type for NFA_DM_API_REG_VSC_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_VSC_CBACK* p_cback;
- bool is_register;
-} tNFA_DM_API_REG_VSC;
-
-/* data type for NFA_DM_API_SEND_VSC_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_VSC_CBACK* p_cback;
- uint8_t oid;
- uint8_t cmd_params_len;
- uint16_t pad; /* add padding to ensure the size is big enough for
- offset=NCI_VSC_MSG_HDR_SIZE */
- uint8_t* p_cmd_params;
-} tNFA_DM_API_SEND_VSC;
-
-/* data type for NFA_DM_API_SET_POWER_SUB_STATE_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint8_t screen_state;
-} tNFA_DM_API_SET_POWER_SUB_STATE;
-
-/* union of all data types */
-typedef union {
- /* GKI event buffer header */
- NFC_HDR hdr; /* NFA_DM_API_RAW_FRAME_EVT */
- /* NFA_DM_API_MULTI_TECH_RSP_EVT */
- /* NFA_DM_API_RELEASE_EXCL_RF_CTRL */
- /* NFA_DM_API_DISABLE_POLLING_EVT */
- /* NFA_DM_API_START_RF_DISCOVERY_EVT */
- /* NFA_DM_API_STOP_RF_DISCOVERY_EVT */
- tNFA_DM_API_ENABLE enable; /* NFA_DM_API_ENABLE_EVT */
- tNFA_DM_API_DISABLE disable; /* NFA_DM_API_DISABLE_EVT */
- tNFA_DM_API_SET_CONFIG setconfig; /* NFA_DM_API_SET_CONFIG_EVT */
- tNFA_DM_API_GET_CONFIG getconfig; /* NFA_DM_API_GET_CONFIG_EVT */
- tNFA_DM_API_SET_RF_DISC_DUR
- disc_duration; /* NFA_DM_API_SET_RF_DISC_DURATION_EVT */
- tNFA_DM_API_REG_NDEF_HDLR reg_ndef_hdlr; /* NFA_DM_API_REG_NDEF_HDLR_EVT */
- tNFA_DM_API_DEREG_NDEF_HDLR
- dereg_ndef_hdlr; /* NFA_DM_API_DEREG_NDEF_HDLR_EVT */
- tNFA_DM_API_REQ_EXCL_RF_CTRL
- req_excl_rf_ctrl; /* NFA_DM_API_REQUEST_EXCL_RF_CTRL */
- tNFA_DM_API_ENABLE_POLL enable_poll; /* NFA_DM_API_ENABLE_POLLING_EVT */
- tNFA_DM_API_SELECT select; /* NFA_DM_API_SELECT_EVT */
- tNFA_DM_API_UPDATE_RF_PARAMS
- update_rf_params; /* NFA_DM_API_UPDATE_RF_PARAMS_EVT */
- tNFA_DM_API_START_REMOVAL_DETECT
- detect_removal_params; /* NFA_DM_API_START_REMOVAL_DETECT_EVT */
- tNFA_DM_API_DEACTIVATE deactivate; /* NFA_DM_API_DEACTIVATE_EVT */
- tNFA_DM_API_SEND_VSC send_vsc; /* NFA_DM_API_SEND_VSC_EVT */
- tNFA_DM_API_REG_VSC reg_vsc; /* NFA_DM_API_REG_VSC_EVT */
- /* NFA_DM_API_SET_POWER_SUB_STATE_EVT */
- tNFA_DM_API_SET_POWER_SUB_STATE set_power_state;
- /* NFA_DM_API_CHANGE_DISCOVERY_TECH_EVT */
- tNFA_DM_API_CHANGE_DISCOVERY_TECH change_discovery_tech;
-} tNFA_DM_MSG;
-
-/* DM RF discovery state */
-enum {
- NFA_DM_RFST_IDLE, /* idle state */
- NFA_DM_RFST_DISCOVERY, /* discovery state */
- NFA_DM_RFST_W4_ALL_DISCOVERIES, /* wait for all discoveries state */
- NFA_DM_RFST_W4_HOST_SELECT, /* wait for host selection state */
- NFA_DM_RFST_POLL_ACTIVE, /* poll mode activated state */
- NFA_DM_RFST_POLL_REMOVAL_DETECTION, /* poll removal detection state */
- NFA_DM_RFST_LISTEN_ACTIVE, /* listen mode activated state */
- NFA_DM_RFST_LISTEN_SLEEP, /* listen mode sleep state */
- NFA_DM_RFST_LP_LISTEN, /* Listening in Low Power mode */
- NFA_DM_RFST_LP_ACTIVE /* Activated in Low Power mode */
-};
-typedef uint8_t tNFA_DM_RF_DISC_STATE;
-
-/* DM RF discovery state machine event */
-enum {
- NFA_DM_RF_DISCOVER_CMD, /* start RF discovery */
- NFA_DM_RF_DISCOVER_RSP, /* discover response from NFCC */
- NFA_DM_RF_DISCOVER_NTF, /* RF discovery NTF from NFCC */
- NFA_DM_RF_DISCOVER_SELECT_CMD, /* select discovered target */
- NFA_DM_RF_DISCOVER_SELECT_RSP, /* select response from NFCC */
- NFA_DM_RF_INTF_ACTIVATED_NTF, /* RF interface activation NTF from NFCC */
- NFA_DM_RF_DEACTIVATE_CMD, /* deactivate RF interface */
- NFA_DM_RF_DEACTIVATE_RSP, /* deactivate response from NFCC */
- NFA_DM_RF_DEACTIVATE_NTF, /* deactivate RF interface NTF from NFCC */
- NFA_DM_RF_INTF_EXT_START_CMD, /* start RF interface extension */
- NFA_DM_RF_INTF_EXT_START_RSP, /* start extension response from NFCC */
- NFA_DM_RF_INTF_EXT_STOP_CMD, /* stop RF interface extension */
- NFA_DM_RF_INTF_EXT_STOP_RSP, /* stop extension response from NFCC */
- NFA_DM_RF_REMOVAL_DETECT_START_CMD, /* start endpoint removal detection */
- NFA_DM_RF_REMOVAL_DETECT_START_RSP, /* start removal detection RSP from NFCC
- */
- NFA_DM_RF_REMOVAL_DETECTION_NTF, /* removal detection NTF from NFCC */
- NFA_DM_WPT_START_CMD, /* start wireless power transfer phase */
- NFA_DM_WPT_START_RSP, /* start WPT response from NFCC */
- NFA_DM_LP_LISTEN_CMD, /* NFCC is listening in low power mode */
- NFA_DM_CORE_INTF_ERROR_NTF, /* RF interface error NTF from NFCC */
- NFA_DM_DISC_SM_MAX_EVENT
-};
-typedef uint8_t tNFA_DM_RF_DISC_SM_EVENT;
-
-/* DM RF discovery state machine data */
-typedef struct {
- uint8_t rf_disc_id;
- tNFA_NFC_PROTOCOL protocol;
- tNFA_INTF_TYPE rf_interface;
-} tNFA_DM_DISC_SELECT_PARAMS;
-
-/* DM Removal Detection data */
-typedef struct {
- uint8_t rf_intf_ext_id;
- uint8_t cmd_params_len;
- uint8_t* p_cmd_params;
-} tNFA_DM_DISC_RF_EXT_PARAMS;
-
-typedef struct {
- uint8_t waiting_time;
-} tNFA_DM_DETECT_EP_REMOVAL_PARAMS;
-
-/* DM WPT data */
-typedef struct {
- uint8_t power_adj_req;
- uint8_t wpt_time_int;
-} tNFA_DM_DISC_WPT_START_PARAMS;
-
-typedef union {
- tNFC_DISCOVER nfc_discover; /* discovery data from NFCC */
- tNFC_DEACT_TYPE deactivate_type; /* deactivation type */
- tNFA_DM_DISC_SELECT_PARAMS select; /* selected target information */
- tNFA_DM_DISC_RF_EXT_PARAMS handle_ext; /* RF extension information */
- /* Removal detection information */
- tNFA_DM_DETECT_EP_REMOVAL_PARAMS detect_removal;
- tNFA_DM_DISC_WPT_START_PARAMS start_wpt; /* start power transfer */
-} tNFA_DM_RF_DISC_DATA;
-
-/* Callback event from NFA DM RF Discovery to other NFA sub-modules */
-enum {
- NFA_DM_RF_DISC_START_EVT, /* discovery started with protocol, technology and
- mode */
- NFA_DM_RF_DISC_ACTIVATED_EVT, /* activated with configured protocol,
- technology and mode */
- NFA_DM_RF_DISC_DEACTIVATED_EVT /* deactivated sleep or idle */
-};
-typedef uint8_t tNFA_DM_RF_DISC_EVT;
-
-/* Combined NFC Technology and protocol bit mask */
-#define NFA_DM_DISC_MASK_PA_T1T 0x00000001
-#define NFA_DM_DISC_MASK_PA_T2T 0x00000002
-#define NFA_DM_DISC_MASK_PA_ISO_DEP 0x00000004
-#define NFA_DM_DISC_MASK_PA_NFC_DEP 0x00000008
-#define NFA_DM_DISC_MASK_PB_ISO_DEP 0x00000010
-#define NFA_DM_DISC_MASK_PF_T3T 0x00000020
-#define NFA_DM_DISC_MASK_PF_NFC_DEP 0x00000040
-#define NFA_DM_DISC_MASK_P_T5T 0x00000100
-#define NFA_DM_DISC_MASK_P_B_PRIME 0x00000200
-#define NFA_DM_DISC_MASK_P_KOVIO 0x00000400
-/* Legacy/proprietary/non-NFC Forum protocol (e.g Shanghai transit card) */
-#define NFA_DM_DISC_MASK_P_LEGACY 0x00002000
-#define NFA_DM_DISC_MASK_PA_MIFARE 0x00004000
-#define NFA_DM_DISC_MASK_PB_CI 0x00008000
-#define NFA_DM_DISC_MASK_POLL 0x0000FFFF
-
-#define NFA_DM_DISC_MASK_LA_T1T 0x00010000
-#define NFA_DM_DISC_MASK_LA_T2T 0x00020000
-#define NFA_DM_DISC_MASK_LA_ISO_DEP 0x00040000
-#define NFA_DM_DISC_MASK_LB_ISO_DEP 0x00100000
-#define NFA_DM_DISC_MASK_LF_T3T 0x00200000
-#define NFA_DM_DISC_MASK_L_ISO15693 0x01000000
-#define NFA_DM_DISC_MASK_L_B_PRIME 0x02000000
-#define NFA_DM_DISC_MASK_L_LEGACY 0x10000000
-#define NFA_DM_DISC_MASK_LISTEN 0xFFFF0000
-
-typedef uint32_t tNFA_DM_DISC_TECH_PROTO_MASK;
-
-/* DM RF discovery host ID */
-#define NFA_DM_DISC_HOST_ID_DH NFC_DH_ID
-typedef uint8_t tNFA_DM_DISC_HOST_ID;
-
-/* DM deactivation callback type */
-typedef void(tNFA_DISCOVER_CBACK)(tNFA_DM_RF_DISC_EVT event,
- tNFC_DISCOVER* p_data);
-
-/* DM RF discovery action flags */
-/* RF discovery process has been started */
-#define NFA_DM_DISC_FLAGS_ENABLED 0x0001
-/* Stop RF discovery is pending */
-#define NFA_DM_DISC_FLAGS_STOPPING 0x0002
-/* Disable NFA is pending */
-#define NFA_DM_DISC_FLAGS_DISABLING 0x0004
-/* Sleep wakeup in progress */
-#define NFA_DM_DISC_FLAGS_CHECKING 0x0008
-/* Notify sub-module that discovery is starting */
-#define NFA_DM_DISC_FLAGS_NOTIFY 0x0010
-/* command has been sent to NFCC in the state */
-#define NFA_DM_DISC_FLAGS_W4_RSP 0x0020
-/* wait for NTF before changing discovery state */
-#define NFA_DM_DISC_FLAGS_W4_NTF 0x0040
-
-typedef uint16_t tNFA_DM_DISC_FLAGS;
-
-/* DM Discovery control block */
-typedef struct {
- bool in_use; /* TRUE if used */
- tNFA_DISCOVER_CBACK* p_disc_cback; /* discovery callback */
-
- tNFA_DM_DISC_FLAGS disc_flags; /* specific action flags */
- tNFA_DM_DISC_HOST_ID host_id; /* DH or UICC1/UICC2 */
- tNFA_DM_DISC_TECH_PROTO_MASK
- requested_disc_mask; /* technology and protocol requested */
- tNFA_DM_DISC_TECH_PROTO_MASK
- selected_disc_mask; /* technology and protocol waiting for activation */
-} tNFA_DM_DISC_ENTRY;
-
-/* polling, raw listen, P2P listen, NDEF CE, 2xVSE, 2xUICC */
-#define NFA_DM_DISC_NUM_ENTRIES 8
-
-/* max discovery technology parameters */
-#define NFA_DM_MAX_DISC_PARAMS 16
-
-/* index of listen mode routing table for technologies */
-enum {
- NFA_DM_DISC_LRT_NFC_A,
- NFA_DM_DISC_LRT_NFC_B,
- NFA_DM_DISC_LRT_NFC_F,
- NFA_DM_DISC_LRT_NFC_BP
-};
-
-/* NFA_EE_MAX_TECH_ROUTE. only A, B, F, Bprime are supported by UICC now */
-#define NFA_DM_MAX_TECH_ROUTE 4
-
-typedef struct {
- uint16_t disc_duration; /* Disc duration */
- tNFA_DM_DISC_FLAGS disc_flags; /* specific action flags */
- tNFA_DM_RF_DISC_STATE disc_state; /* RF discovery state */
-
- tNFC_RF_TECH_N_MODE activated_tech_mode; /* activated technology and mode */
- uint8_t activated_rf_disc_id; /* activated RF discovery ID */
- tNFA_INTF_TYPE activated_rf_interface; /* activated RF interface */
- tNFA_NFC_PROTOCOL activated_protocol; /* activated protocol */
- tNFA_HANDLE activated_handle; /* handle of activated sub-module */
- uint8_t activated_sel_res; /* activated tag's SEL_RES response */
-
- tNFA_DM_DISC_ENTRY entry[NFA_DM_DISC_NUM_ENTRIES];
-
- tNFA_DM_DISC_ENTRY excl_disc_entry; /* exclusive RF discovery */
- tNFA_LISTEN_CFG excl_listen_config; /* listen cfg for exclusive-rf mode */
-
- uint8_t listen_RT[NFA_DM_MAX_TECH_ROUTE]; /* Host ID for A, B, F, B'
- technology routing*/
- tNFA_DM_DISC_TECH_PROTO_MASK
- dm_disc_mask; /* technology and protocol waiting for activation */
-
- TIMER_LIST_ENT tle; /* timer for waiting deactivation NTF */
- TIMER_LIST_ENT kovio_tle; /* timer for Kovio bar code tag presence check */
-#ifdef ST21NFC
- TIMER_LIST_ENT mifare_pc_tle; /* timer for MIFARE IDLE mode presence check*/
-#endif
-
- bool deact_pending; /* TRUE if deactivate while checking presence */
- bool deact_notify_pending; /* TRUE if notify DEACTIVATED EVT while Stop rf
- discovery*/
- tNFA_DEACTIVATE_TYPE pending_deact_type; /* pending deactivate type */
-
-} tNFA_DM_DISC_CB;
-
-/* NDEF Type Handler Definitions */
-/* Default handler entry in ndef_handler table */
-#define NFA_NDEF_DEFAULT_HANDLER_IDX 0
-
-/* Maximum number of pending SetConfigs */
-#define NFA_DM_SETCONFIG_PENDING_MAX 32
-
-/* NFA_DM flags */
-/* DM is enabled */
-#define NFA_DM_FLAGS_DM_IS_ACTIVE 0x00000001
-/* Exclusive RF mode is active */
-#define NFA_DM_FLAGS_EXCL_RF_ACTIVE 0x00000002
-/* Polling is enabled (while not in exclusive RF mode */
-#define NFA_DM_FLAGS_POLLING_ENABLED 0x00000004
-/* send poll stop event */
-#define NFA_DM_FLAGS_SEND_POLL_STOP_EVT 0x00000008
-/* auto reading of NDEF in progress */
-#define NFA_DM_FLAGS_AUTO_READING_NDEF 0x00000010
-/* NFA_DM_ENABLE_EVT is not reported yet */
-#define NFA_DM_FLAGS_ENABLE_EVT_PEND 0x00000020
-/* Send NFA_DEACTIVATED_EVT when deactivated */
-#define NFA_DM_FLAGS_SEND_DEACTIVATED_EVT 0x00000040
-/* NFCC is restoring after back to full power mode */
-#define NFA_DM_FLAGS_NFCC_IS_RESTORING 0x00000100
-/* NFCC power mode is updating */
-#define NFA_DM_FLAGS_SETTING_PWR_MODE 0x00000200
-/* NFA DM is disabling NFC */
-#define NFA_DM_FLAGS_DM_DISABLING_NFC 0x00000400
-/* NFA_SendRawFrame() is called since RF activation */
-#define NFA_DM_FLAGS_RAW_FRAME 0x00000800
-/* NFA_DisableListening() is called and engaged */
-#define NFA_DM_FLAGS_LISTEN_DISABLED 0x00001000
-/* Power Off Sleep */
-#define NFA_DM_FLAGS_POWER_OFF_SLEEP 0x00008000
-/* stored parameters */
-/* Notification for RF Removal Detection is not reported yet */
-#define NFA_DM_FLAGS_EP_REMOVAL_DETECT_PEND 0x00004000
-/* Response to WLC RF Interface Extension start is not reported yet */
-#define NFA_DM_FLAGS_ENABLE_WLCP_PEND 0x00010000
-/* WLCP RF Extension is started */
-#define NFA_DM_FLAGS_RF_EXT_ACTIVE 0x00020000
-/* WLCP is ready to charge */
-#define NFA_DM_FLAGS_WLCP_ENABLED 0x00040000
-
-/* NFA_ChangeDiscoveryTech() is called and engaged */
-#define NFA_DM_FLAGS_POLL_TECH_CHANGED 0x10000000
-#define NFA_DM_FLAGS_LISTEN_TECH_CHANGED 0x20000000
-#define NFA_DM_FLAGS_DEFAULT_TECH_CHANGED 0x40000000
-/* stored parameters */
-typedef struct {
- uint8_t total_duration[NCI_PARAM_LEN_TOTAL_DURATION];
-
- uint8_t la_bit_frame_sdd[NCI_PARAM_LEN_LA_BIT_FRAME_SDD];
- uint8_t la_bit_frame_sdd_len;
- uint8_t la_platform_config[NCI_PARAM_LEN_LA_PLATFORM_CONFIG];
- uint8_t la_platform_config_len;
- uint8_t la_sel_info[NCI_PARAM_LEN_LA_SEL_INFO];
- uint8_t la_sel_info_len;
- uint8_t la_nfcid1[NCI_NFCID1_MAX_LEN];
- uint8_t la_nfcid1_len;
- uint8_t la_hist_by[NCI_MAX_HIS_BYTES_LEN];
- uint8_t la_hist_by_len;
-
- uint8_t lb_sensb_info[NCI_PARAM_LEN_LB_SENSB_INFO];
- uint8_t lb_sensb_info_len;
- uint8_t lb_nfcid0[NCI_PARAM_LEN_LB_NFCID0];
- uint8_t lb_nfcid0_len;
- uint8_t lb_appdata[NCI_PARAM_LEN_LB_APPDATA];
- uint8_t lb_appdata_len;
- uint8_t lb_adc_fo[NCI_PARAM_LEN_LB_ADC_FO];
- uint8_t lb_adc_fo_len;
- uint8_t lb_h_info[NCI_MAX_ATTRIB_LEN];
- uint8_t lb_h_info_len;
-
- uint8_t lf_protocol[NCI_PARAM_LEN_LF_PROTOCOL];
- uint8_t lf_protocol_len;
- uint8_t lf_t3t_flags2[NCI_PARAM_LEN_LF_T3T_FLAGS2];
- uint8_t lf_t3t_flags2_len;
- uint8_t lf_t3t_pmm[NCI_PARAM_LEN_LF_T3T_PMM];
- uint8_t lf_t3t_id[NFA_CE_LISTEN_INFO_MAX]
- [NCI_PARAM_LEN_LF_T3T_ID(NCI_VERSION_2_0)];
-
- uint8_t fwi[NCI_PARAM_LEN_FWI];
- uint8_t wt[NCI_PARAM_LEN_WT];
- uint8_t atr_req_gen_bytes[NCI_MAX_GEN_BYTES_LEN];
- uint8_t atr_req_gen_bytes_len;
- uint8_t atr_res_gen_bytes[NCI_MAX_GEN_BYTES_LEN];
- uint8_t atr_res_gen_bytes_len;
-
- uint8_t pf_rc[NCI_PARAM_LEN_PF_RC];
- uint8_t rf_field_info[NCI_PARAM_LEN_RF_FIELD_INFO];
- uint8_t rf_field_info_len;
-} tNFA_DM_PARAMS;
-
-/*
-** NFA_NDEF CHO callback
-** It returns TRUE if NDEF is handled by connection handover module.
-*/
-typedef bool(tNFA_NDEF_CHO_CBACK)(uint32_t ndef_len, uint8_t* p_ndef_data);
-
-/* DM control block */
-typedef struct {
- uint32_t flags; /* NFA_DM flags (see definitions for NFA_DM_FLAGS_*) */
- tNFA_DM_CBACK* p_dm_cback; /* NFA DM callback */
- TIMER_LIST_ENT tle;
-
- /* NFC link connection management */
- tNFA_CONN_CBACK* p_conn_cback; /* callback for connection events */
- tNFA_TECHNOLOGY_MASK poll_mask; /* technologies being polled */
-
- tNFA_CONN_CBACK* p_excl_conn_cback; /* exclusive RF mode callback */
- tNFA_NDEF_CBACK* p_excl_ndef_cback; /* ndef callback for exclusive RF mdoe */
-
- tNFA_NDEF_CHO_CBACK*
- p_ndef_cho_cback; /* NDEF callback for static connection handover */
-
- tNFA_HANDLE poll_disc_handle; /* discovery handle for polling */
-
- uint8_t* p_activate_ntf; /* temp holding activation notification */
- tHAL_API_GET_MAX_NFCEE* get_max_ee;
-
- tNFC_RF_TECH_N_MODE
- activated_tech_mode; /* previous activated technology and mode */
- uint8_t activated_nfcid[NFC_KOVIO_MAX_LEN]; /* NFCID 0/1/2 or UID of
- ISO15694/Kovio */
- uint8_t activated_nfcid_len; /* length of NFCID or UID */
-
- /* NFC link discovery management */
- tNFA_DM_DISC_CB disc_cb;
-
- /* NDEF Type handler */
- tNFA_DM_API_REG_NDEF_HDLR*
- p_ndef_handler[NFA_NDEF_MAX_HANDLERS]; /* ndef handler table */
-
- /* stored parameters */
- tNFA_DM_PARAMS params;
-
- /* SetConfig management */
- uint32_t setcfg_pending_mask; /* Mask of to indicate whether pending
- SET_CONFIGs require NFA_DM_SET_CONFIG_EVT.
- LSB=oldest pending */
- uint8_t setcfg_pending_num; /* Number of setconfigs pending */
-
- /* NFCC power mode */
- uint8_t nfcc_pwr_mode; /* NFA_DM_PWR_MODE_FULL or NFA_DM_PWR_MODE_OFF_SLEEP */
-
- tNFC_DEACT_TYPE listen_deact_cmd_type;
- uint8_t deactivate_cmd_retry_count; /*number of times the deactivation cmd
- sent in case of error scenario */
- bool is_nfc_secure;
- uint8_t power_state; /* current screen/power state */
- uint32_t eDtaMode; /* To enable the DTA type modes. */
- uint8_t pending_power_state; /* pending screen state change received in
- LISTEN_ACTIVE state which needs to be applied
- after current transaction is completed*/
- /* ChangeDiscoveryTech management */
- tNFA_TECHNOLOGY_MASK change_poll_mask; /* changing poll tech mask */
- tNFA_TECHNOLOGY_MASK change_listen_mask; /* changing listen tech mask */
-#ifdef ST21NFC
- /* Set a custom confim from upper layer */
- bool custom_config;
-#endif
-} tNFA_DM_CB;
-
-/* Internal function prototypes */
-void nfa_dm_ndef_handle_message(tNFA_STATUS status, uint8_t* p_msg_buf,
- uint32_t len);
-void nfa_dm_ndef_dereg_all(void);
-void nfa_dm_act_conn_cback_notify(uint8_t event, tNFA_CONN_EVT_DATA* p_data);
-void nfa_dm_notify_activation_status(tNFA_STATUS status,
- tNFA_TAG_PARAMS* p_params);
-
-bool nfa_dm_act_send_raw_vs(tNFA_DM_MSG* p_data);
-
-void nfa_dm_disable_complete(void);
-
-/* Internal functions from nfa_rw */
-void nfa_rw_init(void);
-void nfa_rw_proc_disc_evt(tNFA_DM_RF_DISC_EVT event, tNFC_DISCOVER* p_data,
- bool excl_rf_not_active);
-tNFA_STATUS nfa_rw_send_raw_frame(NFC_HDR* p_data);
-
-/* Internal functions from nfa_ce */
-void nfa_ce_init(void);
-
-/* Pointer to compile-time configuration structure */
-extern tNFA_DM_DISC_FREQ_CFG* p_nfa_dm_rf_disc_freq_cfg;
-extern tNFA_HCI_CFG* p_nfa_hci_cfg;
-extern tNFA_DM_CFG* p_nfa_dm_cfg;
-extern uint8_t* p_nfa_dm_ce_cfg;
-extern uint8_t* p_nfa_dm_gen_cfg;
-extern uint8_t nfa_ee_max_ee_cfg;
-extern tNCI_DISCOVER_MAPS* p_nfa_dm_interface_mapping;
-extern uint8_t nfa_dm_num_dm_interface_mapping;
-extern bool nfa_poll_bail_out_mode;
-
-void nfa_dm_poll_disc_cback_dta_wrapper(tNFA_DM_RF_DISC_EVT event,
- tNFC_DISCOVER* p_data);
-void nfa_dm_nfc_response_cback_wrapper(tNFC_RESPONSE_EVT event,
- tNFC_RESPONSE* p_data);
-extern unsigned char appl_dta_mode_flag;
-
-/* NFA device manager control block */
-extern tNFA_DM_CB nfa_dm_cb;
-
-void nfa_dm_init(void);
-
-#if (NFC_NFCEE_INCLUDED == TRUE)
-void nfa_ee_init(void);
-void nfa_hci_init(void);
-#else
-#define nfa_ee_init()
-#define nfa_hci_init()
-#endif
-
-/* Action function prototypes */
-bool nfa_dm_enable(tNFA_DM_MSG* p_data);
-bool nfa_dm_disable(tNFA_DM_MSG* p_data);
-bool nfa_dm_set_config(tNFA_DM_MSG* p_data);
-bool nfa_dm_get_config(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_request_excl_rf_ctrl(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_release_excl_rf_ctrl(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_enable_polling(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_disable_polling(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_enable_listening(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_disable_listening(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_send_raw_frame(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_start_rf_discovery(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_stop_rf_discovery(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_set_rf_disc_duration(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_select(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_update_rf_params(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_start_removal_detection(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_deactivate(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_power_off_sleep(tNFA_DM_MSG* p_data);
-bool nfa_dm_ndef_reg_hdlr(tNFA_DM_MSG* p_data);
-bool nfa_dm_ndef_dereg_hdlr(tNFA_DM_MSG* p_data);
-
-bool nfa_dm_act_reg_vsc(tNFA_DM_MSG* p_data);
-bool nfa_dm_act_send_vsc(tNFA_DM_MSG* p_data);
-uint16_t nfa_dm_act_get_rf_disc_duration();
-bool nfa_dm_act_disable_timeout(tNFA_DM_MSG* p_data);
-
-bool nfa_dm_set_power_sub_state(tNFA_DM_MSG* p_data);
-
-void nfa_dm_proc_nfcc_power_mode(uint8_t nfcc_power_mode);
-
-/* Main function prototypes */
-bool nfa_dm_evt_hdlr(NFC_HDR* p_msg);
-void nfa_dm_sys_enable(void);
-void nfa_dm_sys_disable(void);
-tNFA_STATUS nfa_dm_check_set_config(uint8_t tlv_list_len, uint8_t* p_tlv_list,
- bool app_init);
-
-void nfa_dm_conn_cback_event_notify(uint8_t event, tNFA_CONN_EVT_DATA* p_data);
-
-/* Discovery function prototypes */
-void nfa_dm_disc_sm_execute(tNFA_DM_RF_DISC_SM_EVENT event,
- tNFA_DM_RF_DISC_DATA* p_data);
-tNFA_HANDLE nfa_dm_add_rf_discover(tNFA_DM_DISC_TECH_PROTO_MASK disc_mask,
- tNFA_DM_DISC_HOST_ID host_id,
- tNFA_DISCOVER_CBACK* p_disc_cback);
-void nfa_dm_delete_rf_discover(tNFA_HANDLE handle);
-void nfa_dm_start_excl_discovery(tNFA_TECHNOLOGY_MASK poll_tech_mask,
- tNFA_LISTEN_CFG* p_listen_cfg,
- tNFA_DISCOVER_CBACK* p_disc_cback);
-void nfa_dm_rel_excl_rf_control_and_notify(void);
-void nfa_dm_stop_excl_discovery(void);
-void nfa_dm_disc_new_state(tNFA_DM_RF_DISC_STATE new_state);
-
-void nfa_dm_start_rf_discover(void);
-void nfa_dm_rf_discover_select(uint8_t rf_disc_id, tNFA_NFC_PROTOCOL protocol,
- tNFA_INTF_TYPE rf_interface);
-bool nfa_dm_rf_removal_detection(uint8_t waiting_time);
-tNFA_STATUS nfa_dm_rf_deactivate(tNFA_DEACTIVATE_TYPE deactivate_type);
-bool nfa_dm_is_protocol_supported(tNFA_NFC_PROTOCOL protocol, uint8_t sel_res);
-bool nfa_dm_is_active(void);
-tNFC_STATUS nfa_dm_disc_sleep_wakeup(void);
-tNFC_STATUS nfa_dm_disc_start_kovio_presence_check(void);
-bool nfa_dm_is_raw_frame_session(void);
-
-bool nfa_dm_get_nfc_secure();
-void nfa_dm_get_tech_route_block(uint8_t* listen_techmask, bool* enable);
-void nfa_dm_start_rf_intf_ext(tNFA_INTF_EXT_TYPE extension, uint8_t* p_data,
- uint8_t len);
-void nfa_dm_start_wireless_power_transfer(uint8_t power_adj_req,
- uint8_t wpt_time_int);
-bool nfa_dm_act_change_discovery_tech(tNFA_DM_MSG* p_data);
-
-#if (NFC_NFCEE_INCLUDED == FALSE)
-#define nfa_ee_get_tech_route(ps, ha) \
- memset(ha, NFC_DH_ID, NFA_DM_MAX_TECH_ROUTE);
-#endif
-
-std::string nfa_dm_nfc_revt_2_str(tNFC_RESPONSE_EVT event);
-
-#endif /* NFA_DM_INT_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_dta_int.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_dta_int.h
deleted file mode 100755
index 3eccd3b..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_dta_int.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2003-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 is the private interface file for the NFA DTA
- *
- ******************************************************************************/
-#ifndef NFA_DTA_INT_H
-#define NFA_DTA_INT_H
-
-#include "ce_api.h"
-#include "nfa_dta_api.h"
-#include "nfa_sys.h"
-#include "nfa_sys_int.h"
-#include "nfc_api.h"
-#include "rw_api.h"
-
-#if (NFA_DTA_INCLUDED == TRUE)
-
-/*****************************************************************************
-** DTA definitions
-*****************************************************************************/
-
-#define NFA_DTA_DISCOVER_PARAMS_MAX 6
-
-#define NFA_DTA_SCRATCH_BUF_SIZE T3T_MSG_BLOCKSIZE
-
-#ifndef NFA_DTA_DEFAULT_CO_OUT_DSAP
-/* Default SAP[LT,CO-OUT-DEST] if SDP was not performed to get SAP from the LT
- */
-#define NFA_DTA_DEFAULT_CO_OUT_DSAP 0x12
-#endif
-
-/*****************************************************************************
- * DTA state machine definitions
- *****************************************************************************/
-
-typedef struct {
- bool tp_continue; /* NFA_DTA_CFG_TP_CONTINUE */
- tNFA_DTA_FL_POLL_LISTEN poll_listen; /* NFA_DTA_CFG_POLL_LISTEN */
- bool t4at_nfcdep_priority; /* NFA_DTA_CFG_T4AT_NFCDEP_PRIORITY */
- bool reactivation; /* NFA_DTA_CFG_REACTIVATION */
- uint16_t total_duration; /* NFA_DTA_CFG_TOTAL_DURATION */
- tNFA_DTA_EMVCO_PCD_MODE emvco_pcd_mode; /* NFA_DTA_CFG_EMVCO_PCD */
-} tNFA_DTA_CONFIG;
-
-/*****************************************************************************
- * DTA state machine definitions
- *****************************************************************************/
-/* DTA events */
-enum {
- /* device manager local device API events */
- NFA_DTA_API_ENABLE_EVT = NFA_SYS_EVT_START(NFA_ID_DTA),
- NFA_DTA_API_START_EVT,
- NFA_DTA_DATA_CBACK_EVT,
-
- NFA_DTA_MAX_EVT
-};
-
-/* data type for NFA_DTA_API_ENABLE_EVT */
-typedef struct {
- NFC_HDR hdr;
- bool auto_start;
- tNFA_DTA_CBACK* p_cback;
-} tNFA_DTA_API_ENABLE;
-
-/* data type for NFA_DTA_API_START_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint16_t pattern_number;
- uint8_t tlv_len;
- uint8_t* p_tlv_params;
-} tNFA_DTA_API_START;
-
-/* data type for NFA_DTA_API_CONFIG */
-typedef struct {
- NFC_HDR hdr;
- tNFA_DTA_CFG_ITEM item;
- tNFA_DTA_CFG cfg_data;
-} tNFA_DTA_API_CONFIG;
-
-/* data type for NFA_DTA_DATA_CBACK_EVT */
-typedef struct {
- uint8_t event;
- tRW_DATA data;
-} tNFA_DTA_RW_DATA;
-
-typedef struct {
- uint8_t event;
- tCE_DATA data;
-} tNFA_DTA_CE_DATA;
-
-typedef struct {
- tNFC_CONN_EVT event;
- tNFC_CONN data;
-} tNFA_DTA_NFCDEP_DATA;
-
-typedef uint8_t tNFA_DTA_LLCP_EVT;
-
-typedef uint8_t tNFA_DTA_DATA_TYPE;
-
-typedef struct {
- NFC_HDR hdr;
- tNFA_DTA_DATA_TYPE type;
- union {
- tNFA_DTA_RW_DATA rw;
- tNFA_DTA_CE_DATA ce;
- tNFA_DTA_NFCDEP_DATA nfcdep;
- tNFA_DTA_LLCP_EVT llcp_evt;
- } data;
-} tNFA_DTA_DATA_CBACK;
-
-/* All API message type */
-typedef union {
- NFC_HDR hdr;
- tNFA_DTA_API_ENABLE enable;
- tNFA_DTA_API_CONFIG cfg;
- tNFA_DTA_API_START start;
- tNFA_DTA_DATA_CBACK data_cback;
-} tNFA_DTA_MSG;
-
-typedef uint8_t tNFA_DTA_STATE;
-
-typedef uint8_t tNFA_DTA_SUBSTATE;
-
-/*****************************************************************************
- * DTA control block definitions
- *****************************************************************************/
-
-/* NDEF buffer definitions */
-enum { NFA_DTA_BUF_MAX };
-
-typedef struct {
- uint8_t* p_data;
- uint32_t max_size;
- uint32_t cur_size;
- uint32_t offset; /* current read/write offset */
-} tNFA_DTA_BUF_CB;
-
-/* DTA test step command */
-typedef tNFC_STATUS (*tNFA_DTA_CMD_FCN)(void*);
-
-/* DTA control block */
-typedef struct {
- uint32_t dta_flags; /* dta_flags must be first item in structure (statically
- initialized to 0 on startup) */
-
- /* Configuration */
- tNFA_DTA_CONFIG cfg;
-
- /* DTA State Machine */
- tNFA_DTA_STATE state;
- tNFA_DTA_SUBSTATE substate; /* Current protocol-specific sub-state */
- tNFA_DTA_CBACK* p_cback; /* Applicatation for DTA event notification */
-
- /* DTA test parameters */
- uint16_t pattern_number;
- uint16_t pattern_number_old;
-
- /* Discovery Parameters */
- uint8_t disc_state;
- uint8_t disc_params_num;
- tNFC_DISCOVER_PARAMS disc_params[NFA_DTA_DISCOVER_PARAMS_MAX];
-
- /* Activation parameters */
- tNFC_ACTIVATE_DEVT activate_params;
- uint8_t cur_protocol_rank; /* preference ranking of currently discovered
- protocol */
-
- tRW_CBACK* p_rw_cback;
- tCE_CBACK* p_ce_cback;
-
- TIMER_LIST_ENT
- protocol_timer; /* timer for the activated protocol if needed */
-
- uint8_t t4t_ce_app; /* T4T listen mode test application */
- tCE_T4T_AID_HANDLE
- t4t_dta_aid_hdl; /* T4T registration handle for proprietary dta aid */
- tCE_T4T_AID_HANDLE
- t4t_prop_aid_hdl; /* T4T registration handle for proprietary aid */
- uint8_t nfc_dep_wt;
-
- tNFA_HANDLE snep_server_handle;
- tNFA_HANDLE snep_server_conn_handle;
- tNFA_HANDLE snep_client_handle;
-
- uint8_t* p_snep_short_ndef;
- uint32_t snep_short_ndef_size;
- uint8_t* p_snep_long_ndef;
- uint32_t snep_long_ndef_size;
-
- /* DTA buffer for NDEF read/write */
- tNFA_DTA_BUF_CB buf_cb[NFA_DTA_BUF_MAX];
- uint32_t ndef_size; /* Size of NDEF message from NDEF detection */
-
- /* Scratch buffer for miscellaneous use */
- uint8_t scratch_buf[NFA_DTA_SCRATCH_BUF_SIZE];
-
- /* DTA Test command table */
- tNFA_DTA_CMD_FCN*
- p_cur_cmd_tbl; /* Current table of commands for current test */
- uint8_t cur_cmd_idx;
-} tNFA_DTA_CB;
-extern tNFA_DTA_CB nfa_dta_cb;
-
-/* NFA_SYS info for DTA */
-extern const tNFA_SYS_REG nfa_dta_sys_reg;
-
-/* DTA startup setconfig parameters */
-extern uint8_t* p_nfa_dta_start_up_cfg;
-extern uint8_t nfa_dta_start_up_cfg_len;
-
-/*****************************************************************************
- * DTA internal function protoytpes
- *****************************************************************************/
-
-extern uint8_t* p_nfa_dta_brcm_start_up_cfg;
-extern uint8_t nfa_dta_brcm_start_up_cfg_len;
-extern uint8_t* p_nfa_dta_start_up_vsc_cfg;
-
-#endif /* (NFA_DTA_INCLUDED == TRUE) */
-#endif /* NFA_DTA_INT_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ee_api.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ee_api.h
deleted file mode 100755
index 4e6ec99..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ee_api.h
+++ /dev/null
@@ -1,638 +0,0 @@
-/******************************************************************************
- *
- * 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.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * NFA interface to NFCEE
- *
- ******************************************************************************/
-#ifndef NFA_EE_API_H
-#define NFA_EE_API_H
-
-#include "nfa_api.h"
-#include "nfc_api.h"
-#include "nfc_target.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-/* 16 per ISO 7816 specification */
-#define NFA_MAX_AID_LEN NFC_MAX_AID_LEN
-extern const uint8_t NFA_REMOVE_ALL_AID[];
-#define NFA_REMOVE_ALL_AID_LEN (0x08)
-
-/* NFA EE callback events */
-enum {
- NFA_EE_DISCOVER_EVT, /* The status for NFA_EeDiscover () */
- NFA_EE_REGISTER_EVT, /* The status for NFA_EeRegister () */
- NFA_EE_DEREGISTER_EVT, /* The status for NFA_EeDeregister () */
- NFA_EE_MODE_SET_EVT, /* The status for activating or deactivating an NFCEE */
- NFA_EE_ADD_AID_EVT, /* The status for adding an AID to a routing table entry
- */
- NFA_EE_REMOVE_AID_EVT, /* The status for removing an AID from a routing table
- */
- NFA_EE_ADD_SYSCODE_EVT, /* The status for adding an System Code to a routing
- table entry */
- NFA_EE_REMOVE_SYSCODE_EVT, /* The status for removing an System Code from
- routing table */
- NFA_EE_REMAINING_SIZE_EVT, /* The remaining size of the Listen Mode Routing
- Table */
- NFA_EE_SET_TECH_CFG_EVT, /* The status for setting the routing based on RF
- tech. */
- NFA_EE_CLEAR_TECH_CFG_EVT, /* The status for clearing the routing based on RF
- tech. */
-
- NFA_EE_SET_PROTO_CFG_EVT, /* The status for setting the routing based on
- protocols */
- NFA_EE_CLEAR_PROTO_CFG_EVT, /* The status for clearing the routing based on
- protocols */
-
- NFA_EE_UPDATED_EVT, /* The status for NFA_EeUpdateNow */
- NFA_EE_CONNECT_EVT, /* Result of NFA_EeConnect */
- NFA_EE_DATA_EVT, /* Received data from NFCEE. */
- NFA_EE_DISCONNECT_EVT, /* NFCEE connection closed. */
- NFA_EE_NEW_EE_EVT, /* A new NFCEE is discovered */
- NFA_EE_ACTION_EVT, /* An action happened in NFCEE */
- NFA_EE_DISCOVER_REQ_EVT, /* NFCEE Discover Request Notification */
- NFA_EE_ENABLED_EVT, /* NFCEE EEs after active EE */
- NFA_EE_PWR_AND_LINK_CTRL_EVT, /* NFCEE power and link ctrl */
- NFA_EE_NO_MEM_ERR_EVT, /* Error - out of GKI buffers */
- NFA_EE_NO_CB_ERR_EVT /* Error - Can not find control block or wrong state */
-};
-typedef uint8_t tNFA_EE_EVT;
-
-/* tNFA_NFCEE_INTERFACE values */
-/* HCI Access Interface*/
-#define NFA_EE_INTERFACE_HCI_ACCESS NFC_NFCEE_INTERFACE_HCI_ACCESS
-typedef uint8_t tNFA_EE_INTERFACE;
-
-typedef uint8_t tNFA_EE_TAG;
-
-/* for NFA_EeModeSet () */
-#define NFA_EE_MD_ACTIVATE NFC_MODE_ACTIVATE
-#define NFA_EE_MD_DEACTIVATE NFC_MODE_DEACTIVATE
-typedef uint8_t tNFA_EE_MD;
-
-/* The device is on */
-#define NFA_EE_PWR_STATE_ON 0x01
-/* The device is switched off */
-#define NFA_EE_PWR_STATE_SWITCH_OFF 0x02
-/* The device's battery is removed */
-#define NFA_EE_PWR_STATE_BATT_OFF 0x04
-typedef uint8_t tNFA_EE_PWR_STATE;
-
-/* NFCEE connected and inactive */
-#define NFA_EE_STATUS_INACTIVE NFC_NFCEE_STATUS_INACTIVE
-/* NFCEE connected and active */
-#define NFA_EE_STATUS_ACTIVE NFC_NFCEE_STATUS_ACTIVE
-/* NFCEE removed */
-#define NFA_EE_STATUS_REMOVED NFC_NFCEE_STATUS_REMOVED
-
-/* waiting for response from NFCC */
-#define NFA_EE_STATUS_PENDING 0x10
-typedef uint8_t tNFA_EE_STATUS;
-
-/* additional NFCEE Info */
-typedef struct {
- tNFA_EE_TAG tag;
- uint8_t len;
- uint8_t info[NFC_MAX_EE_INFO];
-} tNFA_EE_TLV;
-
-typedef struct {
- tNFA_HANDLE ee_handle; /* handle for NFCEE oe DH */
- tNFA_EE_STATUS ee_status; /* The NFCEE status */
- uint8_t num_interface; /* number of NFCEE interface*/
- tNFA_EE_INTERFACE
- ee_interface[NFC_MAX_EE_INTERFACE]; /* NFCEE supported interface */
- uint8_t num_tlvs; /* number of TLVs */
- tNFA_EE_TLV ee_tlv[NFC_MAX_EE_TLVS]; /* the TLV */
- uint8_t ee_power_supply_status; /* The NFCEE Power supply */
- tNFA_NFC_PROTOCOL la_protocol; /* Listen A protocol */
- tNFA_NFC_PROTOCOL lb_protocol; /* Listen B protocol */
- tNFA_NFC_PROTOCOL lf_protocol; /* Listen F protocol */
-} tNFA_EE_INFO;
-
-typedef struct {
- tNFA_STATUS status; /* NFA_STATUS_OK is successful */
- uint8_t num_ee; /* number of NFCEEs found */
- tNFA_EE_INFO ee_info[NFA_EE_MAX_EE_SUPPORTED]; /*NFCEE information */
-} tNFA_EE_DISCOVER;
-
-typedef struct {
- tNFA_HANDLE ee_handle; /* Handle of NFCEE */
- tNFA_STATUS status; /* NFA_STATUS_OK is successful */
- tNFA_EE_INTERFACE
- ee_interface; /* NFCEE interface associated with this connection */
-} tNFA_EE_CONNECT;
-
-typedef tNFC_EE_TRIGGER tNFA_EE_TRIGGER;
-
-/* Union of NFCEE action parameter depending on the associated trigger */
-typedef union {
- tNFA_NFC_PROTOCOL protocol; /* NFA_EE_TRGR_RF_PROTOCOL: the protocol that
- triggers this event */
- tNFC_RF_TECH technology; /* NFA_EE_TRGR_RF_TECHNOLOGY:the technology that
- triggers this event */
- tNFC_AID aid; /* NFA_EE_TRGR_SELECT : the AID in the received SELECT AID
- command */
- tNFC_APP_INIT app_init; /* NFA_EE_TRGR_APP_INIT: The information for the
- application initiated trigger */
-} tNFA_EE_ACTION_PARAM;
-
-typedef struct {
- tNFA_HANDLE ee_handle; /* Handle of NFCEE */
- tNFA_EE_TRIGGER trigger; /* the trigger of this event */
- tNFA_EE_ACTION_PARAM param;
-} tNFA_EE_ACTION;
-
-typedef struct {
- tNFA_HANDLE ee_handle; /* Handle of NFCEE */
- tNFA_STATUS status; /* NFA_STATUS_OK is successful */
- tNFA_EE_STATUS ee_status; /* The NFCEE status */
-} tNFA_EE_MODE_SET;
-
-typedef struct {
- tNFA_HANDLE ee_handle; /* Handle of MFCEE */
- tNFA_NFC_PROTOCOL la_protocol; /* Listen A protocol */
- tNFA_NFC_PROTOCOL lb_protocol; /* Listen B protocol */
- tNFA_NFC_PROTOCOL lf_protocol; /* Listen F protocol */
- tNFA_NFC_PROTOCOL lbp_protocol; /* Listen B' protocol */
-} tNFA_EE_DISCOVER_INFO;
-
-/* Data for NFA_EE_DISCOVER_REQ_EVT */
-typedef struct {
- uint8_t status; /* NFA_STATUS_OK if successful */
- uint8_t num_ee; /* number of MFCEE information */
- tNFA_EE_DISCOVER_INFO ee_disc_info[NFA_EE_MAX_EE_SUPPORTED -
- 1]; /* NFCEE DISCOVER Request info */
-} tNFA_EE_DISCOVER_REQ;
-
-/* Data for NFA_EE_DATA_EVT */
-typedef struct {
- tNFA_HANDLE handle; /* Connection handle */
- uint16_t len; /* Length of data */
- uint8_t* p_buf; /* Data buffer */
-} tNFA_EE_DATA;
-
-/* Union of all EE callback structures */
-typedef union {
- tNFA_STATUS
- status; /* NFA_STATUS_OK is successful; otherwise NFA_STATUS_FAILED */
- tNFA_EE_DATA data;
- tNFA_HANDLE handle;
- tNFA_EE_DISCOVER ee_discover;
- tNFA_STATUS ee_register;
- tNFA_STATUS deregister;
- tNFA_STATUS add_aid;
- tNFA_STATUS remove_aid;
- tNFA_STATUS add_sc;
- tNFA_STATUS remove_sc;
- tNFA_STATUS set_tech;
- tNFA_STATUS clear_tech;
- tNFA_STATUS set_proto;
- tNFA_STATUS clear_proto;
- uint16_t size;
- tNFA_EE_CONNECT connect;
- tNFA_EE_ACTION action;
- tNFA_EE_MODE_SET mode_set;
- tNFA_EE_INFO new_ee;
- tNFA_EE_DISCOVER_REQ discover_req;
-} tNFA_EE_CBACK_DATA;
-
-/* EE callback */
-typedef void(tNFA_EE_CBACK)(tNFA_EE_EVT event, tNFA_EE_CBACK_DATA* p_data);
-
-/*****************************************************************************
-** External Function Declarations
-*****************************************************************************/
-
-/*******************************************************************************
-**
-** Function NFA_EeDiscover
-**
-** Description This function retrieves the NFCEE information from NFCC.
-** The NFCEE information is reported in NFA_EE_DISCOVER_EVT.
-**
-** This function may be called when a system supports removable
-** NFCEEs,
-**
-** Returns NFA_STATUS_OK if information is retrieved successfully
-** NFA_STATUS_FAILED If wrong state (retry later)
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeDiscover(tNFA_EE_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFA_EeGetInfo
-**
-** Description This function retrieves the NFCEE information from NFA.
-** The actual number of NFCEE is returned in p_num_nfcee
-** and NFCEE information is returned in p_info
-**
-** Returns NFA_STATUS_OK if information is retrieved successfully
-** NFA_STATUS_FAILED If wrong state (retry later)
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeGetInfo(uint8_t* p_num_nfcee, tNFA_EE_INFO* p_info);
-
-/*******************************************************************************
-**
-** Function NFA_EeGetMepInfo
-**
-** Description This function retrieves the MEP NFCEE information from NFA.
-** The actual number of NFCEE is returned in p_num_nfcee
-** and NFCEE information is returned in p_info
-**
-** Returns NFA_STATUS_OK if information is retrieved successfully
-** NFA_STATUS_FAILED If wrong state (retry later)
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeGetMepInfo(uint8_t* p_num_nfcee, tNFA_EE_INFO* p_info);
-
-/*******************************************************************************
-**
-** Function NFA_EeRegister
-**
-** Description This function registers a callback function to receive the
-** events from NFA-EE module.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeRegister(tNFA_EE_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFA_EeDeregister
-**
-** Description This function de-registers the callback function
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeDeregister(tNFA_EE_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFA_EeModeSet
-**
-** Description This function is called to activate
-** (mode = NFA_EE_MD_ACTIVATE) or deactivate
-** (mode = NFA_EE_MD_DEACTIVATE) the NFCEE identified by the
-** given ee_handle. The result of this operation is reported
-** with the NFA_EE_MODE_SET_EVT.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeModeSet(tNFA_HANDLE ee_handle, tNFA_EE_MD mode);
-
-/*******************************************************************************
-**
-** Function NFA_EeSetDefaultTechRouting
-**
-** Description This function is called to add, change or remove the
-** default routing based on RF technology in the listen mode
-** routing table for the given ee_handle. The status of this
-** operation is reported as the NFA_EE_SET_TECH_CFG_EVT.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Note: NFA_EeUpdateNow() should be called after last NFA-EE
-** function to change the listen mode routing is called.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeSetDefaultTechRouting(
- tNFA_HANDLE ee_handle, tNFA_TECHNOLOGY_MASK technologies_switch_on,
- tNFA_TECHNOLOGY_MASK technologies_switch_off,
- tNFA_TECHNOLOGY_MASK technologies_battery_off,
- tNFA_TECHNOLOGY_MASK technologies_screen_lock,
- tNFA_TECHNOLOGY_MASK technologies_screen_off,
- tNFA_TECHNOLOGY_MASK technologies_screen_off_lock);
-
-/*******************************************************************************
-**
-** Function NFA_EeClearDefaultTechRouting
-**
-** Description This function is called to remove the
-** default routing based on RF technology in the listen mode
-** routing table for the given ee_handle. The status of this
-** operation is reported as the NFA_EE_CLEAR_TECH_CFG_EVT.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Note: NFA_EeUpdateNow() should be called after last NFA-EE
-** function to change the listen mode routing is called.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeClearDefaultTechRouting(
- tNFA_HANDLE ee_handle, tNFA_TECHNOLOGY_MASK clear_technology);
-
-/*******************************************************************************
-**
-** Function NFA_EeSetDefaultProtoRouting
-**
-** Description This function is called to add, change or remove the
-** default routing based on Protocol in the listen mode routing
-** table for the given ee_handle. The status of this
-** operation is reported as the NFA_EE_SET_PROTO_CFG_EVT.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Note: NFA_EeUpdateNow() should be called after last NFA-EE
-** function to change the listen mode routing is called.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeSetDefaultProtoRouting(
- tNFA_HANDLE ee_handle, tNFA_PROTOCOL_MASK protocols_switch_on,
- tNFA_PROTOCOL_MASK protocols_switch_off,
- tNFA_PROTOCOL_MASK protocols_battery_off,
- tNFA_PROTOCOL_MASK technologies_screen_lock,
- tNFA_PROTOCOL_MASK technologies_screen_off,
- tNFA_PROTOCOL_MASK technologies_screen_off_lock);
-
-/*******************************************************************************
-**
-** Function NFA_EeClearDefaultProtoRouting
-**
-** Description This function is called remove the
-** default routing based on Protocol in the listen mode routing
-** table for the given ee_handle. The status of this
-** operation is reported as the NFA_EE_CLEAR_PROTO_CFG_EVT.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Note: NFA_EeUpdateNow() should be called after last NFA-EE
-** function to change the listen mode routing is called.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeClearDefaultProtoRouting(
- tNFA_HANDLE ee_handle, tNFA_PROTOCOL_MASK clear_protocol);
-
-/*******************************************************************************
-**
-** Function NFA_EeAddAidRouting
-**
-** Description This function is called to add an AID entry in the
-** listen mode routing table in NFCC. The status of this
-** operation is reported as the NFA_EE_ADD_AID_EVT.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Note: NFA_EeUpdateNow() should be called after last NFA-EE
-** function to change the listen mode routing is called.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeAddAidRouting(tNFA_HANDLE ee_handle, uint8_t aid_len,
- uint8_t* p_aid,
- tNFA_EE_PWR_STATE power_state,
- uint8_t aidInfo);
-
-/*******************************************************************************
-**
-** Function NFA_EeRemoveAidRouting
-**
-** Description This function is called to remove the given AID entry from
-** the listen mode routing table. If the entry configures VS,
-** it is also removed. The status of this operation is reported
-** as the NFA_EE_REMOVE_AID_EVT.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Note: NFA_EeUpdateNow() should be called after last NFA-EE
-** function to change the listen mode routing is called.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeRemoveAidRouting(uint8_t aid_len, uint8_t* p_aid);
-
-/*******************************************************************************
- **
- ** Function NFA_EeAddSystemCodeRouting
- **
- ** Description This function is called to add an system code entry in the
- ** listen mode routing table in NFCC. The status of this
- ** operation is reported as the NFA_EE_ADD_SYSCODE_EVT.
- **
- ** Note: If RF discovery is started,
- ** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
- ** happen before calling this function
- **
- ** Note: NFA_EeUpdateNow() should be called after last NFA-EE
- ** function to change the listen mode routing is called.
- **
- ** Returns NFA_STATUS_OK if successfully initiated
- ** NFA_STATUS_FAILED otherwise
- ** NFA_STATUS_INVALID_PARAM If bad parameter
- **
- *******************************************************************************/
-extern tNFA_STATUS NFA_EeAddSystemCodeRouting(uint16_t systemcode,
- tNFA_HANDLE ee_handle,
- tNFA_EE_PWR_STATE power_state);
-
-/*******************************************************************************
-**
-** Function NFA_EeRemoveSystemCodeRouting
-**
-** Description This function is called to remove the given System Code
-*based entry from
-** the listen mode routing table. The status of this operation
-*is reported
-** as the NFA_EE_REMOVE_SYSCODE_EVT.
-**
-** Note: If RF discovery is started,
-** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
-** happen before calling this function
-**
-** Note: NFA_EeUpdateNow() should be called after last NFA-EE
-** function to change the listen mode routing is called.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeRemoveSystemCodeRouting(uint16_t systemcode);
-
-/*******************************************************************************
-**
-** Function NFA_GetAidTableSize
-**
-** Description This function is called to get the AID routing table size.
-**
-** Returns Maximum AID routing table size.
-**
-*******************************************************************************/
-extern uint16_t NFA_GetAidTableSize();
-
-/*******************************************************************************
-**
-** Function NFA_EeGetLmrtRemainingSize
-**
-** Description This function is called to get remaining size of the
-** Listen Mode Routing Table.
-** The remaining size is reported in NFA_EE_REMAINING_SIZE_EVT
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeGetLmrtRemainingSize(void);
-
-/*******************************************************************************
-**
-** Function NFA_EeUpdateNow
-**
-** Description This function is called to send the current listen mode
-** routing table and VS configuration to the NFCC (without
-** waiting for NFA_EE_ROUT_TIMEOUT_VAL).
-**
-** The status of this operation is
-** reported with the NFA_EE_UPDATED_EVT.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_SEMANTIC_ERROR is update is currently in progress
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeUpdateNow(void);
-
-/*******************************************************************************
-**
-** Function NFA_EeConnect
-**
-** Description Open connection to an NFCEE attached to the NFCC
-**
-** The status of this operation is
-** reported with the NFA_EE_CONNECT_EVT.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeConnect(tNFA_HANDLE ee_handle, uint8_t ee_interface,
- tNFA_EE_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFA_EeSendData
-**
-** Description Send data to the given NFCEE.
-** This function shall be called after NFA_EE_CONNECT_EVT is
-** reported and before NFA_EeDisconnect is called on the given
-** ee_handle.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeSendData(tNFA_HANDLE ee_handle, uint16_t data_len,
- uint8_t* p_data);
-
-/*******************************************************************************
-**
-** Function NFA_EeDisconnect
-**
-** Description Disconnect (if a connection is currently open) from an
-** NFCEE interface. The result of this operation is reported
-** with the NFA_EE_DISCONNECT_EVT.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeDisconnect(tNFA_HANDLE ee_handle);
-
-/*******************************************************************************
-**
-** Function NFA_EePowerAndLinkCtrl
-**
-** Description This Control Message is used by the DH to constrain the way
-** the NFCC manages the power supply and communication links
-** between the NFCC and its connected NFCEEs.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-** NFA_STATUS_INVALID_PARAM If bad parameter
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EePowerAndLinkCtrl(tNFA_HANDLE ee_handle,
- uint8_t config);
-
-/*******************************************************************************
-**
-** Function NFA_EeClearRoutingTable
-**
-** Description
-**
-** Returns NFA_STATUS_OK if successful
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_EeClearRoutingTable(bool clear_tech, bool clear_proto,
- bool clear_sc);
-
-#endif /* NFA_EE_API_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ee_int.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ee_int.h
deleted file mode 100755
index 05a3f64..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_ee_int.h
+++ /dev/null
@@ -1,633 +0,0 @@
-/******************************************************************************
- *
- * 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 is the private interface file for the NFA EE.
- *
- ******************************************************************************/
-#ifndef NFA_EE_INT_H
-#define NFA_EE_INT_H
-#include "nfa_ee_api.h"
-#include "nfa_sys.h"
-#include "nfc_api.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-/* the number of tNFA_EE_ECBs (for NFCEEs and DH) */
-#define NFA_EE_NUM_ECBS (NFA_EE_MAX_EE_SUPPORTED + 1)
-/* The index for DH in nfa_ee_cb.ee_cb[] */
-#define NFA_EE_CB_4_DH NFA_EE_MAX_EE_SUPPORTED
-#define NFA_EE_INVALID 0xFF
-/* only A, B, F, Bprime are supported by UICC now */
-#define NFA_EE_MAX_TECH_ROUTE 4
-
-#ifndef NFA_EE_AID_CFG_TAG_NAME
-/* AID */
-#define NFA_EE_AID_CFG_TAG_NAME 0x4F
-#endif
-
-/* NFA EE events */
-enum {
- NFA_EE_API_DISCOVER_EVT = NFA_SYS_EVT_START(NFA_ID_EE),
- NFA_EE_API_REGISTER_EVT,
- NFA_EE_API_DEREGISTER_EVT,
- NFA_EE_API_MODE_SET_EVT,
- NFA_EE_API_SET_TECH_CFG_EVT,
- NFA_EE_API_CLEAR_TECH_CFG_EVT,
- NFA_EE_API_SET_PROTO_CFG_EVT,
- NFA_EE_API_CLEAR_PROTO_CFG_EVT,
- NFA_EE_API_ADD_AID_EVT,
- NFA_EE_API_REMOVE_AID_EVT,
- NFA_EE_API_ADD_SYSCODE_EVT,
- NFA_EE_API_REMOVE_SYSCODE_EVT,
- NFA_EE_API_LMRT_SIZE_EVT,
- NFA_EE_API_UPDATE_NOW_EVT,
- NFA_EE_API_CONNECT_EVT,
- NFA_EE_API_SEND_DATA_EVT,
- NFA_EE_API_DISCONNECT_EVT,
- NFA_EE_API_CLEAR_ROUTING_TABLE_EVT,
- NFA_EE_API_PWR_AND_LINK_CTRL_EVT,
-
- NFA_EE_NCI_DISC_RSP_EVT,
- NFA_EE_NCI_DISC_NTF_EVT,
- NFA_EE_NCI_MODE_SET_RSP_EVT,
- NFA_EE_NCI_CONN_EVT,
- NFA_EE_NCI_DATA_EVT,
- NFA_EE_NCI_ACTION_NTF_EVT,
- NFA_EE_NCI_DISC_REQ_NTF_EVT,
- NFA_EE_NCI_WAIT_RSP_EVT,
-
- NFA_EE_ROUT_TIMEOUT_EVT,
- NFA_EE_DISCV_TIMEOUT_EVT,
- NFA_EE_CFG_TO_NFCC_EVT,
- NFA_EE_NCI_NFCEE_STATUS_NTF_EVT,
- NFA_EE_PWR_CONTROL_EVT,
- NFA_EE_MAX_EVT
-};
-
-typedef uint16_t tNFA_EE_INT_EVT;
-/* for listen mode routing table*/
-#define NFA_EE_AE_ROUTE 0x80
-#define NFA_EE_AE_VS 0x40
-
-/* NFA EE Management state */
-enum {
- NFA_EE_EM_STATE_INIT = 0,
- NFA_EE_EM_STATE_INIT_DONE,
- NFA_EE_EM_STATE_RESTORING,
- NFA_EE_EM_STATE_DISABLING,
- NFA_EE_EM_STATE_DISABLED,
-
- NFA_EE_EM_STATE_MAX
-};
-typedef uint8_t tNFA_EE_EM_STATE;
-
-/* NFA EE connection status */
-enum {
- NFA_EE_CONN_ST_NONE, /* not connected */
- NFA_EE_CONN_ST_WAIT, /* connection is initiated; waiting for ack */
- NFA_EE_CONN_ST_CONN, /* connected; can send/receive data */
- NFA_EE_CONN_ST_DISC /* disconnecting; waiting for ack */
-};
-typedef uint8_t tNFA_EE_CONN_ST;
-
-#define NFA_EE_MAX_AID_CFG_LEN (510)
-
-#ifndef ST21NFC
-// Technology A/B/F reserved: 5*3 = 15
-// Protocol ISODEP/NFCDEP/T3T reserved: 5*3 = 15
-// Extends (APDU pattern/SC)reserved: 30
-#define NFA_EE_MAX_PROTO_TECH_EXT_ROUTE_LEN 60
-#else
-// Max in ST solution:
-// Technology A/B/F reserved: 5*3 = 15
-// Protocol ISODEP/ISO-DEP blocked/NFCDEP reserved: 5*3 = 15, T3T not inserted
-// as SC inserted
-#define NFA_EE_MAX_PROTO_TECH_EXT_ROUTE_LEN 30
-#endif
-
-#define NFA_EE_SYSTEM_CODE_LEN 02
-#define NFA_EE_SYSTEM_CODE_TLV_SIZE 06
-#define NFA_EE_MAX_SYSTEM_CODE_ENTRIES 10
-#define NFA_EE_MAX_SYSTEM_CODE_CFG_LEN \
- (NFA_EE_MAX_SYSTEM_CODE_ENTRIES * NFA_EE_SYSTEM_CODE_TLV_SIZE)
-
-/* NFA EE control block flags:
- * use to indicate an API function has changed the configuration of the
- * associated NFCEE
- * The flags are cleared when the routing table/VS is updated */
-/* technology routing changed */
-#define NFA_EE_ECB_FLAGS_TECH 0x02
-/* protocol routing changed */
-#define NFA_EE_ECB_FLAGS_PROTO 0x04
-/* AID routing changed */
-#define NFA_EE_ECB_FLAGS_AID 0x08
-/* System Code routing changed */
-#define NFA_EE_ECB_FLAGS_SYSCODE 0x01
-/* VS changed */
-#define NFA_EE_ECB_FLAGS_VS 0x10
-/* Restore related */
-#define NFA_EE_ECB_FLAGS_RESTORE 0x20
-/* routing flags changed */
-#define NFA_EE_ECB_FLAGS_ROUTING 0x0E
-/* NFCEE Discover Request NTF is set */
-#define NFA_EE_ECB_FLAGS_DISC_REQ 0x40
-/* DISC_REQ N reported before DISC N */
-#define NFA_EE_ECB_FLAGS_ORDER 0x80
-typedef uint8_t tNFA_EE_ECB_FLAGS;
-
-/* part of tNFA_EE_STATUS; for internal use only */
-/* waiting for restore to full power mode to complete */
-#define NFA_EE_STATUS_RESTORING 0x20
-/* this bit is in ee_status for internal use only */
-#define NFA_EE_STATUS_INT_MASK 0x20
-#define NFA_EE_STATUS_MEP_MASK 0x40
-
-#define NFA_EMPTY_AID_TLV_LEN 0x02
-
-/* NFA-EE information for a particular NFCEE Entity (including DH) */
-typedef struct {
- tNFA_TECHNOLOGY_MASK
- tech_switch_on; /* default routing - technologies switch_on */
- tNFA_TECHNOLOGY_MASK
- tech_switch_off; /* default routing - technologies switch_off */
- tNFA_TECHNOLOGY_MASK
- tech_battery_off; /* default routing - technologies battery_off*/
- tNFA_TECHNOLOGY_MASK
- tech_screen_lock; /* default routing - technologies screen_lock*/
- tNFA_TECHNOLOGY_MASK
- tech_screen_off; /* default routing - technologies screen_off*/
- tNFA_TECHNOLOGY_MASK
- tech_screen_off_lock; /* default routing - technologies screen_off_lock*/
- tNFA_PROTOCOL_MASK
- proto_switch_on; /* default routing - protocols switch_on */
- tNFA_PROTOCOL_MASK
- proto_switch_off; /* default routing - protocols switch_off */
- tNFA_PROTOCOL_MASK
- proto_battery_off; /* default routing - protocols battery_off */
- tNFA_PROTOCOL_MASK
- proto_screen_lock; /* default routing - protocols screen_lock */
- tNFA_PROTOCOL_MASK
- proto_screen_off; /* default routing - protocols screen_off */
- tNFA_PROTOCOL_MASK
- proto_screen_off_lock; /* default routing - protocols screen_off_lock */
- tNFA_EE_CONN_ST conn_st; /* connection status */
- uint8_t conn_id; /* connection id */
- tNFA_EE_CBACK* p_ee_cback; /* the callback function */
-
- /* Each AID entry has an ssociated aid_len, aid_pwr_cfg, aid_rt_info.
- * aid_cfg[] contains AID and maybe some other VS information in TLV format
- * The first T is always NFA_EE_AID_CFG_TAG_NAME, the L is the actual AID
- * length
- * the aid_len is the total length of all the TLVs associated with this AID
- * entry
- */
- uint8_t* aid_len; /* the actual lengths in aid_cfg */
- uint8_t* aid_pwr_cfg; /* power configuration of this
- AID entry */
- uint8_t* aid_rt_info; /* route/vs info for this AID
- entry */
- uint8_t* aid_cfg; /* routing entries based on AID */
- uint8_t* aid_info; /* Aid Info Prefix/Suffix/Exact */
-
- uint8_t aid_entries; /* The number of AID entries in aid_cfg */
- uint8_t nfcee_id; /* ID for this NFCEE */
- uint8_t ee_status; /* The NFCEE status */
- uint8_t ee_old_status; /* The NFCEE status before going to low power mode */
- tNFA_EE_INTERFACE
- ee_interface[NFC_MAX_EE_INTERFACE]; /* NFCEE supported interface */
- tNFA_EE_TLV ee_tlv[NFC_MAX_EE_TLVS]; /* the TLV */
- uint8_t num_interface; /* number of Target interface */
- uint8_t num_tlvs; /* number of TLVs */
- uint8_t ee_power_supply_status; /* power supply of NFCEE*/
- tNFA_EE_ECB_FLAGS ecb_flags; /* the flags of this control block */
- tNFA_EE_INTERFACE use_interface; /* NFCEE interface used for the connection */
- tNFA_NFC_PROTOCOL la_protocol; /* Listen A protocol */
- tNFA_NFC_PROTOCOL lb_protocol; /* Listen B protocol */
- tNFA_NFC_PROTOCOL lf_protocol; /* Listen F protocol */
- tNFA_NFC_PROTOCOL lbp_protocol; /* Listen B' protocol */
- uint8_t size_mask_proto; /* the size for protocol routing */
- uint8_t size_mask_tech; /* the size for technology routing */
- uint16_t size_aid; /* the size for aid routing */
-#ifdef ST21NFC
- uint8_t size_dh_added_mask_proto; /* the size for protocol routing */
-#endif
- /*System Code Based Routing Variables*/
- uint8_t sys_code_cfg[NFA_EE_MAX_SYSTEM_CODE_ENTRIES * NFA_EE_SYSTEM_CODE_LEN];
- uint8_t sys_code_pwr_cfg[NFA_EE_MAX_SYSTEM_CODE_ENTRIES];
- uint8_t sys_code_rt_loc[NFA_EE_MAX_SYSTEM_CODE_ENTRIES];
- uint8_t sys_code_rt_loc_vs_info[NFA_EE_MAX_SYSTEM_CODE_ENTRIES];
- /* The number of SC entries in sys_code_cfg buffer*/
- uint8_t sys_code_cfg_entries;
- uint16_t size_sys_code; /* The size for system code routing */
-} tNFA_EE_ECB;
-
-/* data type for Empty AID Index and ECB */
-typedef struct {
- tNFA_EE_ECB* p_cb;
- uint16_t index;
- bool addEmptyAidRoute;
- int offset;
-} tNFA_EE_EMPTY_AID_ECB;
-
-/* data type for NFA_EE_API_DISCOVER_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_CBACK* p_cback;
-} tNFA_EE_API_DISCOVER;
-
-/* data type for NFA_EE_API_REGISTER_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_CBACK* p_cback;
-} tNFA_EE_API_REGISTER;
-
-/* data type for NFA_EE_API_DEREGISTER_EVT */
-typedef struct {
- NFC_HDR hdr;
- int index;
-} tNFA_EE_API_DEREGISTER;
-
-/* data type for NFA_EE_API_MODE_SET_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_ECB* p_cb;
- uint8_t nfcee_id;
- uint8_t mode;
-} tNFA_EE_API_MODE_SET;
-
-/* data type for NFA_EE_API_SET_TECH_CFG_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_ECB* p_cb;
- uint8_t nfcee_id;
- tNFA_TECHNOLOGY_MASK technologies_switch_on;
- tNFA_TECHNOLOGY_MASK technologies_switch_off;
- tNFA_TECHNOLOGY_MASK technologies_battery_off;
- tNFA_TECHNOLOGY_MASK technologies_screen_lock;
- tNFA_TECHNOLOGY_MASK technologies_screen_off;
- tNFA_TECHNOLOGY_MASK technologies_screen_off_lock;
-} tNFA_EE_API_SET_TECH_CFG, tNFA_EE_API_CLEAR_TECH_CFG;
-
-/* data type for NFA_EE_API_SET_PROTO_CFG_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_ECB* p_cb;
- uint8_t nfcee_id;
- tNFA_PROTOCOL_MASK protocols_switch_on;
- tNFA_PROTOCOL_MASK protocols_switch_off;
- tNFA_PROTOCOL_MASK protocols_battery_off;
- tNFA_PROTOCOL_MASK protocols_screen_lock;
- tNFA_PROTOCOL_MASK protocols_screen_off;
- tNFA_PROTOCOL_MASK protocols_screen_off_lock;
-} tNFA_EE_API_SET_PROTO_CFG, tNFA_EE_API_CLEAR_PROTO_CFG;
-
-/* data type for NFA_EE_API_ADD_AID_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_ECB* p_cb;
- uint8_t nfcee_id;
- uint8_t aid_len;
- uint8_t* p_aid;
- tNFA_EE_PWR_STATE power_state;
- uint8_t aidInfo;
-} tNFA_EE_API_ADD_AID;
-
-/* data type for NFA_EE_API_REMOVE_AID_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint8_t aid_len;
- uint8_t* p_aid;
-} tNFA_EE_API_REMOVE_AID;
-
-/* data type for NFA_EE_API_ADD_SYSCODE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_ECB* p_cb;
- uint8_t nfcee_id;
- uint16_t syscode;
- tNFA_EE_PWR_STATE power_state;
-} tNFA_EE_API_ADD_SYSCODE;
-
-/* data type for NFA_EE_API_REMOVE_SYSCODE_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint16_t syscode;
-} tNFA_EE_API_REMOVE_SYSCODE;
-
-/* data type for NFA_EE_API_LMRT_SIZE_EVT */
-typedef NFC_HDR tNFA_EE_API_LMRT_SIZE;
-
-/* data type for NFA_EE_API_CONNECT_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_ECB* p_cb;
- uint8_t nfcee_id;
- uint8_t ee_interface;
- tNFA_EE_CBACK* p_cback;
-} tNFA_EE_API_CONNECT;
-
-/* data type for NFA_EE_API_SEND_DATA_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_ECB* p_cb;
- uint8_t nfcee_id;
- uint16_t data_len;
- uint8_t* p_data;
-} tNFA_EE_API_SEND_DATA;
-
-/* data type for NFA_EE_API_DISCONNECT_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_ECB* p_cb;
- uint8_t nfcee_id;
-} tNFA_EE_API_DISCONNECT;
-
-/* data type for NFA_EE_API_PWR_AND_LINK_CTRL_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_ECB* p_cb;
- uint8_t nfcee_id;
- uint8_t config;
-} tNFA_EE_API_PWR_AND_LINK_CTRL;
-
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_ECB* p_cb;
- bool clear_tech;
- bool clear_proto;
- bool clear_sc;
-} tNFA_EE_API_CLEAR_ROUTING_TABLE;
-
-/* common data type for internal events with nfa_ee_use_cfg_cb[] as TRUE */
-typedef struct {
- NFC_HDR hdr;
- tNFA_EE_ECB* p_cb;
- uint8_t nfcee_id;
-} tNFA_EE_CFG_HDR;
-
-/* data type for NFA_EE_NCI_DISC_RSP_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFC_NFCEE_DISCOVER_REVT* p_data;
-} tNFA_EE_NCI_DISC_RSP;
-
-/* data type for NFA_EE_NCI_DISC_NTF_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFC_NFCEE_INFO_REVT* p_data;
-} tNFA_EE_NCI_DISC_NTF;
-
-/* data type for NFA_EE_NCI_MODE_SET_RSP_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFC_NFCEE_MODE_SET_REVT* p_data;
-} tNFA_EE_NCI_MODE_SET;
-
-/* data type for NFA_EE_NCI_WAIT_RSP_EVT */
-typedef struct {
- NFC_HDR hdr;
- void* p_data;
- uint8_t opcode;
-} tNFA_EE_NCI_WAIT_RSP;
-
-/* data type for NFA_EE_NCI_CONN_EVT and NFA_EE_NCI_DATA_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint8_t conn_id;
- tNFC_CONN_EVT event;
- tNFC_CONN* p_data;
-} tNFA_EE_NCI_CONN;
-
-/* data type for NFA_EE_NCI_ACTION_NTF_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFC_EE_ACTION_REVT* p_data;
-} tNFA_EE_NCI_ACTION;
-
-/* data type for NFA_EE_NCI_DISC_REQ_NTF_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFC_EE_DISCOVER_REQ_REVT* p_data;
-} tNFA_EE_NCI_DISC_REQ;
-
-/* data type for NFA_EE_NCI_NFCEE_STATUS_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFC_NFCEE_STATUS_REVT* p_data;
-} tNFA_EE_NCI_NFCEE_STATUS_NTF;
-
-/* data type for NFA_EE_NCI_NFCEE_STATUS_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFC_NFCEE_PL_CONTROL_REVT* p_data;
-} tNFA_EE_NCI_PWR_AND_LINK_CTRL_RSP;
-
-/* union of all event data types */
-typedef union {
- NFC_HDR hdr;
- tNFA_EE_CFG_HDR cfg_hdr;
- tNFA_EE_API_DISCOVER ee_discover;
- tNFA_EE_API_REGISTER ee_register;
- tNFA_EE_API_DEREGISTER deregister;
- tNFA_EE_API_MODE_SET mode_set;
- tNFA_EE_API_SET_TECH_CFG set_tech;
- tNFA_EE_API_CLEAR_TECH_CFG clear_tech;
- tNFA_EE_API_SET_PROTO_CFG set_proto;
- tNFA_EE_API_CLEAR_PROTO_CFG clear_proto;
- tNFA_EE_API_ADD_AID add_aid;
- tNFA_EE_API_REMOVE_AID rm_aid;
- tNFA_EE_API_ADD_SYSCODE add_syscode;
- tNFA_EE_API_REMOVE_SYSCODE rm_syscode;
- tNFA_EE_API_LMRT_SIZE lmrt_size;
- tNFA_EE_API_CONNECT connect;
- tNFA_EE_API_SEND_DATA send_data;
- tNFA_EE_API_DISCONNECT disconnect;
- tNFA_EE_API_CLEAR_ROUTING_TABLE clear_routing_table;
- tNFA_EE_API_PWR_AND_LINK_CTRL pwr_and_link_ctrl;
- tNFA_EE_NCI_DISC_RSP disc_rsp;
- tNFA_EE_NCI_DISC_NTF disc_ntf;
- tNFA_EE_NCI_MODE_SET mode_set_rsp;
- tNFA_EE_NCI_WAIT_RSP wait_rsp;
- tNFA_EE_NCI_CONN conn;
- tNFA_EE_NCI_ACTION act;
- tNFA_EE_NCI_DISC_REQ disc_req;
- tNFA_EE_NCI_NFCEE_STATUS_NTF nfcee_status_ntf;
- tNFA_EE_NCI_PWR_AND_LINK_CTRL_RSP ncfee_pwr_and_link_ctrl_rsp;
-} tNFA_EE_MSG;
-
-/* type for State Machine (SM) action functions */
-typedef void (*tNFA_EE_SM_ACT)(tNFA_EE_MSG* p_data);
-
-/*****************************************************************************
-** control block
-*****************************************************************************/
-#define NFA_EE_CFGED_UPDATE_NOW 0x80
-/* either switch off or battery off is configured */
-#define NFA_EE_CFGED_OFF_ROUTING 0x40
-
-/* the following status are the definition used in ee_cfg_sts */
-#define NFA_EE_STS_CHANGED_ROUTING 0x01
-#define NFA_EE_STS_CHANGED 0x0f
-#define NFA_EE_STS_PREV_ROUTING 0x10
-#define NFA_EE_STS_PREV 0xf0
-
-/* need to report NFA_EE_UPDATED_EVT */
-#define NFA_EE_WAIT_UPDATE 0x10
-/* waiting for the rsp of set routing commands */
-#define NFA_EE_WAIT_UPDATE_RSP 0x20
-#define NFA_EE_WAIT_UPDATE_ALL 0xF0
-
-typedef uint8_t tNFA_EE_WAIT;
-
-/* set this bit when waiting for HCI to finish the initialization process in
- * NFA_EE_EM_STATE_RESTORING */
-#define NFA_EE_FLAG_WAIT_HCI 0x01
-/* set this bit when EE needs to notify the p_enable_cback at the end of NFCEE
- * discover process in NFA_EE_EM_STATE_RESTORING */
-#define NFA_EE_FLAG_NOTIFY_HCI 0x02
-/* set this bit when gracefully disable with outstanding NCI connections */
-#define NFA_EE_FLAG_WAIT_DISCONN 0x04
-typedef uint8_t tNFA_EE_FLAGS;
-
-/* NFCEE DISCOVER in progress */
-#define NFA_EE_DISC_STS_ON 0x00
-/* disable NFCEE DISCOVER */
-#define NFA_EE_DISC_STS_OFF 0x01
-/* received NFCEE DISCOVER REQ NTF */
-#define NFA_EE_DISC_STS_REQ 0x02
-/* received NFA_EE_MODE_SET_COMPLETE */
-#define NFA_EE_MODE_SET_COMPLETE 0x03
-/* initialize EE_RECOVERY */
-#define NFA_EE_RECOVERY_INIT 0x04
-/* update ee config during EE_RECOVERY */
-#define NFA_EE_RECOVERY_REDISCOVERED 0x05
-typedef uint8_t tNFA_EE_DISC_STS;
-
-typedef void(tNFA_EE_ENABLE_DONE_CBACK)(tNFA_EE_DISC_STS status);
-
-/* NFA EE Management control block */
-typedef struct {
- tNFA_EE_ECB ecb[NFA_EE_NUM_ECBS]; /* control block for DH and NFCEEs */
- TIMER_LIST_ENT timer; /* timer to send info to NFCC */
- TIMER_LIST_ENT discv_timer; /* timer to end NFCEE discovery */
- tNFA_EE_CBACK* p_ee_cback[NFA_EE_MAX_CBACKS]; /* to report EE events */
- tNFA_EE_CBACK* p_ee_disc_cback; /* to report EE discovery result */
- tNFA_EE_ENABLE_DONE_CBACK*
- p_enable_cback; /* callback to notify on enable done*/
- tNFA_EE_EM_STATE em_state; /* NFA-EE state initialized or not */
- uint8_t wait_rsp; /* num of NCI rsp expected (update) */
- uint8_t num_ee_expecting; /* number of ee_info still expecting*/
- uint8_t cur_ee; /* the number of ee_info in cb */
- uint8_t ee_cfged; /* the bit mask of configured ECBs */
- uint8_t ee_cfg_sts; /* configuration status */
- tNFA_EE_WAIT ee_wait_evt; /* Pending event(s) to be reported */
- tNFA_EE_FLAGS ee_flags; /* flags */
- uint8_t route_block_control; /* controls route block feature */
- bool isDiscoveryStopped; /* discovery status */
- uint8_t nfcee_id; /* NFCEE ID */
- uint8_t mode; /* Mode */
-} tNFA_EE_CB;
-
-/* Order of Routing entries in Routing Table */
-#define NCI_ROUTE_ORDER_AID 0x01 /* AID routing order */
-#define NCI_ROUTE_ORDER_SYS_CODE 0x03 /* System Code routing order*/
-#define NCI_ROUTE_ORDER_PROTOCOL 0x04 /* Protocol routing order*/
-#define NCI_ROUTE_ORDER_TECHNOLOGY 0x05 /* Technology routing order*/
-
-/*****************************************************************************
-** External variables
-*****************************************************************************/
-
-/* NFA EE control block */
-extern tNFA_EE_CB nfa_ee_cb;
-
-/*****************************************************************************
-** External functions
-*****************************************************************************/
-/* function prototypes - exported from nfa_ee_main.c */
-void nfa_ee_sys_enable(void);
-void nfa_ee_sys_disable(void);
-
-/* event handler function type */
-bool nfa_ee_evt_hdlr(NFC_HDR* p_msg);
-void nfa_ee_proc_nfcc_power_mode(uint8_t nfcc_power_mode);
-#if (NFC_NFCEE_INCLUDED == TRUE)
-void nfa_ee_get_tech_route(uint8_t power_state, uint8_t* p_handles);
-#endif
-void nfa_ee_proc_evt(tNFC_RESPONSE_EVT event, void* p_data);
-tNFA_EE_ECB* nfa_ee_find_ecb(uint8_t nfcee_id);
-tNFA_EE_ECB* nfa_ee_add_mep_ecb(uint8_t nfcee_id);
-tNFA_EE_ECB* nfa_ee_find_ecb_by_conn_id(uint8_t conn_id);
-uint8_t nfa_ee_ecb_to_mask(tNFA_EE_ECB* p_cb);
-void nfa_ee_restore_one_ecb(tNFA_EE_ECB* p_cb);
-bool nfa_ee_is_active(tNFA_HANDLE nfcee_id);
-
-/* Action function prototypes - nfa_ee_act.c */
-void nfa_ee_api_discover(tNFA_EE_MSG* p_data);
-void nfa_ee_api_register(tNFA_EE_MSG* p_data);
-void nfa_ee_api_deregister(tNFA_EE_MSG* p_data);
-void nfa_ee_api_mode_set(tNFA_EE_MSG* p_data);
-void nfa_ee_api_set_tech_cfg(tNFA_EE_MSG* p_data);
-void nfa_ee_api_clear_tech_cfg(tNFA_EE_MSG* p_data);
-void nfa_ee_api_set_proto_cfg(tNFA_EE_MSG* p_data);
-void nfa_ee_api_clear_proto_cfg(tNFA_EE_MSG* p_data);
-void nfa_ee_api_add_aid(tNFA_EE_MSG* p_data);
-void nfa_ee_api_remove_aid(tNFA_EE_MSG* p_data);
-void nfa_ee_api_add_sys_code(tNFA_EE_MSG* p_data);
-void nfa_ee_api_remove_sys_code(tNFA_EE_MSG* p_data);
-void nfa_ee_api_lmrt_size(tNFA_EE_MSG* p_data);
-void nfa_ee_api_update_now(tNFA_EE_MSG* p_data);
-void nfa_ee_api_connect(tNFA_EE_MSG* p_data);
-void nfa_ee_api_send_data(tNFA_EE_MSG* p_data);
-void nfa_ee_api_disconnect(tNFA_EE_MSG* p_data);
-void nfa_ee_api_clear_routing_table(tNFA_EE_MSG* p_data);
-void nfa_ee_api_pwr_and_link_ctrl(tNFA_EE_MSG* p_data);
-void nfa_ee_report_disc_done(bool notify_sys);
-void nfa_ee_nci_disc_rsp(tNFA_EE_MSG* p_data);
-void nfa_ee_nci_disc_ntf(tNFA_EE_MSG* p_data);
-void nfa_ee_nci_mode_set_rsp(tNFA_EE_MSG* p_data);
-void nfa_ee_nci_nfcee_status_ntf(tNFA_EE_MSG* p_data);
-void nfa_ee_pwr_and_link_ctrl_rsp(tNFA_EE_MSG* p_data);
-void nfa_ee_nci_wait_rsp(tNFA_EE_MSG* p_data);
-void nfa_ee_nci_conn(tNFA_EE_MSG* p_data);
-void nfa_ee_nci_action_ntf(tNFA_EE_MSG* p_data);
-void nfa_ee_nci_disc_req_ntf(tNFA_EE_MSG* p_data);
-void nfa_ee_rout_timeout(tNFA_EE_MSG* p_data);
-void nfa_ee_discv_timeout(tNFA_EE_MSG* p_data);
-void nfa_ee_lmrt_to_nfcc(tNFA_EE_MSG* p_data);
-void nfa_ee_update_rout(void);
-void nfa_ee_report_event(tNFA_EE_CBACK* p_cback, tNFA_EE_EVT event,
- tNFA_EE_CBACK_DATA* p_data);
-tNFA_EE_ECB* nfa_ee_find_aid_offset(uint8_t aid_len, uint8_t* p_aid,
- int* p_offset, int* p_entry);
-tNFA_EE_ECB* nfa_ee_find_sys_code_offset(uint16_t sys_code, int* p_offset,
- int* p_entry);
-int nfa_ee_find_total_aid_len(tNFA_EE_ECB* p_cb, int start_entry);
-void nfa_ee_start_timer(void);
-void nfa_ee_reg_cback_enable_done(tNFA_EE_ENABLE_DONE_CBACK* p_cback);
-void nfa_ee_report_update_evt(void);
-
-extern void nfa_ee_proc_hci_info_cback(void);
-void nfa_ee_check_disable(void);
-bool nfa_ee_restore_ntf_done(void);
-void nfa_ee_check_restore_complete(void);
-int nfa_ee_find_max_aid_cfg_len(void);
-#endif /* NFA_P2P_INT_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_hci_api.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_hci_api.h
deleted file mode 100755
index 1325a2b..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_hci_api.h
+++ /dev/null
@@ -1,575 +0,0 @@
-/******************************************************************************
- *
- * 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 is the public interface file for NFA HCI, Broadcom's NFC
- * application layer for mobile phones.
- *
- ******************************************************************************/
-#ifndef NFA_HCI_API_H
-#define NFA_HCI_API_H
-
-#include "nfa_api.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-/* NFA HCI Debug constants */
-#define NFA_HCI_DEBUG_DISPLAY_CB 0
-#define NFA_HCI_DEBUG_SIM_HCI_EVENT 1
-#define NFA_HCI_DEBUG_ENABLE_LOOPBACK 101
-#define NFA_HCI_DEBUG_DISABLE_LOOPBACK 102
-
-/* NFA HCI callback events */
-#define NFA_HCI_REGISTER_EVT \
- 0x00 /* Application registered */
-/* Application deregistered */
-#define NFA_HCI_DEREGISTER_EVT 0x01
-/* Retrieved gates,pipes assoc. to application */
-#define NFA_HCI_GET_GATE_PIPE_LIST_EVT 0x02
-#define NFA_HCI_ALLOCATE_GATE_EVT \
- 0x03 /* A generic gate allocated to the application */
-#define NFA_HCI_DEALLOCATE_GATE_EVT \
- 0x04 /* A generic gate is released */
-#define NFA_HCI_CREATE_PIPE_EVT \
- 0x05 /* Pipe is created */
-#define NFA_HCI_OPEN_PIPE_EVT \
- 0x06 /* Pipe is opened / could not open */
-#define NFA_HCI_CLOSE_PIPE_EVT \
- 0x07 /* Pipe is closed / could not close */
-#define NFA_HCI_DELETE_PIPE_EVT \
- 0x08 /* Pipe is deleted */
-#define NFA_HCI_HOST_LIST_EVT \
- 0x09 /* Received list of Host from Host controller */
-/* HCI subsytem initialized */
-#define NFA_HCI_INIT_EVT 0x0A
-/* HCI subsytem exited */
-#define NFA_HCI_EXIT_EVT 0x0B
-/* Response recvd to cmd sent on app owned pipe */
-#define NFA_HCI_RSP_RCVD_EVT 0x0C
-/* Response sent on app owned pipe */
-#define NFA_HCI_RSP_SENT_EVT 0x0D
-/* Command sent on app owned pipe */
-#define NFA_HCI_CMD_SENT_EVT 0x0E
-/* Event sent on app owned pipe */
-#define NFA_HCI_EVENT_SENT_EVT 0x0F
-/* Command received on app owned pipe */
-#define NFA_HCI_CMD_RCVD_EVT 0x10
-/* Event received on app owned pipe */
-#define NFA_HCI_EVENT_RCVD_EVT 0x11
-/* Registry read command sent */
-#define NFA_HCI_GET_REG_CMD_EVT 0x12
-/* Registry write command sent */
-#define NFA_HCI_SET_REG_CMD_EVT 0x13
-/* Received response to read registry command */
-#define NFA_HCI_GET_REG_RSP_EVT 0x14
-/* Received response to write registry command */
-#define NFA_HCI_SET_REG_RSP_EVT 0x15
-/* A static pipe is added */
-#define NFA_HCI_ADD_STATIC_PIPE_EVT 0x16
-
-typedef uint8_t tNFA_HCI_EVT;
-
-/* Max application name length */
-#define NFA_MAX_HCI_APP_NAME_LEN 0x10
-/* Max HCI command length */
-#define NFA_MAX_HCI_CMD_LEN 255
-/* Max HCI event length */
-#define NFA_MAX_HCI_RSP_LEN 255
-/* Max HCI event length */
-#define NFA_MAX_HCI_EVENT_LEN 300
-/* Max HCI data length */
-#define NFA_MAX_HCI_DATA_LEN 260
-
-/* NFA HCI PIPE states */
-#define NFA_HCI_PIPE_CLOSED 0x00 /* Pipe is closed */
-#define NFA_HCI_PIPE_OPENED 0x01 /* Pipe is opened */
-
-typedef uint8_t tNFA_HCI_PIPE_STATE;
-/* Dynamic pipe control block */
-typedef struct {
- uint8_t pipe_id; /* Pipe ID */
- tNFA_HCI_PIPE_STATE pipe_state; /* State of the Pipe */
- uint8_t local_gate; /* local gate id */
- uint8_t dest_host; /* Peer host to which this pipe is connected */
- uint8_t dest_gate; /* Peer gate to which this pipe is connected */
-} tNFA_HCI_PIPE_INFO;
-
-/* Data for NFA_HCI_REGISTER_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of registration */
- tNFA_HANDLE hci_handle; /* Handle assigned to the application */
- uint8_t num_pipes; /* Number of dynamic pipes exist for the application */
- uint8_t num_gates; /* Number of generic gates exist for the application */
-} tNFA_HCI_REGISTER;
-
-/* Data for NFA_HCI_DEREGISTER_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of deregistration */
-} tNFA_HCI_DEREGISTER;
-
-/* Data for NFA_HCI_GET_GATE_PIPE_LIST_EVT */
-typedef struct {
- tNFA_STATUS status;
- uint8_t num_pipes; /* Number of dynamic pipes exist for the application */
- tNFA_HCI_PIPE_INFO
- pipe[NFA_HCI_MAX_PIPE_CB]; /* List of pipe created for the application */
- uint8_t num_gates; /* Number of generic gates exist for the application */
- uint8_t gate[NFA_HCI_MAX_GATE_CB]; /* List of generic gates allocated to the
- application */
- uint8_t num_uicc_created_pipes; /* Number of pipes created by UICC host */
- tNFA_HCI_PIPE_INFO
- uicc_created_pipe[NFA_HCI_MAX_PIPE_CB]; /* Pipe information of the UICC
- created pipe */
-} tNFA_HCI_GET_GATE_PIPE_LIST;
-
-/* Data for NFA_HCI_ALLOCATE_GATE_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of response to allocate gate request */
- uint8_t gate; /* The gate allocated to the application */
-} tNFA_HCI_ALLOCATE_GATE;
-
-/* Data for NFA_HCI_DEALLOCATE_GATE_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of response to deallocate gate request */
- uint8_t gate; /* The gate deallocated from the application */
-} tNFA_HCI_DEALLOCATE_GATE;
-
-/* Data for NFA_HCI_CREATE_PIPE_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of creating dynamic pipe for the application */
- uint8_t pipe; /* The pipe created for the application */
- uint8_t
- source_gate; /* DH host gate to which the one end of pipe is attached */
- uint8_t dest_host; /* Destination host whose gate is the other end of the pipe
- is attached to */
- uint8_t dest_gate; /* Destination host gate to which the other end of pipe is
- attached */
-} tNFA_HCI_CREATE_PIPE;
-
-/* Data for NFA_HCI_OPEN_PIPE_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of open pipe operation */
- uint8_t pipe; /* The dynamic pipe for open operation */
-} tNFA_HCI_OPEN_PIPE;
-
-/* Data for NFA_HCI_CLOSE_PIPE_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of close pipe operation */
- uint8_t pipe; /* The dynamic pipe for close operation */
-} tNFA_HCI_CLOSE_PIPE;
-
-/* Data for NFA_HCI_DELETE_PIPE_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of delete pipe operation */
- uint8_t pipe; /* The dynamic pipe for delete operation */
-} tNFA_HCI_DELETE_PIPE;
-
-/* Data for NFA_HCI_HOST_LIST_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status og get host list operation */
- uint8_t num_hosts; /* Number of hosts in the host network */
- uint8_t
- host[NFA_HCI_MAX_HOST_IN_NETWORK]; /* List of host in the host network */
-} tNFA_HCI_HOST_LIST;
-
-/* Data for NFA_HCI_RSP_RCVD_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of RSP to HCP CMD sent */
- uint8_t pipe; /* The pipe on which HCP packet is exchanged */
- uint8_t rsp_code; /* Response id */
- uint16_t rsp_len; /* Response parameter length */
- uint8_t rsp_data[NFA_MAX_HCI_RSP_LEN]; /* Response received */
-} tNFA_HCI_RSP_RCVD;
-
-/* Data for NFA_HCI_EVENT_RCVD_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of Event received */
- uint8_t pipe; /* The pipe on which HCP EVT packet is received */
- uint8_t evt_code; /* HCP EVT id */
- uint16_t evt_len; /* HCP EVT parameter length */
- uint8_t* p_evt_buf; /* HCP EVT Parameter */
-} tNFA_HCI_EVENT_RCVD;
-
-/* Data for NFA_HCI_CMD_RCVD_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of Command received */
- uint8_t pipe; /* The pipe on which HCP CMD packet is received */
- uint8_t cmd_code; /* HCP CMD id */
- uint16_t cmd_len; /* HCP CMD parameter length */
- uint8_t cmd_data[NFA_MAX_HCI_CMD_LEN]; /* HCP CMD Parameter */
-} tNFA_HCI_CMD_RCVD;
-
-/* Data for NFA_HCI_INIT_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of Enabling HCI Network */
-} tNFA_HCI_INIT;
-
-/* Data for NFA_HCI_EXIT_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of Disabling HCI Network */
-} tNFA_HCI_EXIT;
-
-/* Data for NFA_HCI_RSP_SENT_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of HCP response send operation */
-} tNFA_HCI_RSP_SENT;
-
-/* Data for NFA_HCI_CMD_SENT_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of Command send operation */
-} tNFA_HCI_CMD_SENT;
-
-/* Data for NFA_HCI_EVENT_SENT_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of Event send operation */
-} tNFA_HCI_EVENT_SENT;
-
-/* Data for NFA_HCI_ADD_STATIC_PIPE_EVT */
-typedef struct {
- tNFA_STATUS status; /* Status of adding proprietary pipe */
-} tNFA_HCI_ADD_STATIC_PIPE_EVT;
-
-/* data type for all registry-related events */
-typedef struct {
- tNFA_STATUS status; /* Status of Registry operation */
- uint8_t pipe; /* Pipe on whose registry is of interest */
- uint8_t index; /* Index of the registry operated */
- uint8_t data_len; /* length of the registry parameter */
- uint8_t reg_data[NFA_MAX_HCI_DATA_LEN]; /* Registry parameter */
-} tNFA_HCI_REGISTRY;
-
-/* Union of all hci callback structures */
-typedef union {
- tNFA_HCI_REGISTER hci_register; /* NFA_HCI_REGISTER_EVT */
- tNFA_HCI_DEREGISTER hci_deregister; /* NFA_HCI_DEREGISTER_EVT */
- tNFA_HCI_GET_GATE_PIPE_LIST gates_pipes; /* NFA_HCI_GET_GATE_PIPE_LIST_EVT */
- tNFA_HCI_ALLOCATE_GATE allocated; /* NFA_HCI_ALLOCATE_GATE_EVT */
- tNFA_HCI_DEALLOCATE_GATE deallocated; /* NFA_HCI_DEALLOCATE_GATE_EVT */
- tNFA_HCI_CREATE_PIPE created; /* NFA_HCI_CREATE_PIPE_EVT */
- tNFA_HCI_OPEN_PIPE opened; /* NFA_HCI_OPEN_PIPE_EVT */
- tNFA_HCI_CLOSE_PIPE closed; /* NFA_HCI_CLOSE_PIPE_EVT */
- tNFA_HCI_DELETE_PIPE deleted; /* NFA_HCI_DELETE_PIPE_EVT */
- tNFA_HCI_HOST_LIST hosts; /* NFA_HCI_HOST_LIST_EVT */
- tNFA_HCI_RSP_RCVD rsp_rcvd; /* NFA_HCI_RSP_RCVD_EVT */
- tNFA_HCI_RSP_SENT rsp_sent; /* NFA_HCI_RSP_SENT_EVT */
- tNFA_HCI_CMD_SENT cmd_sent; /* NFA_HCI_CMD_SENT_EVT */
- tNFA_HCI_EVENT_SENT evt_sent; /* NFA_HCI_EVENT_SENT_EVT */
- tNFA_HCI_CMD_RCVD cmd_rcvd; /* NFA_HCI_CMD_RCVD_EVT */
- tNFA_HCI_EVENT_RCVD rcvd_evt; /* NFA_HCI_EVENT_RCVD_EVT */
- tNFA_STATUS status; /* status of api command request */
- tNFA_HCI_REGISTRY registry; /* all registry-related events -
- NFA_HCI_GET_REG_CMD_EVT,
- NFA_HCI_SET_REG_CMD_EVT,
- NFA_HCI_GET_REG_RSP_EVT,
- NFA_HCI_SET_REG_RSP_EVT */
- tNFA_HCI_INIT hci_init; /* NFA_HCI_INIT_EVT */
- tNFA_HCI_EXIT hci_exit; /* NFA_HCI_EXIT_EVT */
- tNFA_HCI_ADD_STATIC_PIPE_EVT pipe_added; /* NFA_HCI_ADD_STATIC_PIPE_EVT */
-} tNFA_HCI_EVT_DATA;
-
-/* NFA HCI callback */
-typedef void(tNFA_HCI_CBACK)(tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA* p_data);
-
-/*****************************************************************************
-** External Function Declarations
-*****************************************************************************/
-
-/*******************************************************************************
-**
-** Function NFA_HciRegister
-**
-** Description This function will register an application with hci and
-** returns an application handle and provides a mechanism to
-** register a callback with HCI to receive NFA HCI event
-** notification. When the application is registered (or if an
-** error occurs), the app will be notified with
-** NFA_HCI_REGISTER_EVT. Previous session information
-** including allocated gates, created pipes and pipes states
-** will be returned as part of tNFA_HCI_REGISTER data.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciRegister(char* p_app_name, tNFA_HCI_CBACK* p_cback,
- bool b_send_conn_evts);
-
-/*******************************************************************************
-**
-** Function NFA_HciGetGateAndPipeList
-**
-** Description This function will retrieve the list of gates allocated to
-** the application and list of dynamic pipes created for the
-** application. The app will be notified with
-** NFA_HCI_GET_GATE_PIPE_LIST_EVT. List of allocated dynamic
-** gates to the application and list of pipes created by the
-** application will be returned as part of
-** tNFA_HCI_GET_GATE_PIPE_LIST data.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciGetGateAndPipeList(tNFA_HANDLE hci_handle);
-
-/*******************************************************************************
-**
-** Function NFA_HciDeregister
-**
-** Description This function is called to deregister an application
-** from HCI. The app will be notified by NFA_HCI_DEREGISTER_EVT
-** after deleting all the pipes owned by the app and
-** deallocating all the gates allocated to the app or if an
-** error occurs. The app can release the buffer provided for
-** collecting long APDUs after receiving
-** NFA_HCI_DEREGISTER_EVT. Even if deregistration fails, the
-** app has to register again to provide a new cback function
-** and event buffer for receiving long APDUs.
-**
-** Returns NFA_STATUS_OK if the application is deregistered
-** successfully
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciDeregister(char* p_app_name);
-
-/*******************************************************************************
-**
-** Function NFA_HciAllocGate
-**
-** Description This function will allocate the gate if any specified or an
-** available generic gate for the app to provide an entry point
-** for a particular service to other host or to establish
-** communication with other host. When the gate is
-** allocated (or if an error occurs), the app will be notified
-** with NFA_HCI_ALLOCATE_GATE_EVT with the gate id. The
-** allocated Gate information will be stored in non volatile
-** memory.
-**
-** Returns NFA_STATUS_OK if this API started
-** NFA_STATUS_FAILED if no generic gate is available
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciAllocGate(tNFA_HANDLE hci_handle, uint8_t gate);
-
-/*******************************************************************************
-**
-** Function NFA_HciDeallocGate
-**
-** Description This function will release the specified gate that was
-** previously allocated to the application. When the generic
-** gate is released (or if an error occurs), the app will be
-** notified with NFA_HCI_DEALLOCATE_GATE_EVT with the gate id.
-** The allocated Gate information will be deleted from non
-** volatile memory and all the associated pipes are deleted
-** by informing host controller.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_BAD_HANDLE if handle is not valid
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciDeallocGate(tNFA_HANDLE conn_handle, uint8_t gate);
-
-/*******************************************************************************
-**
-** Function NFA_HciGetHostList
-**
-** Description This function will request the host controller to return the
-** list of hosts that are present in the host network. When
-** host controller responds with the host list (or if an error
-** occurs), the app will be notified with NFA_HCI_HOST_LIST_EVT
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_BAD_HANDLE if handle is not valid
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciGetHostList(tNFA_HANDLE hci_handle);
-
-/*******************************************************************************
-**
-** Function NFA_HciCreatePipe
-**
-** Description This function is called to create a dynamic pipe with the
-** specified host. When the dynamic pipe is created (or
-** if an error occurs), the app will be notified with
-** NFA_HCI_CREATE_PIPE_EVT with the pipe id. If a pipe exists
-** between the two gates passed as argument and if it was
-** created earlier by the calling application then the pipe
-** id of the existing pipe will be returned and a new pipe
-** will not be created. After successful creation of pipe,
-** registry entry will be created for the dynamic pipe and
-** all information related to the pipe will be stored in non
-** volatile memory.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciCreatePipe(tNFA_HANDLE hci_handle,
- uint8_t source_gate_id, uint8_t dest_host,
- uint8_t dest_gate);
-
-/*******************************************************************************
-**
-** Function NFA_HciOpenPipe
-**
-** Description This function is called to open a dynamic pipe.
-** When the dynamic pipe is opened (or
-** if an error occurs), the app will be notified with
-** NFA_HCI_OPEN_PIPE_EVT with the pipe id.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciOpenPipe(tNFA_HANDLE hci_handle, uint8_t pipe);
-
-/*******************************************************************************
-**
-** Function NFA_HciGetRegistry
-**
-** Description This function requests a peer host to return the desired
-** registry field value for the gate that the pipe is on.
-**
-** When the peer host responds,the app is notified with
-** NFA_HCI_GET_REG_RSP_EVT or
-** if an error occurs in sending the command the app will be
-** notified by NFA_HCI_CMD_SENT_EVT
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciGetRegistry(tNFA_HANDLE hci_handle, uint8_t pipe,
- uint8_t reg_inx);
-
-/*******************************************************************************
-**
-** Function NFA_HciSendCommand
-**
-** Description This function is called to send a command on a pipe created
-** by the application.
-** The app will be notified by NFA_HCI_CMD_SENT_EVT if an error
-** occurs.
-** When the peer host responds,the app is notified with
-** NFA_HCI_RSP_RCVD_EVT
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciSendCommand(tNFA_HANDLE hci_handle, uint8_t pipe,
- uint8_t cmd_code, uint16_t cmd_size,
- uint8_t* p_data);
-
-/*******************************************************************************
-**
-** Function NFA_HciSendEvent
-**
-** Description This function is called to send any event on a pipe created
-** by the application.
-** The app will be notified by NFA_HCI_EVENT_SENT_EVT
-** after successfully sending the event on the specified pipe
-** or if an error occurs. The application should wait for this
-** event before releasing event buffer passed as argument.
-** If the app is expecting a response to the event then it can
-** provide response buffer for collecting the response. If it
-** provides a response buffer it should also provide response
-** timeout indicating duration validity of the response buffer.
-** Maximum of NFA_MAX_HCI_EVENT_LEN bytes APDU can be received
-** using internal buffer if no response buffer is provided by
-** the application. The app will be notified by
-** NFA_HCI_EVENT_RCVD_EVT after receiving the response event
-** or on timeout if app provided response buffer.
-** If response buffer is provided by the application, it should
-** wait for this event before releasing the response buffer.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-tNFA_STATUS NFA_HciSendEvent(tNFA_HANDLE hci_handle, uint8_t pipe,
- uint8_t evt_code, uint16_t evt_size,
- uint8_t* p_data, uint16_t rsp_size,
- uint8_t* p_rsp_buf, uint16_t rsp_timeout);
-
-/*******************************************************************************
-**
-** Function NFA_HciClosePipe
-**
-** Description This function is called to close a dynamic pipe.
-** When the dynamic pipe is closed (or
-** if an error occurs), the app will be notified with
-** NFA_HCI_CLOSE_PIPE_EVT with the pipe id.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciClosePipe(tNFA_HANDLE hci_handle, uint8_t pipe);
-
-/*******************************************************************************
-**
-** Function NFA_HciDeletePipe
-**
-** Description This function is called to delete a particular dynamic pipe.
-** When the dynamic pipe is deleted (or if an error occurs),
-** the app will be notified with NFA_HCI_DELETE_PIPE_EVT with
-** the pipe id. After successful deletion of pipe, registry
-** entry will be deleted for the dynamic pipe and all
-** information related to the pipe will be deleted from non
-** volatile memory.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_BAD_HANDLE if handle is not valid
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciDeletePipe(tNFA_HANDLE hci_handle, uint8_t pipe);
-
-/*******************************************************************************
-**
-** Function NFA_HciAddStaticPipe
-**
-** Description This function is called to add a static pipe for sending
-** 7816 APDUs. When the static pipe is added (or if an error
-** occurs), the app will be notified with
-** NFA_HCI_ADD_STATIC_PIPE_EVT with status.
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_HciAddStaticPipe(tNFA_HANDLE hci_handle, uint8_t host,
- uint8_t gate, uint8_t pipe);
-
-/*******************************************************************************
-**
-** Function NFA_HciDebug
-**
-** Description Debug function.
-**
-*******************************************************************************/
-extern void NFA_HciDebug(uint8_t action, uint8_t size, uint8_t* p_data);
-
-#endif /* NFA_P2P_API_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_hci_defs.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_hci_defs.h
deleted file mode 100755
index 2737531..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_hci_defs.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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 the NFA HCI related definitions from the
- * specification.
- *
- ******************************************************************************/
-
-#ifndef NFA_HCI_DEFS_H
-#define NFA_HCI_DEFS_H
-
-/* Static gates */
-#define NFA_HCI_LOOP_BACK_GATE 0x04
-#define NFA_HCI_IDENTITY_MANAGEMENT_GATE 0x05
-
-#define NFA_HCI_FIRST_HOST_SPECIFIC_GENERIC_GATE 0x10
-#define NFA_HCI_FIRST_PROP_GATE 0xF0
-#define NFA_HCI_LAST_PROP_GATE 0xFF
-
-/* Generic Gates */
-#define NFA_HCI_CONNECTIVITY_GATE 0x41
-
-/* Proprietary Gates */
-#define NFA_HCI_PROP_GATE_FIRST 0xF0
-#define NFA_HCI_PROP_GATE_LAST 0xFF
-
-/* Static pipes */
-#define NFA_HCI_LINK_MANAGEMENT_PIPE 0x00
-#define NFA_HCI_ADMIN_PIPE 0x01
-
-/* Dynamic pipe range */
-#define NFA_HCI_FIRST_DYNAMIC_PIPE 0x02
-#define NFA_HCI_LAST_DYNAMIC_PIPE 0x6F
-
-/* host_table */
-#define NFA_HCI_HOST_CONTROLLER 0x00
-
-/* Type of instruction */
-#define NFA_HCI_COMMAND_TYPE 0x00
-#define NFA_HCI_EVENT_TYPE 0x01
-#define NFA_HCI_RESPONSE_TYPE 0x02
-
-/* Chaining bit value */
-#define NFA_HCI_MESSAGE_FRAGMENTATION 0x00
-#define NFA_HCI_NO_MESSAGE_FRAGMENTATION 0x01
-
-/* NFA HCI commands */
-
-/* Commands for all gates */
-#define NFA_HCI_ANY_SET_PARAMETER 0x01
-#define NFA_HCI_ANY_GET_PARAMETER 0x02
-#define NFA_HCI_ANY_OPEN_PIPE 0x03
-#define NFA_HCI_ANY_CLOSE_PIPE 0x04
-
-/* Admin gate commands */
-#define NFA_HCI_ADM_CREATE_PIPE 0x10
-#define NFA_HCI_ADM_DELETE_PIPE 0x11
-#define NFA_HCI_ADM_NOTIFY_PIPE_CREATED 0x12
-#define NFA_HCI_ADM_NOTIFY_PIPE_DELETED 0x13
-#define NFA_HCI_ADM_CLEAR_ALL_PIPE 0x14
-#define NFA_HCI_ADM_NOTIFY_ALL_PIPE_CLEARED 0x15
-
-/* Connectivity gate command */
-#define NFA_HCI_CON_PRO_HOST_REQUEST 0x10
-
-/* NFA HCI responses */
-#define NFA_HCI_ANY_OK 0x00
-#define NFA_HCI_ANY_E_NOT_CONNECTED 0x01
-#define NFA_HCI_ANY_E_CMD_PAR_UNKNOWN 0x02
-#define NFA_HCI_ANY_E_NOK 0x03
-#define NFA_HCI_ADM_E_NO_PIPES_AVAILABLE 0x04
-#define NFA_HCI_ANY_E_REG_PAR_UNKNOWN 0x05
-#define NFA_HCI_ANY_E_PIPE_NOT_OPENED 0x06
-#define NFA_HCI_ANY_E_CMD_NOT_SUPPORTED 0x07
-#define NFA_HCI_ANY_E_INHIBITED 0x08
-#define NFA_HCI_ANY_E_TIMEOUT 0x09
-#define NFA_HCI_ANY_E_REG_ACCESS_DENIED 0x0A
-#define NFA_HCI_ANY_E_PIPE_ACCESS_DENIED 0x0B
-
-/* NFA HCI Events */
-#define NFA_HCI_EVT_HCI_END_OF_OPERATION 0x01
-#define NFA_HCI_EVT_POST_DATA 0x02
-#define NFA_HCI_EVT_HOT_PLUG 0x03
-
-/* NFA HCI Connectivity gate Events */
-#define NFA_HCI_EVT_CONNECTIVITY 0x10
-#define NFA_HCI_EVT_TRANSACTION 0x12
-#define NFA_HCI_EVT_OPERATION_ENDED 0x13
-
-/* Host controller Admin gate registry identifiers */
-#define NFA_HCI_SESSION_IDENTITY_INDEX 0x01
-#define NFA_HCI_WHITELIST_INDEX 0x03
-#define NFA_HCI_HOST_LIST_INDEX 0x04
-
-/* DH Identity management gate registry identifier */
-#define NFA_HCI_VERSION_SW_INDEX 0x01
-#define NFA_HCI_VERSION_HW_INDEX 0x03
-#define NFA_HCI_VENDOR_NAME_INDEX 0x04
-#define NFA_HCI_MODEL_ID_INDEX 0x05
-#define NFA_HCI_HCI_VERSION_INDEX 0x02
-#define NFA_HCI_GATES_LIST_INDEX 0x06
-
-#endif /* NFA_HCI_DEFS_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_hci_int.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_hci_int.h
deleted file mode 100755
index 6028508..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_hci_int.h
+++ /dev/null
@@ -1,563 +0,0 @@
-/******************************************************************************
- *
- * 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 is the private interface file for the NFA HCI.
- *
- ******************************************************************************/
-#ifndef NFA_HCI_INT_H
-#define NFA_HCI_INT_H
-
-#include <cstdint>
-#include <string>
-#ifdef ST21NFC
-#include <pthread.h>
-#endif
-
-#include "nfa_ee_api.h"
-#include "nfa_hci_api.h"
-#include "nfa_sys.h"
-extern uint8_t HCI_LOOPBACK_DEBUG;
-
-/* NFA HCI DEBUG states */
-#define NFA_HCI_DEBUG_ON 0x01
-#define NFA_HCI_DEBUG_OFF 0x00
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-#define NFA_HCI_HOST_ID_UICC0 0x02 /* Host ID for UICC 0 */
-/* First dynamically allocated host ID */
-#define NFA_HCI_HOST_ID_FIRST_DYNAMICALLY_ALLOCATED 0x80
-/* Lost host specific gate */
-#define NFA_HCI_LAST_HOST_SPECIFIC_GATE 0xEF
-
-#define NFA_HCI_SESSION_ID_LEN 8 /* HCI Session ID length */
-
-/* HCI SW Version number */
-#define NFA_HCI_VERSION_SW 0x090000
-/* HCI HW Version number */
-#define NFA_HCI_VERSION_HW 0x000000
-#define NFA_HCI_VENDOR_NAME \
- "HCI" /* Vendor Name */
-/* Model ID */
-#define NFA_HCI_MODEL_ID 00
-/* HCI Version */
-#define NFA_HCI_VERSION 90
-
-/* NFA HCI states */
-#define NFA_HCI_STATE_DISABLED 0x00 /* HCI is disabled */
-/* HCI performing Initialization sequence */
-#define NFA_HCI_STATE_STARTUP 0x01
-/* HCI is waiting for initialization of other host in the network */
-#define NFA_HCI_STATE_WAIT_NETWK_ENABLE 0x02
-/* HCI is waiting to handle api commands */
-#define NFA_HCI_STATE_IDLE 0x03
-/* HCI is waiting for response to command sent */
-#define NFA_HCI_STATE_WAIT_RSP 0x04
-/* Removing all pipes prior to removing the gate */
-#define NFA_HCI_STATE_REMOVE_GATE 0x05
-/* Removing all pipes and gates prior to deregistering the app */
-#define NFA_HCI_STATE_APP_DEREGISTER 0x06
-#define NFA_HCI_STATE_RESTORE 0x07 /* HCI restore */
-/* HCI is waiting for initialization of other host in the network after restore
- */
-#define NFA_HCI_STATE_RESTORE_NETWK_ENABLE 0x08
-
-#define NFA_HCI_STATE_EE_RECOVERY 0x09
-
-typedef uint8_t tNFA_HCI_STATE;
-
-/* NFA HCI PIPE states */
-#define NFA_HCI_PIPE_CLOSED 0x00 /* Pipe is closed */
-#define NFA_HCI_PIPE_OPENED 0x01 /* Pipe is opened */
-
-typedef uint8_t tNFA_HCI_COMMAND;
-typedef uint8_t tNFA_HCI_RESPONSE;
-
-/* NFA HCI Internal events */
-enum {
- NFA_HCI_API_REGISTER_APP_EVT =
- NFA_SYS_EVT_START(NFA_ID_HCI), /* Register APP with HCI */
- NFA_HCI_API_DEREGISTER_APP_EVT, /* Deregister an app from HCI */
- NFA_HCI_API_GET_APP_GATE_PIPE_EVT, /* Get the list of gate and pipe associated
- to the application */
- NFA_HCI_API_ALLOC_GATE_EVT, /* Allocate a dynamic gate for the application */
- NFA_HCI_API_DEALLOC_GATE_EVT, /* Deallocate a previously allocated gate to the
- application */
- NFA_HCI_API_GET_HOST_LIST_EVT, /* Get the list of Host in the network */
- NFA_HCI_API_GET_REGISTRY_EVT, /* Get a registry entry from a host */
- NFA_HCI_API_SET_REGISTRY_EVT, /* Set a registry entry on a host */
- NFA_HCI_API_CREATE_PIPE_EVT, /* Create a pipe between two gates */
- NFA_HCI_API_OPEN_PIPE_EVT, /* Open a pipe */
- NFA_HCI_API_CLOSE_PIPE_EVT, /* Close a pipe */
- NFA_HCI_API_DELETE_PIPE_EVT, /* Delete a pipe */
- NFA_HCI_API_ADD_STATIC_PIPE_EVT, /* Add a static pipe */
- NFA_HCI_API_SEND_CMD_EVT, /* Send command via pipe */
- NFA_HCI_API_SEND_RSP_EVT, /* Application Response to a command */
- NFA_HCI_API_SEND_EVENT_EVT, /* Send event via pipe */
-
- NFA_HCI_RSP_NV_READ_EVT, /* Non volatile read complete event */
- NFA_HCI_RSP_NV_WRITE_EVT, /* Non volatile write complete event */
- NFA_HCI_RSP_TIMEOUT_EVT, /* Timeout to response for the HCP Command packet */
- NFA_HCI_CHECK_QUEUE_EVT
-};
-
-#define NFA_HCI_FIRST_API_EVENT NFA_HCI_API_REGISTER_APP_EVT
-#define NFA_HCI_LAST_API_EVENT NFA_HCI_API_SEND_EVENT_EVT
-
-/* Internal event structures.
-**
-** Note, every internal structure starts with a NFC_HDR and an app handle
-*/
-
-/* data type for NFA_HCI_API_REGISTER_APP_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- char app_name[NFA_MAX_HCI_APP_NAME_LEN + 1];
- tNFA_HCI_CBACK* p_cback;
- bool b_send_conn_evts;
-} tNFA_HCI_API_REGISTER_APP;
-
-/* data type for NFA_HCI_API_DEREGISTER_APP_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- char app_name[NFA_MAX_HCI_APP_NAME_LEN + 1];
-} tNFA_HCI_API_DEREGISTER_APP;
-
-/* data type for NFA_HCI_API_GET_APP_GATE_PIPE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
-} tNFA_HCI_API_GET_APP_GATE_PIPE;
-
-/* data type for NFA_HCI_API_ALLOC_GATE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- uint8_t gate;
-} tNFA_HCI_API_ALLOC_GATE;
-
-/* data type for NFA_HCI_API_DEALLOC_GATE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- uint8_t gate;
-} tNFA_HCI_API_DEALLOC_GATE;
-
-/* data type for NFA_HCI_API_GET_HOST_LIST_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- tNFA_STATUS status;
-} tNFA_HCI_API_GET_HOST_LIST;
-
-/* data type for NFA_HCI_API_GET_REGISTRY_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- uint8_t pipe;
- uint8_t reg_inx;
-} tNFA_HCI_API_GET_REGISTRY;
-
-/* data type for NFA_HCI_API_SET_REGISTRY_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- uint8_t pipe;
- uint8_t reg_inx;
- uint8_t size;
- uint8_t data[NFA_MAX_HCI_CMD_LEN];
-} tNFA_HCI_API_SET_REGISTRY;
-
-/* data type for NFA_HCI_API_CREATE_PIPE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- tNFA_STATUS status;
- uint8_t source_gate;
- uint8_t dest_host;
- uint8_t dest_gate;
-} tNFA_HCI_API_CREATE_PIPE_EVT;
-
-/* data type for NFA_HCI_API_OPEN_PIPE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- tNFA_STATUS status;
- uint8_t pipe;
-} tNFA_HCI_API_OPEN_PIPE_EVT;
-
-/* data type for NFA_HCI_API_CLOSE_PIPE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- tNFA_STATUS status;
- uint8_t pipe;
-} tNFA_HCI_API_CLOSE_PIPE_EVT;
-
-/* data type for NFA_HCI_API_DELETE_PIPE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- tNFA_STATUS status;
- uint8_t pipe;
-} tNFA_HCI_API_DELETE_PIPE_EVT;
-
-/* data type for NFA_HCI_API_ADD_STATIC_PIPE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- tNFA_STATUS status;
- uint8_t host;
- uint8_t gate;
- uint8_t pipe;
-} tNFA_HCI_API_ADD_STATIC_PIPE_EVT;
-
-/* data type for NFA_HCI_API_SEND_EVENT_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- uint8_t pipe;
- uint8_t evt_code;
- uint16_t evt_len;
- uint8_t* p_evt_buf;
- uint16_t rsp_len;
- uint8_t* p_rsp_buf;
- uint16_t rsp_timeout;
-} tNFA_HCI_API_SEND_EVENT_EVT;
-
-/* data type for NFA_HCI_API_SEND_CMD_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- uint8_t pipe;
- uint8_t cmd_code;
- uint16_t cmd_len;
- uint8_t data[NFA_MAX_HCI_CMD_LEN];
-} tNFA_HCI_API_SEND_CMD_EVT;
-
-/* data type for NFA_HCI_RSP_NV_READ_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint8_t block;
- uint16_t size;
- tNFA_STATUS status;
-} tNFA_HCI_RSP_NV_READ_EVT;
-
-/* data type for NFA_HCI_RSP_NV_WRITE_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_STATUS status;
-} tNFA_HCI_RSP_NV_WRITE_EVT;
-
-/* data type for NFA_HCI_API_SEND_RSP_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
- uint8_t pipe;
- uint8_t response;
- uint8_t size;
- uint8_t data[NFA_MAX_HCI_RSP_LEN];
-} tNFA_HCI_API_SEND_RSP_EVT;
-
-/* common data type for internal events */
-typedef struct {
- NFC_HDR hdr;
- tNFA_HANDLE hci_handle;
-} tNFA_HCI_COMM_DATA;
-
-/* union of all event data types */
-typedef union {
- NFC_HDR hdr;
- tNFA_HCI_COMM_DATA comm;
-
- /* API events */
- tNFA_HCI_API_REGISTER_APP app_info; /* Register/Deregister an application */
- tNFA_HCI_API_GET_APP_GATE_PIPE get_gate_pipe_list; /* Get the list of gates
- and pipes created for
- the application */
- tNFA_HCI_API_ALLOC_GATE
- gate_info; /* Allocate a dynamic gate to the application */
- tNFA_HCI_API_DEALLOC_GATE
- gate_dealloc; /* Deallocate the gate allocated to the application */
- tNFA_HCI_API_CREATE_PIPE_EVT create_pipe; /* Create a pipe */
- tNFA_HCI_API_OPEN_PIPE_EVT open_pipe; /* Open a pipe */
- tNFA_HCI_API_CLOSE_PIPE_EVT close_pipe; /* Close a pipe */
- tNFA_HCI_API_DELETE_PIPE_EVT delete_pipe; /* Delete a pipe */
- tNFA_HCI_API_ADD_STATIC_PIPE_EVT add_static_pipe; /* Add a static pipe */
- tNFA_HCI_API_GET_HOST_LIST
- get_host_list; /* Get the list of Host in the network */
- tNFA_HCI_API_GET_REGISTRY get_registry; /* Get a registry entry on a host */
- tNFA_HCI_API_SET_REGISTRY set_registry; /* Set a registry entry on a host */
- tNFA_HCI_API_SEND_CMD_EVT send_cmd; /* Send a event on a pipe to a host */
- tNFA_HCI_API_SEND_RSP_EVT
- send_rsp; /* Response to a command sent on a pipe to a host */
- tNFA_HCI_API_SEND_EVENT_EVT send_evt; /* Send a command on a pipe to a host */
-
- /* Internal events */
- tNFA_HCI_RSP_NV_READ_EVT nv_read; /* Read Non volatile data */
- tNFA_HCI_RSP_NV_WRITE_EVT nv_write; /* Write Non volatile data */
-} tNFA_HCI_EVENT_DATA;
-
-/*****************************************************************************
-** control block
-*****************************************************************************/
-
-/* Dynamic pipe control block */
-typedef struct {
- uint8_t pipe_id; /* Pipe ID */
- tNFA_HCI_PIPE_STATE pipe_state; /* State of the Pipe */
- uint8_t local_gate; /* local gate id */
- uint8_t dest_host; /* Peer host to which this pipe is connected */
- uint8_t dest_gate; /* Peer gate to which this pipe is connected */
-} tNFA_HCI_DYN_PIPE;
-
-/* Dynamic gate control block */
-typedef struct {
- uint8_t gate_id; /* local gate id */
- tNFA_HANDLE gate_owner; /* NFA-HCI handle assigned to the application which
- owns the gate */
- uint32_t pipe_inx_mask; /* Bit 0 == pipe inx 0, etc */
-} tNFA_HCI_DYN_GATE;
-
-/* Admin gate control block */
-typedef struct {
- tNFA_HCI_PIPE_STATE pipe01_state; /* State of Pipe '01' */
- uint8_t
- session_id[NFA_HCI_SESSION_ID_LEN]; /* Session ID of the host network */
-} tNFA_ADMIN_GATE_INFO;
-
-/* Link management gate control block */
-typedef struct {
- tNFA_HCI_PIPE_STATE pipe00_state; /* State of Pipe '00' */
- uint16_t rec_errors; /* Receive errors */
-} tNFA_LINK_MGMT_GATE_INFO;
-
-/* Identity management gate control block */
-typedef struct {
- uint32_t pipe_inx_mask; /* Bit 0 == pipe inx 0, etc */
- uint16_t version_sw; /* Software version number */
- uint16_t version_hw; /* Hardware version number */
- uint8_t vendor_name[20]; /* Vendor name */
- uint8_t model_id; /* Model ID */
- uint8_t hci_version; /* HCI Version */
-} tNFA_ID_MGMT_GATE_INFO;
-
-#ifdef ST21NFC
-#ifndef NFA_HCI_MAX_FRAG_INFO
-#define NFA_HCI_MAX_FRAG_INFO 5
-#endif
-
-typedef struct {
- uint8_t pipe;
- uint16_t msg_len; /* For segmentation - length of the combined message */
- uint16_t max_msg_len; /* Maximum reassembled message size */
- uint8_t msg_data[NFA_MAX_HCI_EVENT_LEN]; /* For segmentation - the combined
- message data */
- uint8_t* p_msg_data; /* For segmentation - reassembled message */
- uint8_t type; /* Instruction type of incoming message */
- uint8_t inst; /* Instruction of incoming message */
- bool assembly_failed; /* Set true if Insufficient buffer to Reassemble */
-} tNFA_HCI_FRAG_INFO;
-#endif
-
-/* NFA HCI control block */
-typedef struct {
- tNFA_HCI_STATE hci_state; /* state of the HCI */
- uint8_t num_nfcee; /* Number of NFCEE ID Discovered */
- tNFA_EE_INFO ee_info[NFA_HCI_MAX_HOST_IN_NETWORK]; /*NFCEE ID Info*/
- uint8_t num_ee_dis_req_ntf; /* Number of ee discovery request ntf received */
- uint8_t num_hot_plug_evts; /* Number of Hot plug events received after ee
- discovery disable ntf */
- /* Inactive host in the host network */
- uint8_t inactive_host[NFA_HCI_MAX_HOST_IN_NETWORK];
- /* active host in the host network */
- uint8_t active_host[NFA_HCI_MAX_HOST_IN_NETWORK];
- uint8_t reset_host[NFA_HCI_MAX_HOST_IN_NETWORK]; /* List of host resetting */
- bool b_low_power_mode; /* Host controller in low power mode */
- bool b_hci_new_sessionId; /* Command sent to set a new session Id */
- bool b_hci_netwk_reset; /* Command sent to reset HCI Network */
- bool w4_hci_netwk_init; /* Wait for other host in network to initialize */
- TIMER_LIST_ENT timer; /* Timer to avoid indefinitely waiting for response */
- uint8_t conn_id; /* Connection ID */
- uint8_t buff_size; /* Connection buffer size */
- bool nv_read_cmplt; /* NV Read completed */
- bool nv_write_needed; /* Something changed - NV write is needed */
- bool assembling; /* Set true if in process of assembling a message */
- bool assembly_failed; /* Set true if Insufficient buffer to Reassemble
- incoming message */
- bool w4_rsp_evt; /* Application command sent on HCP Event */
- tNFA_HANDLE
- app_in_use; /* Index of the application that is waiting for response */
- uint8_t local_gate_in_use; /* Local gate currently working with */
- uint8_t remote_gate_in_use; /* Remote gate currently working with */
- uint8_t remote_host_in_use; /* The remote host to which a command is sent */
- uint8_t pipe_in_use; /* The pipe currently working with */
- uint8_t param_in_use; /* The registry parameter currently working with */
- tNFA_HCI_COMMAND cmd_sent; /* The last command sent */
- bool ee_disc_cmplt; /* EE Discovery operation completed */
- bool ee_disable_disc; /* EE Discovery operation is disabled */
- uint16_t msg_len; /* For segmentation - length of the combined message */
- uint16_t max_msg_len; /* Maximum reassembled message size */
- uint8_t msg_data[NFA_MAX_HCI_EVENT_LEN]; /* For segmentation - the combined
- message data */
- uint8_t* p_msg_data; /* For segmentation - reassembled message */
- uint8_t type; /* Instruction type of incoming message */
- uint8_t inst; /* Instruction of incoming message */
-
- BUFFER_Q hci_api_q; /* Buffer Q to hold incoming API commands */
- BUFFER_Q hci_host_reset_api_q; /* Buffer Q to hold incoming API commands to a
- host that is reactivating */
- tNFA_HCI_CBACK* p_app_cback[NFA_HCI_MAX_APP_CB]; /* Callback functions
- registered by the
- applications */
- uint16_t rsp_buf_size; /* Maximum size of APDU buffer */
- uint8_t* p_rsp_buf; /* Buffer to hold response to sent event */
- struct /* Persistent information for Device Host */
- {
- char reg_app_names[NFA_HCI_MAX_APP_CB][NFA_MAX_HCI_APP_NAME_LEN + 1];
-
- tNFA_HCI_DYN_GATE dyn_gates[NFA_HCI_MAX_GATE_CB];
- tNFA_HCI_DYN_PIPE dyn_pipes[NFA_HCI_MAX_PIPE_CB];
-
- bool b_send_conn_evts[NFA_HCI_MAX_APP_CB];
- tNFA_ADMIN_GATE_INFO admin_gate;
- tNFA_LINK_MGMT_GATE_INFO link_mgmt_gate;
- tNFA_ID_MGMT_GATE_INFO id_mgmt_gate;
- } cfg;
-#ifdef ST21NFC
- int frag_cnt;
- tNFA_HCI_FRAG_INFO frag_info[NFA_HCI_MAX_FRAG_INFO];
-#endif
-} tNFA_HCI_CB;
-
-/*****************************************************************************
-** External variables
-*****************************************************************************/
-
-/* NFA HCI control block */
-extern tNFA_HCI_CB nfa_hci_cb;
-#ifdef ST21NFC
-/* Mutex to protect nfa_hci_cb.hci_state change */
-extern pthread_mutex_t nfa_hci_mutex;
-#endif
-
-/*****************************************************************************
-** External functions
-*****************************************************************************/
-
-/* Functions in nfa_hci_main.c
- */
-extern void nfa_hci_init(void);
-extern void nfa_hci_proc_nfcc_power_mode(uint8_t nfcc_power_mode);
-extern void nfa_hci_dh_startup_complete(void);
-extern void nfa_hci_startup_complete(tNFA_STATUS status);
-extern void nfa_hci_startup(void);
-extern void nfa_hci_restore_default_config(uint8_t* p_session_id);
-extern void nfa_hci_enable_one_nfcee(void);
-
-/* Action functions in nfa_hci_act.c
- */
-extern void nfa_hci_check_pending_api_requests(void);
-extern void nfa_hci_check_api_requests(void);
-extern void nfa_hci_handle_admin_gate_cmd(uint8_t* p_data, uint16_t data_len);
-extern void nfa_hci_handle_admin_gate_rsp(uint8_t* p_data, uint8_t data_len);
-extern void nfa_hci_handle_admin_gate_evt();
-extern void nfa_hci_handle_link_mgm_gate_cmd(uint8_t* p_data,
- uint16_t data_len);
-extern void nfa_hci_handle_dyn_pipe_pkt(uint8_t pipe, uint8_t* p_data,
- uint16_t data_len);
-extern void nfa_hci_handle_pipe_open_close_cmd(tNFA_HCI_DYN_PIPE* p_pipe);
-extern void nfa_hci_api_dealloc_gate(tNFA_HCI_EVENT_DATA* p_evt_data);
-extern void nfa_hci_api_deregister(tNFA_HCI_EVENT_DATA* p_evt_data);
-
-/* Utility functions in nfa_hci_utils.c
- */
-extern tNFA_HCI_DYN_GATE* nfa_hciu_alloc_gate(uint8_t gate_id,
- tNFA_HANDLE app_handle);
-extern tNFA_HCI_DYN_GATE* nfa_hciu_find_gate_by_gid(uint8_t gate_id);
-extern tNFA_HCI_DYN_GATE* nfa_hciu_find_gate_by_owner(tNFA_HANDLE app_handle);
-extern tNFA_HCI_DYN_GATE* nfa_hciu_find_gate_with_nopipes_by_owner(
- tNFA_HANDLE app_handle);
-extern tNFA_HCI_DYN_PIPE* nfa_hciu_find_pipe_by_pid(uint8_t pipe_id);
-extern tNFA_HCI_DYN_PIPE* nfa_hciu_find_pipe_by_owner(tNFA_HANDLE app_handle);
-extern tNFA_HCI_DYN_PIPE* nfa_hciu_find_active_pipe_by_owner(
- tNFA_HANDLE app_handle);
-extern tNFA_HCI_DYN_PIPE* nfa_hciu_find_pipe_on_gate(uint8_t gate_id);
-extern tNFA_HANDLE nfa_hciu_get_gate_owner(uint8_t gate_id);
-extern bool nfa_hciu_check_pipe_between_gates(uint8_t local_gate,
- uint8_t dest_host,
- uint8_t dest_gate);
-extern bool nfa_hciu_is_active_host(uint8_t host_id);
-extern bool nfa_hciu_is_host_reseting(uint8_t host_id);
-extern bool nfa_hciu_is_no_host_resetting(void);
-extern tNFA_HCI_DYN_PIPE* nfa_hciu_find_active_pipe_on_gate(uint8_t gate_id);
-extern tNFA_HANDLE nfa_hciu_get_pipe_owner(uint8_t pipe_id);
-extern uint8_t nfa_hciu_count_open_pipes_on_gate(tNFA_HCI_DYN_GATE* p_gate);
-extern uint8_t nfa_hciu_count_pipes_on_gate(tNFA_HCI_DYN_GATE* p_gate);
-
-extern tNFA_HCI_RESPONSE nfa_hciu_add_pipe_to_gate(uint8_t pipe,
- uint8_t local_gate,
- uint8_t dest_host,
- uint8_t dest_gate);
-extern tNFA_HCI_RESPONSE nfa_hciu_add_pipe_to_static_gate(uint8_t local_gate,
- uint8_t pipe_id,
- uint8_t dest_host,
- uint8_t dest_gate);
-
-extern tNFA_HCI_RESPONSE nfa_hciu_release_pipe(uint8_t pipe_id);
-extern void nfa_hciu_release_gate(uint8_t gate);
-extern void nfa_hciu_remove_all_pipes_from_host(uint8_t host);
-extern uint8_t nfa_hciu_get_allocated_gate_list(uint8_t* p_gate_list);
-
-extern void nfa_hciu_send_to_app(tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA* p_evt,
- tNFA_HANDLE app_handle);
-extern void nfa_hciu_send_to_all_apps(tNFA_HCI_EVT event,
- tNFA_HCI_EVT_DATA* p_evt);
-extern void nfa_hciu_send_to_apps_handling_connectivity_evts(
- tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA* p_evt);
-
-extern tNFA_STATUS nfa_hciu_send_close_pipe_cmd(uint8_t pipe);
-extern tNFA_STATUS nfa_hciu_send_delete_pipe_cmd(uint8_t pipe);
-extern tNFA_STATUS nfa_hciu_send_clear_all_pipe_cmd(void);
-extern tNFA_STATUS nfa_hciu_send_open_pipe_cmd(uint8_t pipe);
-extern tNFA_STATUS nfa_hciu_send_get_param_cmd(uint8_t pipe, uint8_t index);
-extern tNFA_STATUS nfa_hciu_send_create_pipe_cmd(uint8_t source_gate,
- uint8_t dest_host,
- uint8_t dest_gate);
-extern tNFA_STATUS nfa_hciu_send_set_param_cmd(uint8_t pipe, uint8_t index,
- uint8_t length, uint8_t* p_data);
-extern tNFA_STATUS nfa_hciu_send_msg(uint8_t pipe_id, uint8_t type,
- uint8_t instruction, uint16_t pkt_len,
- uint8_t* p_pkt);
-
-extern std::string nfa_hciu_instr_2_str(uint8_t type);
-extern std::string nfa_hciu_get_event_name(uint16_t event);
-extern std::string nfa_hciu_get_state_name(uint8_t state);
-extern char* nfa_hciu_get_type_inst_names(uint8_t pipe, uint8_t type,
- uint8_t inst, char* p_buff,
- const uint8_t max_buff_size);
-extern std::string nfa_hciu_evt_2_str(uint8_t pipe_id, uint8_t evt);
-
-extern bool nfa_hciu_check_sim_pipe_ids(uint8_t pipe_id);
-
-#endif /* NFA_HCI_INT_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_mem_co.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_mem_co.h
deleted file mode 100755
index e027c16..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_mem_co.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/******************************************************************************
- *
- * 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.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * Callout functions for memory allocation/deallocatoin
- *
- ******************************************************************************/
-#ifndef NFA_MEM_CO_H
-#define NFA_MEM_CO_H
-
-#include "nfc_target.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-/*****************************************************************************
-** External Function Declarations
-*****************************************************************************/
-
-/*******************************************************************************
-**
-** Function nfa_mem_co_alloc
-**
-** Description allocate a buffer from platform's memory pool
-**
-** Returns:
-** pointer to buffer if successful
-** NULL otherwise
-**
-*******************************************************************************/
-extern void* nfa_mem_co_alloc(uint32_t num_bytes);
-
-/*******************************************************************************
-**
-** Function nfa_mem_co_free
-**
-** Description free buffer previously allocated using nfa_mem_co_alloc
-**
-** Returns:
-** Nothing
-**
-*******************************************************************************/
-extern void nfa_mem_co_free(void* p_buf);
-
-#endif /* NFA_MEM_CO_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nfcee_api.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nfcee_api.h
deleted file mode 100755
index b67216d..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nfcee_api.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2024 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.
- *
- ******************************************************************************/
-#pragma once
-/*******************************************************************************
-**
-** Function NFA_T4tNfcEeOpenConnection
-**
-** Description Creates logical connection with T4T Nfcee
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-tNFA_STATUS NFA_T4tNfcEeOpenConnection();
-
-/*******************************************************************************
-**
-** Function NFA_T4tNfcEeClear
-**
-** Description Clear Ndef data to T4T NFC EE.
-** For file ID NDEF, perform the NDEF detection procedure
-** and set the NDEF tag data to zero.
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-tNFA_STATUS NFA_T4tNfcEeClear(uint8_t* p_fileId);
-
-/*******************************************************************************
-**
-** Function NFA_T4tNfcEeWrite
-**
-** Description Write data to the T4T NFC EE of given file id.
-** If file ID is of NDEF, perform the NDEF detection procedure
-** and write the NDEF tag data using the appropriate method for
-** NDEF EE.
-** If File ID is Not NDEF then reads proprietary way
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-tNFA_STATUS NFA_T4tNfcEeWrite(uint8_t* p_fileId, uint8_t* p_data, uint32_t len);
-
-/*******************************************************************************
-**
-** Function NFA_T4tNfcEeRead
-**
-** Description Read T4T message from NFCC area.of given file id.
-** If file ID is of NDEF, perform the NDEF detection
-** procedure and read the NDEF tag data using the appropriate
-** method for NDEF EE. If File ID is Not NDEF then reads
-** proprietary way
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-tNFA_STATUS NFA_T4tNfcEeRead(uint8_t* p_fileId);
-
-/*******************************************************************************
-**
-** Function NFA_T4tNfcEeCloseConnection
-**
-** Description Closes logical connection with T4T Nfcee
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-tNFA_STATUS NFA_T4tNfcEeCloseConnection();
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nfcee_int.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nfcee_int.h
deleted file mode 100755
index af978aa..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nfcee_int.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2024 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.
- *
- ******************************************************************************/
-#pragma once
-#include "nfa_ee_int.h"
-#include "nfa_sys.h"
-using namespace std;
-
-#define CC_FILE_ID 0xE103
-#define NDEF_FILE_ID 0xE104
-
-#define T4TNFCEE_SIZEOF_LEN_BYTES 0x02
-#define T4TNFCEE_SIZEOF_STATUS_BYTES 0x02
-
-/*CLA + INS + P1 + P2 + LC*/
-#define CAPDU_TL 0x05
-#define RW_T4TNFCEE_DATA_PER_WRITE (T4T_MAX_LENGTH_LC - CAPDU_TL)
-
-/*
-POWER_STATE:
-bit pos 0 = Switch On
-bit pos 1 = Switch Off
-bit pos 2 = Battery Off
-bit pos 3 = Screen On lock
-bit pos 4 = Screen off unlock
-bit pos 5 = Screen Off lock
-*/
-#define T4TNFCEE_AID_POWER_STATE 0x3B
-
-/* Event to notify T4T NFCEE Detection complete*/
-#define NFA_T4TNFCEE_EVT 40
-/* Event to notify NDEF T4TNFCEE READ complete*/
-#define NFA_T4TNFCEE_READ_CPLT_EVT 41
-/* Event to notify NDEF T4TNFCEE WRITE complete*/
-#define NFA_T4TNFCEE_WRITE_CPLT_EVT 42
-/* Event to notify NDEF T4TNFCEE CLEAR complete*/
-#define NFA_T4TNFCEE_CLEAR_CPLT_EVT 43
-/* Event to notify NDEF T4TNFCEE READ CC DATA complete*/
-#define NFA_T4TNFCEE_READ_CC_DATA_CPLT_EVT 44
-
-#define T4T_NFCEE_READ_ALLOWED 0x00
-#define T4T_NFCEE_WRITE_NOT_ALLOWED 0xFF
-
-/*Status codes*/
-#define NFA_T4T_STATUS_INVALID_FILE_ID 0x05
-
-typedef struct {
- uint16_t capacity;
- uint8_t read_access;
- uint8_t write_access;
-} tNFA_T4TNFCEE_FILE_INFO;
-
-enum {
- NFA_T4TNFCEE_OP_OPEN_CONNECTION,
- NFA_T4TNFCEE_OP_READ,
- NFA_T4TNFCEE_OP_WRITE,
- NFA_T4TNFCEE_OP_CLOSE_CONNECTION,
- NFA_T4TNFCEE_OP_CLEAR,
- NFA_T4TNFCEE_OP_READ_CC_FILE,
- NFA_T4TNFCEE_OP_MAX
-};
-typedef uint8_t tNFA_T4TNFCEE_OP;
-
-typedef struct {
- uint32_t len;
- uint8_t* p_data;
-} tNFA_T4TNFCEE_OP_PARAMS_WRITE;
-
-/* NDEF EE events */
-enum {
- NFA_T4TNFCEE_OP_REQUEST_EVT = NFA_SYS_EVT_START(NFA_ID_T4TNFCEE),
- NFA_T4TNFCEE_MAX_EVT
-};
-
-/* data type for NFA_T4TNFCEE_op_req_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_T4TNFCEE_OP op; /* NFA T4TNFCEE operation */
- uint8_t* p_fileId;
- tNFA_T4TNFCEE_OP_PARAMS_WRITE write;
-} tNFA_T4TNFCEE_OPERATION;
-
-/* union of all data types */
-typedef union {
- /* GKI event buffer header */
- NFC_HDR hdr;
- tNFA_T4TNFCEE_OPERATION op_req;
-} tNFA_T4TNFCEE_MSG;
-
-typedef enum {
- /* NFA T4TNFCEE states */
- NFA_T4TNFCEE_STATE_DISABLED = 0x00, /* T4TNFCEE is disabled */
- NFA_T4TNFCEE_STATE_TRY_ENABLE,
- NFA_T4TNFCEE_STATE_INITIALIZED, /* T4TNFCEE is waiting to handle api commands
- */
- NFA_T4TNFCEE_STATE_CONNECTED, /* T4TNFCEE is in open sequence */
- NFA_T4TNFCEE_STATE_DISCONNECTED, /* T4TNFCEE is in closing sequence */
- NFA_T4TNFCEE_STATE_OPEN_FAILED /* T4TNFCEE OPEN Failed */
-} tNFA_T4TNFCEE_STATE;
-
-typedef enum {
- PROP_DISABLED = 0x00,
- WAIT_SELECT_APPLICATION,
- WAIT_SELECT_CC,
- WAIT_READ_CC_DATA_LEN,
- WAIT_READ_CC_FILE,
- WAIT_SELECT_FILE,
- WAIT_READ_DATA_LEN,
- WAIT_READ_FILE,
- WAIT_RESET_NLEN,
- WAIT_WRITE,
- WAIT_WRITE_COMPLETE,
- WAIT_UPDATE_NLEN,
- WAIT_CLEAR_NDEF_DATA,
- OP_COMPLETE = 0x00
-} tNFA_T4TNFCEE_RW_STATE;
-/* NFA T4TNFCEE control block */
-typedef struct {
- tNFA_STATUS status;
- tNFA_T4TNFCEE_STATE t4tnfcee_state; /* T4T NFCEE state */
- tNFA_T4TNFCEE_OP cur_op; /* Current operation */
- tNFA_T4TNFCEE_RW_STATE rw_state; /* Read Write state */
- tNFA_T4TNFCEE_MSG* p_pending_msg; /* Pending command */
- uint8_t* p_dataBuf; /* Data buffer */
- uint16_t cur_fileId; /* Current FileId */
- uint16_t rd_offset; /* current read-offset of incoming NDEF data */
- uint32_t dataLen; /*length of the data*/
- bool ndefEmulationSupport; /* NDEF emulation support */
- bool ndefEmulationConfig; /* NDEF emulation configuration */
- uint8_t connId; /* NDEF NFCEE CONN ID */
-} tNFA_T4TNFCEE_CB;
-extern tNFA_T4TNFCEE_CB nfa_t4tnfcee_cb;
-
-/* type definition for action functions */
-typedef bool (*tNFA_T4TNFCEE_ACTION)(tNFA_T4TNFCEE_MSG* p_data);
-
-bool nfa_t4tnfcee_handle_op_req(tNFA_T4TNFCEE_MSG* p_data);
-bool nfa_t4tnfcee_handle_event(NFC_HDR* p_msg);
-void nfa_t4tnfcee_free_rx_buf(void);
-bool nfa_t4tnfcee_is_enabled(void);
-bool NFA_T4tNfcEeIsProcessing(void);
-bool NFA_T4tNfcEeIsEmulationSupported(void);
-void nfa_t4tnfcee_set_ee_cback(tNFA_EE_ECB* p_ecb);
-void nfa_t4tnfcee_init();
-void nfa_t4tnfcee_deinit(void);
-tNFC_STATUS nfa_t4tnfcee_proc_disc_evt(tNFA_T4TNFCEE_OP event);
-bool nfa_t4tnfcee_is_config();
-bool nfa_t4tnfcee_is_discovered(void);
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nv_ci.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nv_ci.h
deleted file mode 100755
index adcf085..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nv_ci.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2003-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 is the interface file for non valtile memory call-in functions.
- *
- ******************************************************************************/
-#ifndef NFA_NV_CI_H
-#define NFA_NV_CI_H
-
-#include "nfa_nv_co.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-/*****************************************************************************
-** Function Declarations
-*****************************************************************************/
-
-/*******************************************************************************
-**
-** Function nfa_nv_ci_write
-**
-** Description This function sends an event to NFAA indicating the phone
-** has written the number of bytes specified in the call-out
-** function, nfa_nv_co_write (), and is ready for more data.
-** This function is used to control the TX data flow.
-** Note: The data buffer is released by the stack aioer
-** calling this function.
-**
-** Parameters status - NFA_NV_CO_OK, NFA_NV_CO_NOSPACE, or NFA_NV_CO_FAIL
-** evt - Used Internally by NFA -> MUST be same value passed
-** in call-out function.
-**
-** Returns void
-**
-*******************************************************************************/
-extern void nfa_nv_ci_write(tNFA_NV_CO_STATUS status);
-
-/*******************************************************************************
-**
-** Function nfa_nv_ci_read
-**
-** Description This function sends an event to NFA indicating the phone has
-** read in the requested amount of data specified in the
-** nfa_nv_co_read () call-out function. It should only be
-** called when the requested number of bytes has been read.
-**
-** Parameters num_bytes_read - number of bytes read into the buffer
-** specified in the read callout-function.
-** status - NFA_NV_CO_OK if full buffer of data,
-** NFA_NV_CO_EOF if the end of file has been reached,
-** NFA_NV_CO_FAIL if an error has occurred.
-** evt - Used Internally by NFA -> MUST be same value passed
-** in call-out function.
-**
-** Returns void
-**
-*******************************************************************************/
-extern void nfa_nv_ci_read(uint16_t num_bytes_read, tNFA_NV_CO_STATUS status,
- uint8_t block);
-
-#endif /* BTA_FS_CI_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nv_co.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nv_co.h
deleted file mode 100755
index 0f32e9c..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_nv_co.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2003-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 is the interface file for the synchronization server call-out
- * functions.
- *
- ******************************************************************************/
-#ifndef NFA_NV_CO_H
-#define NFA_NV_CO_H
-
-#include <time.h>
-
-#include "nfa_api.h"
-
-/*****************************************************************************
-** Constants and Data Types
-*****************************************************************************/
-
-/**************************
-** Common Definitions
-***************************/
-
-/* Status codes returned by call-out functions, or in call-in functions as
- * status */
-#define NFA_NV_CO_OK 0x00
-#define NFA_NV_CO_FAIL 0x01 /* Used to pass all other errors */
-
-typedef uint8_t tNFA_NV_CO_STATUS;
-
-#define DH_NV_BLOCK 0x01
-#define HC_F3_NV_BLOCK 0x02
-#define HC_F4_NV_BLOCK 0x03
-#define HC_F5_NV_BLOCK 0x05
-
-/*****************************************************************************
-** Function Declarations
-*****************************************************************************/
-/**************************
-** Common Functions
-***************************/
-
-/*******************************************************************************
-**
-** Function nfa_nv_co_read
-**
-** Description This function is called by NFA to read in data from the
-** previously opened file.
-**
-** Parameters p_buf - buffer to read the data into.
-** nbytes - number of bytes to read into the buffer.
-**
-** Returns void
-**
-** Note: Upon completion of the request, nfa_nv_ci_read () is
-** called with the buffer of data, along with the number
-** of bytes read into the buffer, and a status. The
-** call-in function should only be called when ALL
-** requested bytes have been read, the end of file has
-** been detected, or an error has occurred.
-**
-*******************************************************************************/
-extern void nfa_nv_co_read(uint8_t* p_buf, uint16_t nbytes, uint8_t block);
-
-/*******************************************************************************
-**
-** Function nfa_nv_co_write
-**
-** Description This function is called by io to send file data to the
-** phone.
-**
-** Parameters p_buf - buffer to read the data from.
-** nbytes - number of bytes to write out to the file.
-**
-** Returns void
-**
-** Note: Upon completion of the request, nfa_nv_ci_write () is
-** called with the file descriptor and the status. The
-** call-in function should only be called when ALL
-** requested bytes have been written, or an error has
-** been detected,
-**
-*******************************************************************************/
-extern void nfa_nv_co_write(const uint8_t* p_buf, uint16_t nbytes,
- uint8_t block);
-
-#endif /* NFA_NV_CO_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_rw_api.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_rw_api.h
deleted file mode 100755
index e39b9bf..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_rw_api.h
+++ /dev/null
@@ -1,782 +0,0 @@
-/******************************************************************************
- *
- * 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.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * NFA reader/writer API functions
- *
- ******************************************************************************/
-#ifndef NFA_RW_API_H
-#define NFA_RW_API_H
-
-#include "nfa_api.h"
-#include "nfc_target.h"
-
-#define DEFAULT_PRESENCE_CHECK_RETRY_COUNT 3
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-enum {
- NFA_RW_PRES_CHK_DEFAULT, /* The default behavior */
- NFA_RW_PRES_CHK_I_BLOCK, /* Empty I Block */
- NFA_RW_PRES_CHK_ISO_DEP_NAK = 5 /* presence check command ISO-DEP
- NAK as per NCI2.0 */
-};
-typedef uint8_t tNFA_RW_PRES_CHK_OPTION;
-
-/*****************************************************************************
-** NFA T3T Constants and definitions
-*****************************************************************************/
-
-/* Block descriptor. (For non-NDEF read/write */
-typedef struct {
- uint16_t service_code; /* Service code for the block */
- uint16_t block_number; /* Block number. */
-} tNFA_T3T_BLOCK_DESC;
-
-/*****************************************************************************
-** External Function Declarations
-*****************************************************************************/
-
-/*******************************************************************************
-**
-** Function NFA_RwDetectNDef
-**
-** Description Perform the NDEF detection procedure using the appropriate
-** method for the currently activated tag.
-**
-** Upon successful completion of NDEF detection, a
-** NFA_NDEF_DETECT_EVT will be sent, to notify the application
-** of the NDEF attributes (NDEF total memory size, current
-** size, etc.).
-**
-** It is not mandatory to call this function - NFA_RwReadNDef
-** and NFA_RwWriteNDef will perform NDEF detection internally
-** if not performed already. This API may be called to get a
-** tag's NDEF size before issuing a write-request.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFC_STATUS_REFUSED if tag does not support NDEF
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwDetectNDef(void);
-
-/*******************************************************************************
-**
-** Function NFA_RwReadNDef
-**
-** Description Read NDEF message from tag. This function will internally
-** perform the NDEF detection procedure (if not performed
-** previously), and read the NDEF tag data using the
-** appropriate method for the currently activated tag.
-**
-** Upon successful completion of NDEF detection (if performed),
-** a NFA_NDEF_DETECT_EVT will be sent, to notify the
-** application of the NDEF attributes (NDEF total memory size,
-** current size, etc.).
-**
-** Upon receiving the NDEF message, the message will be sent to
-** the handler registered with NFA_RegisterNDefTypeHandler or
-** NFA_RequestExclusiveRfControl (if exclusive RF mode is
-** active)
-**
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFC_STATUS_REFUSED if tag does not support NDEF
-** NFC_STATUS_NOT_INITIALIZED if NULL NDEF was detected on the
-** tag
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwReadNDef(void);
-
-/*******************************************************************************
-**
-** Function NFA_RwWriteNDef
-**
-** Description Write NDEF data to the activated tag. This function will
-** internally perform NDEF detection if necessary, and write
-** the NDEF tag data using the appropriate method for the
-** currently activated tag.
-**
-** When the entire message has been written, or if an error
-** occurs, the app will be notified with NFA_RW_WRITE_CPLT_EVT.
-**
-** p_data needs to be persistent until NFA_RW_WRITE_CPLT_EVT
-**
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFC_STATUS_REFUSED if tag does not support NDEF/locked
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwWriteNDef(uint8_t* p_data, uint32_t len);
-
-/*****************************************************************************
-**
-** Function NFA_RwPresenceCheck
-**
-** Description Check if the tag is still in the field.
-**
-** The NFA_RW_PRESENCE_CHECK_EVT w/ status is used to
-** indicate presence or non-presence.
-**
-** option is used only with ISO-DEP protocol
-**
-** Returns
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*****************************************************************************/
-extern tNFA_STATUS NFA_RwPresenceCheck(tNFA_RW_PRES_CHK_OPTION option);
-
-/*****************************************************************************
-**
-** Function NFA_RwFormatTag
-**
-** Description Check if the tag is NDEF Formatable. If yes Format the
-** tag
-**
-** The NFA_RW_FORMAT_CPLT_EVT w/ status is used to
-** indicate if tag is formatted or not.
-**
-** Returns
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*****************************************************************************/
-extern tNFA_STATUS NFA_RwFormatTag(void);
-
-/*******************************************************************************
-** LEGACY / PROPRIETARY TAG READ AND WRITE APIs
-*******************************************************************************/
-
-/*******************************************************************************
-**
-** Function NFA_RwLocateTlv
-**
-** Description:
-** Search for the Lock/Memory contril TLV on the activated Type1/Type2 tag
-**
-** Data is returned to the application using the NFA_TLV_DETECT_EVT. When
-** search operation has completed, or if an error occurs, the app will be
-** notified with NFA_TLV_DETECT_EVT.
-**
-** Description Perform the TLV detection procedure using the appropriate
-** method for the currently activated tag.
-**
-** Upon successful completion of TLV detection in T1/T2 tag, a
-** NFA_TLV_DETECT_EVT will be sent, to notify the application
-** of the TLV attributes (total lock/reserved bytes etc.).
-** However if the TLV type specified is NDEF then it is same as
-** calling NFA_RwDetectNDef and should expect to receive
-** NFA_NDEF_DETECT_EVT instead of NFA_TLV_DETECT_EVT
-**
-** It is not mandatory to call this function -
-** NFA_RwDetectNDef, NFA_RwReadNDef and NFA_RwWriteNDef will
-** perform TLV detection internally if not performed already.
-** An application may call this API to check the a
-** tag/card-emulator's total Reserved/ Lock bytes before
-** issuing a write-request.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFC_STATUS_REFUSED if tlv_type is NDEF & tag won't support
-** NDEF
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwLocateTlv(uint8_t tlv_type);
-
-/*******************************************************************************
-**
-** Function NFA_RwSetTagReadOnly
-**
-** Description:
-** Sets tag as read only.
-**
-** When tag is set as read only, or if an error occurs, the app will be
-** notified with NFA_SET_TAG_RO_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_REJECTED if protocol is not T1/T2/ISO15693
-** (or) if hard lock is not requested for protocol ISO15693
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwSetTagReadOnly(bool b_hard_lock);
-
-/*******************************************************************************
-**
-** Function NFA_RwT1tRid
-**
-** Description:
-** Send a RID command to the activated Type 1 tag.
-**
-** Data is returned to the application using the NFA_DATA_EVT. When the
-** read operation has completed, or if an error occurs, the app will be
-** notified with NFA_READ_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 1 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT1tRid(void);
-
-/*******************************************************************************
-**
-** Function NFA_RwT1tReadAll
-**
-** Description:
-** Send a RALL command to the activated Type 1 tag.
-**
-** Data is returned to the application using the NFA_DATA_EVT. When the
-** read operation has completed, or if an error occurs, the app will be
-** notified with NFA_READ_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 1 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT1tReadAll(void);
-
-/*******************************************************************************
-**
-** Function NFA_RwT1tRead
-**
-** Description:
-** Send a READ command to the activated Type 1 tag.
-**
-** Data is returned to the application using the NFA_DATA_EVT. When the
-** read operation has completed, or if an error occurs, the app will be
-** notified with NFA_READ_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 1 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT1tRead(uint8_t block_number, uint8_t index);
-
-/*******************************************************************************
-**
-** Function NFA_RwT1tWrite
-**
-** Description:
-** Send a WRITE command to the activated Type 1 tag.
-**
-** Data is returned to the application using the NFA_DATA_EVT. When the
-** write operation has completed, or if an error occurs, the app will be
-** notified with NFA_WRITE_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 1 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT1tWrite(uint8_t block_number, uint8_t index,
- uint8_t data, bool b_erase);
-
-/*******************************************************************************
-**
-** Function NFA_RwT1tReadSeg
-**
-** Description:
-** Send a RSEG command to the activated Type 1 tag.
-**
-** Data is returned to the application using the NFA_DATA_EVT. When the
-** read operation has completed, or if an error occurs, the app will be
-** notified with NFA_READ_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 1 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT1tReadSeg(uint8_t segment_number);
-
-/*******************************************************************************
-**
-** Function NFA_RwT1tRead8
-**
-** Description:
-** Send a READ8 command to the activated Type 1 tag.
-**
-** Data is returned to the application using the NFA_DATA_EVT. When the
-** read operation has completed, or if an error occurs, the app will be
-** notified with NFA_READ_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 1 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT1tRead8(uint8_t block_number);
-
-/*******************************************************************************
-**
-** Function NFA_RwT1tWrite8
-**
-** Description:
-** Send a WRITE8_E / WRITE8_NE command to the activated Type 1 tag.
-**
-** Data is returned to the application using the NFA_DATA_EVT. When the
-** read operation has completed, or if an error occurs, the app will be
-** notified with NFA_READ_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 1 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT1tWrite8(uint8_t block_number, uint8_t* p_data,
- bool b_erase);
-
-/*******************************************************************************
-**
-** Function NFA_RwT2tRead
-**
-** Description:
-** Send a READ command to the activated Type 2 tag.
-**
-** Data is returned to the application using the NFA_DATA_EVT. When the
-** read operation has completed, or if an error occurs, the app will be
-** notified with NFA_READ_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 2 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT2tRead(uint8_t block_number);
-
-/*******************************************************************************
-**
-** Function NFA_RwT2tWrite
-**
-** Description:
-** Send a WRITE command to the activated Type 2 tag.
-**
-** When the write operation has completed (or if an error occurs), the
-** app will be notified with NFA_WRITE_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 2 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT2tWrite(uint8_t block_number, uint8_t* p_data);
-
-/*******************************************************************************
-**
-** Function NFA_RwT2tSectorSelect
-**
-** Description:
-** Send SECTOR SELECT command to the activated Type 2 tag.
-**
-** When the sector select operation has completed (or if an error occurs),
-** the app will be notified with NFA_SECTOR_SELECT_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 2 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT2tSectorSelect(uint8_t sector_number);
-
-/*******************************************************************************
-**
-** Function NFA_RwT2tReadDynLockBytes
-**
-** Description:
-** Configure NFA skip_dyn_locks flag to send or not READ commands to the
-** activated Type 2 tag to read the DynLock_Area contents.
-**
-** When the operation has completed (or if an error occurs), the app will
-** be notified with NFA_T2T_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT2tReadDynLockBytes(bool read_dyn_locks);
-
-/*******************************************************************************
-**
-** Function NFA_RwT3tRead
-**
-** Description:
-** Send a CHECK (read) command to the activated Type 3 tag.
-**
-** Data is returned to the application using the NFA_RW_DATA_EVT. When the
-** read operation has completed, or if an error occurs, the app will be
-** notified with NFA_READ_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 3 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT3tRead(uint8_t num_blocks,
- tNFA_T3T_BLOCK_DESC* t3t_blocks);
-
-/*******************************************************************************
-**
-** Function NFA_RwT3tWrite
-**
-** Description:
-** Send an UPDATE (write) command to the activated Type 3 tag.
-**
-** When the write operation has completed (or if an error occurs), the
-** app will be notified with NFA_WRITE_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: type 3 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwT3tWrite(uint8_t num_blocks,
- tNFA_T3T_BLOCK_DESC* t3t_blocks,
- uint8_t* p_data);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93Inventory
-**
-** Description:
-** Send Inventory command to the activated ISO 15693 tag with/without AFI..
-** If UID is provided then set UID[0]:MSB, ... UID[7]:LSB
-**
-** When the write operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_NOT_INITIALIZED: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93Inventory(bool afi_present, uint8_t afi,
- uint8_t* p_uid);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93StayQuiet
-**
-** Description:
-** Send Stay Quiet command to the activated ISO 15693 tag.
-**
-** When the operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93StayQuiet(uint8_t* p_uid);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93ReadSingleBlock
-**
-** Description:
-** Send Read Single Block command to the activated ISO 15693 tag.
-**
-** Data is returned to the application using the NFA_DATA_EVT. When the
-** read operation has completed, or if an error occurs, the app will be
-** notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93ReadSingleBlock(uint8_t block_number);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93WriteSingleBlock
-**
-** Description:
-** Send Write Single Block command to the activated ISO 15693 tag.
-**
-** When the write operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93WriteSingleBlock(uint8_t block_number,
- uint8_t* p_data);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93LockBlock
-**
-** Description:
-** Send Lock block command to the activated ISO 15693 tag.
-**
-** When the operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93LockBlock(uint8_t block_number);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93ReadMultipleBlocks
-**
-** Description:
-** Send Read Multiple Block command to the activated ISO 15693 tag.
-**
-** Data is returned to the application using the NFA_DATA_EVT. When the
-** read operation has completed, or if an error occurs, the app will be
-** notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93ReadMultipleBlocks(uint8_t first_block_number,
- uint16_t number_blocks);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93WriteMultipleBlocks
-**
-** Description:
-** Send Write Multiple Block command to the activated ISO 15693 tag.
-**
-** When the write operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93WriteMultipleBlocks(uint8_t first_block_number,
- uint16_t number_blocks,
- uint8_t* p_data);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93Select
-**
-** Description:
-** Send Select command to the activated ISO 15693 tag.
-**
-** UID[0]: 0xE0, MSB
-** UID[1]: IC Mfg Code
-** ...
-** UID[7]: LSB
-**
-** When the operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93Select(uint8_t* p_uid);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93ResetToReady
-**
-** Description:
-** Send Reset to ready command to the activated ISO 15693 tag.
-**
-** When the operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93ResetToReady(void);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93WriteAFI
-**
-** Description:
-** Send Write AFI command to the activated ISO 15693 tag.
-**
-** When the operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93WriteAFI(uint8_t afi);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93LockAFI
-**
-** Description:
-** Send Lock AFI command to the activated ISO 15693 tag.
-**
-** When the operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93LockAFI(void);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93WriteDSFID
-**
-** Description:
-** Send Write DSFID command to the activated ISO 15693 tag.
-**
-** When the operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93WriteDSFID(uint8_t dsfid);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93LockDSFID
-**
-** Description:
-** Send Lock DSFID command to the activated ISO 15693 tag.
-**
-** When the operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93LockDSFID(void);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93GetSysInfo
-**
-** Description:
-** Send Get system information command to the activated ISO 15693 tag.
-** If UID is provided then set UID[0]:MSB, ... UID[7]:LSB
-**
-** When the operation has completed (or if an error occurs), the
-** app will be notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93GetSysInfo(uint8_t* p_uid);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93GetMultiBlockSecurityStatus
-**
-** Description:
-** Send Get Multiple block security status command to the activated ISO
-** 15693 tag.
-**
-** Data is returned to the application using the NFA_DATA_EVT. When the
-** read operation has completed, or if an error occurs, the app will be
-** notified with NFA_I93_CMD_CPLT_EVT.
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: ISO 15693 tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93GetMultiBlockSecurityStatus(
- uint8_t first_block_number, uint16_t number_blocks);
-
-/*******************************************************************************
-**
-** Function NFA_RwI93SetAddressingMode
-**
-** Description:
-** Set addressing mode to use to communicate with T5T tag.
-** mode = true: addressed (default if API not called)
-** mode = false: non-addressed
-**
-** Returns:
-** NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_WRONG_PROTOCOL: T5T tag not activated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_RwI93SetAddressingMode(bool mode);
-
-#endif /* NFA_RW_API_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_rw_int.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_rw_int.h
deleted file mode 100755
index e72b35f..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_rw_int.h
+++ /dev/null
@@ -1,386 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2003-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 is the private interface file for NFA_RW
- *
- ******************************************************************************/
-#ifndef NFA_RW_INT_H
-#define NFA_RW_INT_H
-
-#include "nfa_api.h"
-#include "nfa_rw_api.h"
-#include "nfa_sys.h"
-#include "nfc_api.h"
-#include "rw_api.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-/* Interval for performing presence check (in ms) */
-#ifndef NFA_RW_PRESENCE_CHECK_INTERVAL
-#define NFA_RW_PRESENCE_CHECK_INTERVAL 750
-#endif
-
-/* TLV detection status */
-#define NFA_RW_TLV_DETECT_ST_OP_NOT_STARTED 0x00 /* No Tlv detected */
-/* Lock control tlv detected */
-#define NFA_RW_TLV_DETECT_ST_LOCK_TLV_OP_COMPLETE 0x01
-/* Memory control tlv detected */
-#define NFA_RW_TLV_DETECT_ST_MEM_TLV_OP_COMPLETE 0x02
-/* Both Lock and Memory control Tlvs are detected */
-#define NFA_RW_TLV_DETECT_ST_COMPLETE 0x03
-
-/* Tag deselect cmd*/
-#define NFA_RW_TAG_DESELECT_CMD 0xC2
-
-#define NFA_RW_TAG_SLP_REQ_LEN 0x02
-
-/* Tag sleep req cmd*/
-extern uint8_t NFA_RW_TAG_SLP_REQ[];
-
-typedef uint8_t tNFA_RW_TLV_ST;
-
-/* RW events */
-enum {
- NFA_RW_OP_REQUEST_EVT = NFA_SYS_EVT_START(NFA_ID_RW),
- NFA_RW_ACTIVATE_NTF_EVT,
- NFA_RW_DEACTIVATE_NTF_EVT,
- NFA_RW_PRESENCE_CHECK_TICK_EVT,
- NFA_RW_PRESENCE_CHECK_TIMEOUT_EVT,
- NFA_RW_MAX_EVT
-};
-
-/* BTA_RW operations */
-enum {
- NFA_RW_OP_DETECT_NDEF,
- NFA_RW_OP_READ_NDEF,
- NFA_RW_OP_WRITE_NDEF,
- NFA_RW_OP_PRESENCE_CHECK,
- NFA_RW_OP_FORMAT_TAG,
- NFA_RW_OP_SEND_RAW_FRAME,
-
- /* Exclusive Type-1,Type-2 tag operations */
- NFA_RW_OP_DETECT_LOCK_TLV,
- NFA_RW_OP_DETECT_MEM_TLV,
- NFA_RW_OP_SET_TAG_RO,
-
- /* Exclusive Type-1 tag operations */
- NFA_RW_OP_T1T_RID,
- NFA_RW_OP_T1T_RALL,
- NFA_RW_OP_T1T_READ,
- NFA_RW_OP_T1T_WRITE,
- NFA_RW_OP_T1T_RSEG,
- NFA_RW_OP_T1T_READ8,
- NFA_RW_OP_T1T_WRITE8,
-
- /* Exclusive Type-2 tag operations */
- NFA_RW_OP_T2T_READ,
- NFA_RW_OP_T2T_WRITE,
- NFA_RW_OP_T2T_SECTOR_SELECT,
- NFA_RW_OP_T2T_READ_DYN_LOCKS,
-
- /* Exclusive Type-3 tag operations */
- NFA_RW_OP_T3T_READ,
- NFA_RW_OP_T3T_WRITE,
- NFA_RW_OP_T3T_GET_SYSTEM_CODES,
-
- /* Exclusive ISO 15693 tag operations */
- NFA_RW_OP_I93_INVENTORY,
- NFA_RW_OP_I93_STAY_QUIET,
- NFA_RW_OP_I93_READ_SINGLE_BLOCK,
- NFA_RW_OP_I93_WRITE_SINGLE_BLOCK,
- NFA_RW_OP_I93_LOCK_BLOCK,
- NFA_RW_OP_I93_READ_MULTI_BLOCK,
- NFA_RW_OP_I93_WRITE_MULTI_BLOCK,
- NFA_RW_OP_I93_SELECT,
- NFA_RW_OP_I93_RESET_TO_READY,
- NFA_RW_OP_I93_WRITE_AFI,
- NFA_RW_OP_I93_LOCK_AFI,
- NFA_RW_OP_I93_WRITE_DSFID,
- NFA_RW_OP_I93_LOCK_DSFID,
- NFA_RW_OP_I93_GET_SYS_INFO,
- NFA_RW_OP_I93_GET_MULTI_BLOCK_STATUS,
- NFA_RW_OP_I93_SET_ADDR_MODE,
- NFA_RW_OP_CI_ATTRIB,
- NFA_RW_OP_CI_UID,
- NFA_RW_OP_MAX
-};
-typedef uint8_t tNFA_RW_OP;
-
-/* Enumeration of parameter structios for nfa_rw operations */
-
-/* NFA_RW_OP_WRITE_NDEF params */
-typedef struct {
- uint32_t len;
- uint8_t* p_data;
-} tNFA_RW_OP_PARAMS_WRITE_NDEF;
-
-/* NFA_RW_OP_SEND_RAW_FRAME params */
-typedef struct {
- NFC_HDR* p_data;
-} tNFA_RW_OP_PARAMS_SEND_RAW_FRAME;
-
-/* NFA_RW_OP_SET_TAG_RO params */
-typedef struct {
- bool b_hard_lock;
-} tNFA_RW_OP_PARAMS_CONFIG_READ_ONLY;
-
-/* NFA_RW_OP_T1T_READ params */
-typedef struct {
- uint8_t segment_number;
- uint8_t block_number;
- uint8_t index;
-} tNFA_RW_OP_PARAMS_T1T_READ;
-
-/* NFA_RW_OP_T1T_WRITE_E8,NFA_RW_OP_T1T_WRITE_NE8
- NFA_RW_OP_T1T_WRITE_E, NFA_RW_OP_T1T_WRITE_NE params */
-typedef struct {
- bool b_erase;
- uint8_t block_number;
- uint8_t index;
- uint8_t p_block_data[8];
-} tNFA_RW_OP_PARAMS_T1T_WRITE;
-
-/* NFA_RW_OP_T2T_READ params */
-typedef struct {
- uint8_t block_number;
-} tNFA_RW_OP_PARAMS_T2T_READ;
-
-/* NFA_RW_OP_T2T_WRITE params */
-typedef struct {
- uint8_t block_number;
- uint8_t p_block_data[4];
-} tNFA_RW_OP_PARAMS_T2T_WRITE;
-
-/* NFA_RW_OP_T2T_SECTOR_SELECT params */
-typedef struct {
- uint8_t sector_number;
-} tNFA_RW_OP_PARAMS_T2T_SECTOR_SELECT;
-
-/* NFA_RW_OP_T2T_READ_DYN_LOCKS params */
-typedef struct {
- bool read_dyn_locks;
-} tNFA_RW_OP_PARAMS_T2T_READ_DYN_LOCKS;
-
-/* NFA_RW_OP_T3T_READ params */
-typedef struct {
- uint8_t num_blocks;
- tNFA_T3T_BLOCK_DESC* p_block_desc;
-} tNFA_RW_OP_PARAMS_T3T_READ;
-
-/* NFA_RW_OP_T3T_WRITE params */
-typedef struct {
- uint8_t num_blocks;
- tNFA_T3T_BLOCK_DESC* p_block_desc;
- uint8_t* p_block_data;
-} tNFA_RW_OP_PARAMS_T3T_WRITE;
-
-/* NFA_RW_OP_I93_XXX params */
-typedef struct {
- bool uid_present;
- uint8_t uid[I93_UID_BYTE_LEN];
- bool afi_present;
- uint8_t afi;
- uint8_t dsfid;
- bool addr_mode;
- uint16_t first_block_number;
- uint16_t number_blocks;
- uint8_t* p_data;
-} tNFA_RW_OP_PARAMS_I93_CMD;
-
-typedef struct {
- uint8_t nfcid0[NFC_NFCID0_MAX_LEN];
-} tNFA_RW_OP_PARAMS_CI;
-
-/* Union of params for all reader/writer operations */
-typedef union {
- /* params for NFA_RW_OP_WRITE_NDEF */
- tNFA_RW_OP_PARAMS_WRITE_NDEF write_ndef;
-
- /* params for NFA_RW_OP_SEND_RAW_FRAME */
- tNFA_RW_OP_PARAMS_SEND_RAW_FRAME send_raw_frame;
-
- /* params for NFA_RW_OP_SET_TAG_RO */
- tNFA_RW_OP_PARAMS_CONFIG_READ_ONLY set_readonly;
-
- /* params for NFA_RW_OP_T2T_READ and NFA_RW_OP_T1T_WRITE */
- tNFA_RW_OP_PARAMS_T1T_READ t1t_read;
- tNFA_RW_OP_PARAMS_T1T_WRITE t1t_write;
-
- /* params for NFA_RW_OP_T2T_READ,NFA_RW_OP_T2T_WRITE and
- * NFA_RW_OP_T2T_SECTOR_SELECT */
- tNFA_RW_OP_PARAMS_T2T_READ t2t_read;
- tNFA_RW_OP_PARAMS_T2T_WRITE t2t_write;
- tNFA_RW_OP_PARAMS_T2T_SECTOR_SELECT t2t_sector_select;
- tNFA_RW_OP_PARAMS_T2T_READ_DYN_LOCKS t2t_read_dyn_locks;
-
- /* params for NFA_RW_OP_T3T_READ and NFA_RW_OP_T3T_WRITE */
- tNFA_RW_OP_PARAMS_T3T_READ t3t_read;
- tNFA_RW_OP_PARAMS_T3T_WRITE t3t_write;
-
- /* params for NFA_RW_OP_PRESENCE_CHECK */
- tNFA_RW_PRES_CHK_OPTION option;
-
- /* params for ISO 15693 */
- tNFA_RW_OP_PARAMS_I93_CMD i93_cmd;
- tNFA_RW_OP_PARAMS_CI ci_param;
-
-} tNFA_RW_OP_PARAMS;
-
-/* data type for NFA_RW_op_req_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_RW_OP op; /* NFA RW operation */
- tNFA_RW_OP_PARAMS params;
-} tNFA_RW_OPERATION;
-
-/* data type for NFA_RW_ACTIVATE_NTF */
-typedef struct {
- NFC_HDR hdr;
- tNFC_ACTIVATE_DEVT* p_activate_params; /* Data from NFC_ACTIVATE_DEVT */
- bool excl_rf_not_active; /* TRUE if not in exclusive RF mode */
-} tNFA_RW_ACTIVATE_NTF;
-
-/* union of all data types */
-typedef union {
- /* GKI event buffer header */
- NFC_HDR hdr;
- tNFA_RW_OPERATION op_req;
- tNFA_RW_ACTIVATE_NTF activate_ntf;
-} tNFA_RW_MSG;
-
-/* NDEF detection status */
-enum {
- NFA_RW_NDEF_ST_UNKNOWN = 0, /* NDEF detection not performed yet */
- NFA_RW_NDEF_ST_TRUE, /* Tag is NDEF */
- NFA_RW_NDEF_ST_FALSE /* Tag is not NDEF */
-};
-typedef uint8_t tNFA_RW_NDEF_ST;
-
-/* flags for RW control block */
-/* Activation while not in exclusive RF mode */
-#define NFA_RW_FL_NOT_EXCL_RF_MODE 0x01
-/* Waiting for response from tag for auto-presence check */
-#define NFA_RW_FL_AUTO_PRESENCE_CHECK_BUSY 0x02
-/* Read only tag */
-#define NFA_RW_FL_TAG_IS_READONLY 0x04
-/* Busy retrieving additional tag information */
-#define NFA_RW_FL_ACTIVATION_NTF_PENDING 0x08
-/* Tag operation is in progress */
-#define NFA_RW_FL_API_BUSY 0x10
-/* Tag is been activated */
-#define NFA_RW_FL_ACTIVATED 0x20
-/* NDEF DETECTed OK */
-#define NFA_RW_FL_NDEF_OK 0x40
-
-#ifdef ST21NFC
-enum {
- NFA_RW_MIFARE_PRES_CHECK_NONE = 0,
- NFA_RW_MIFARE_PRES_CHECK_START,
- NFA_RW_MIFARE_PRES_CHECK_NORMAL,
- NFA_RW_MIFARE_PRES_CHECK_IDLE,
- NFA_RW_MIFARE_PRES_CHECK_AUTH_TX,
- NFA_RW_MIFARE_PRES_CHECK_AUTH_ON
-};
-#endif
-
-/* NFA RW control block */
-typedef struct {
- tNFA_RW_OP cur_op; /* Current operation */
-
- TIMER_LIST_ENT tle; /* list entry for nfa_rw timer */
- tNFA_RW_MSG*
- p_pending_msg; /* Pending API (if busy performing presence check) */
-
- /* Tag info */
- tNFC_PROTOCOL protocol;
- tNFC_INTF_TYPE intf_type;
- uint8_t pa_sel_res;
- tNFC_RF_TECH_N_MODE activated_tech_mode; /* activated technology and mode */
-
-#ifdef ST21NFC
- int mifare_pres_check_status;
- uint8_t mifare_auth_cmd[12];
-#endif
-
- bool b_hard_lock;
-
- tNFA_RW_MSG*
- p_buffer_rw_msg; /* Buffer to hold incoming cmd while reading tag id */
-
- /* TLV info */
- tNFA_RW_TLV_ST tlv_st; /* TLV detection status */
-
- /* NDEF info */
- tNFA_RW_NDEF_ST ndef_st; /* NDEF detection status */
- uint32_t ndef_max_size; /* max number of bytes available for NDEF data */
- uint32_t ndef_cur_size; /* current size of stored NDEF data (in bytes) */
- uint8_t* p_ndef_buf;
- uint32_t ndef_rd_offset; /* current read-offset of incoming NDEF data */
-
- /* Current NDEF Write info */
- uint8_t* p_ndef_wr_buf; /* Pointer to NDEF data being written */
- uint32_t ndef_wr_len; /* Length of NDEF data being written */
-
- /* Reactivating type 2 tag after NACK rsp */
- tRW_EVENT halt_event; /* Event ID from stack after NACK response */
- tRW_DATA rw_data; /* Event Data from stack after NACK response */
- bool skip_dyn_locks; /* To skip reading dynamic locks during NDEF Detect */
-
- /* Flags (see definitions for NFA_RW_FL_* ) */
- uint8_t flags;
-
- /* ISO 15693 tag memory information */
- uint16_t i93_afi_location;
- uint8_t i93_dsfid;
- uint8_t i93_block_size;
- uint16_t i93_num_block;
- uint8_t i93_uid[I93_UID_BYTE_LEN];
- uint8_t i93_addr_mode;
-} tNFA_RW_CB;
-extern tNFA_RW_CB nfa_rw_cb;
-
-/* type definition for action functions */
-typedef bool (*tNFA_RW_ACTION)(tNFA_RW_MSG* p_data);
-
-/* Internal nfa_rw function prototypes */
-extern void nfa_rw_stop_presence_check_timer(void);
-
-/* Action function prototypes */
-extern bool nfa_rw_handle_op_req(tNFA_RW_MSG* p_data);
-extern bool nfa_rw_activate_ntf(tNFA_RW_MSG* p_data);
-extern bool nfa_rw_deactivate_ntf(tNFA_RW_MSG* p_data);
-extern bool nfa_rw_presence_check_tick(tNFA_RW_MSG* p_data);
-extern bool nfa_rw_presence_check_timeout(tNFA_RW_MSG* p_data);
-extern void nfa_rw_handle_sleep_wakeup_rsp(tNFC_STATUS status);
-extern void nfa_rw_handle_presence_check_rsp(tNFC_STATUS status);
-extern void nfa_rw_command_complete(void);
-extern bool nfa_rw_handle_event(NFC_HDR* p_msg);
-
-extern void nfa_rw_free_ndef_rx_buf(void);
-extern void nfa_rw_sys_disable(void);
-
-#ifdef ST21NFC
-extern void nfa_rw_check_mifare_data(NFC_HDR* p_data);
-extern void nfa_rw_set_mifare_deactivated();
-#endif
-
-#endif /* NFA_DM_INT_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_sys.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_sys.h
deleted file mode 100755
index 3c237b9..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_sys.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2003-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 is the public interface file for the BTA system manager.
- *
- ******************************************************************************/
-#ifndef NFA_SYS_H
-#define NFA_SYS_H
-
-#include "gki.h"
-#include "nfa_api.h"
-#include "nfc_target.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-/* SW sub-systems */
-enum {
- NFA_ID_SYS, /* system manager */
- NFA_ID_DM, /* device manager */
- NFA_ID_EE, /* NFCEE sub-system */
- NFA_ID_RW, /* Reader/writer sub-system */
- NFA_ID_CE, /* Card-emulation sub-system */
- NFA_ID_HCI, /* Host controller interface sub-system*/
- NFA_ID_WLC, /* WLC sub-system */
-#if (NFA_DTA_INCLUDED == TRUE)
- NFA_ID_DTA, /* Device Test Application sub-system */
-#endif
- NFA_ID_T4TNFCEE, /* T4T Nfcee sub-system */
- NFA_ID_MAX
-};
-typedef uint8_t tNFA_SYS_ID;
-
-/* enable function type */
-typedef void(tNFA_SYS_ENABLE)(void);
-
-/* event handler function type */
-typedef bool(tNFA_SYS_EVT_HDLR)(NFC_HDR* p_msg);
-
-/* disable function type */
-typedef void(tNFA_SYS_DISABLE)(void);
-
-/* function type for processing the change of NFCC power mode */
-typedef void(tNFA_SYS_PROC_NFCC_PWR_MODE)(uint8_t nfcc_power_mode);
-
-typedef void(tNFA_SYS_ENABLE_CBACK)(void);
-typedef void(tNFA_SYS_PROC_NFCC_PWR_MODE_CMPL)(void);
-
-/* registration structure */
-typedef struct {
- tNFA_SYS_ENABLE* enable;
- tNFA_SYS_EVT_HDLR* evt_hdlr;
- tNFA_SYS_DISABLE* disable;
- tNFA_SYS_PROC_NFCC_PWR_MODE* proc_nfcc_pwr_mode;
-} tNFA_SYS_REG;
-
-/* system manager configuration structure */
-typedef struct {
- uint16_t mbox_evt; /* GKI mailbox event */
- uint8_t mbox; /* GKI mailbox id */
- uint8_t timer; /* GKI timer id */
-} tNFA_SYS_CFG;
-
-/*****************************************************************************
-** Global data
-*****************************************************************************/
-
-/*****************************************************************************
-** Macros
-*****************************************************************************/
-
-/* Calculate start of event enumeration; id is top 8 bits of event */
-#define NFA_SYS_EVT_START(id) ((id) << 8)
-
-/*****************************************************************************
-** Function declarations
-*****************************************************************************/
-
-extern void nfa_sys_init(void);
-extern void nfa_sys_event(NFC_HDR* p_msg);
-extern void nfa_sys_timer_update(void);
-extern void nfa_sys_disable_timers(void);
-
-extern void nfa_sys_register(uint8_t id, const tNFA_SYS_REG* p_reg);
-extern void nfa_sys_deregister(uint8_t id);
-extern void nfa_sys_check_disabled(void);
-extern bool nfa_sys_is_register(uint8_t id);
-extern void nfa_sys_disable_subsystems(bool graceful);
-extern void nfa_sys_enable_subsystems(void);
-
-extern bool nfa_sys_is_graceful_disable(void);
-extern void nfa_sys_sendmsg(void* p_msg);
-extern void nfa_sys_start_timer(TIMER_LIST_ENT* p_tle, uint16_t type,
- int32_t timeout);
-extern void nfa_sys_stop_timer(TIMER_LIST_ENT* p_tle);
-
-extern void nfa_sys_cback_reg_enable_complete(tNFA_SYS_ENABLE_CBACK* p_cback);
-extern void nfa_sys_cback_notify_enable_complete(uint8_t id);
-
-extern void nfa_sys_notify_nfcc_power_mode(uint8_t nfcc_power_mode);
-extern void nfa_sys_cback_reg_nfcc_power_mode_proc_complete(
- tNFA_SYS_PROC_NFCC_PWR_MODE_CMPL* p_cback);
-extern void nfa_sys_cback_notify_nfcc_power_mode_proc_complete(uint8_t id);
-extern void nfa_sys_cback_notify_partial_enable_complete(uint8_t id);
-#endif /* NFA_SYS_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_sys_int.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_sys_int.h
deleted file mode 100755
index e040b1b..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_sys_int.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/******************************************************************************
- *
- * 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 is the private interface file for the NFA system manager.
- *
- ******************************************************************************/
-#ifndef NFA_SYS_INT_H
-#define NFA_SYS_INT_H
-
-#include "nfa_sys_ptim.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-/* nfa_sys flags */
-#define NFA_SYS_FL_INITIALIZED 0x00000001 /* nfa_sys initialized */
-
-/*****************************************************************************
-** state table
-*****************************************************************************/
-
-/* system manager control block */
-typedef struct {
- uint32_t flags; /* nfa_sys flags (must be first element of structure) */
- tNFA_SYS_REG* reg[NFA_ID_MAX]; /* registration structures */
- bool is_reg[NFA_ID_MAX]; /* registration structures */
- tPTIM_CB ptim_cb; /* protocol timer list */
- tNFA_SYS_ENABLE_CBACK* p_enable_cback;
- uint16_t enable_cplt_flags;
- uint16_t enable_cplt_mask;
-
- tNFA_SYS_PROC_NFCC_PWR_MODE_CMPL* p_proc_nfcc_pwr_mode_cmpl_cback;
- uint16_t proc_nfcc_pwr_mode_cplt_flags;
- uint16_t proc_nfcc_pwr_mode_cplt_mask;
-
- bool graceful_disable; /* TRUE if NFA_Disable () is called with TRUE */
- bool timers_disabled; /* TRUE if sys timers disabled */
-} tNFA_SYS_CB;
-
-/*****************************************************************************
-** Global variables
-*****************************************************************************/
-
-/* system manager control block */
-extern tNFA_SYS_CB nfa_sys_cb;
-
-/* system manager configuration structure */
-extern tNFA_SYS_CFG* p_nfa_sys_cfg;
-
-#endif /* NFA_SYS_INT_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_sys_ptim.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_sys_ptim.h
deleted file mode 100755
index 1582012..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_sys_ptim.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2003-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.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * Protocol timer services.
- *
- ******************************************************************************/
-#ifndef NFA_SYS_PTIM_H
-#define NFA_SYS_PTIM_H
-
-#include "gki.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-
-typedef struct {
- TIMER_LIST_Q timer_queue; /* GKI timer queue */
- int32_t period; /* Timer period in milliseconds */
- uint32_t last_gki_ticks; /* GKI ticks since last time update called */
- uint8_t timer_id; /* GKI timer id */
-} tPTIM_CB;
-
-/*****************************************************************************
-** Function Declarations
-*****************************************************************************/
-
-/*******************************************************************************
-**
-** Function nfa_sys_ptim_init
-**
-** Description Initialize a protocol timer service control block.
-**
-** Returns void
-**
-*******************************************************************************/
-extern void nfa_sys_ptim_init(tPTIM_CB* p_cb, uint16_t period,
- uint8_t timer_id);
-
-/*******************************************************************************
-**
-** Function nfa_sys_ptim_timer_update
-**
-** Description Update the protocol timer list and handle expired timers.
-**
-** Returns void
-**
-*******************************************************************************/
-extern void nfa_sys_ptim_timer_update(tPTIM_CB* p_cb);
-
-/*******************************************************************************
-**
-** Function nfa_sys_ptim_start_timer
-**
-** Description Start a protocol timer for the specified amount
-** of time in milliseconds.
-**
-** Returns void
-**
-*******************************************************************************/
-extern void nfa_sys_ptim_start_timer(tPTIM_CB* p_cb, TIMER_LIST_ENT* p_tle,
- uint16_t type, int32_t timeout);
-
-/*******************************************************************************
-**
-** Function nfa_sys_ptim_stop_timer
-**
-** Description Stop a protocol timer.
-**
-** Returns void
-**
-*******************************************************************************/
-extern void nfa_sys_ptim_stop_timer(tPTIM_CB* p_cb, TIMER_LIST_ENT* p_tle);
-
-#endif /* NFA_SYS_PTIM_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_wlc_api.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_wlc_api.h
deleted file mode 100755
index 970554e..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_wlc_api.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2023 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.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * NFA wireless charging API functions
- *
- ******************************************************************************/
-#ifndef NFA_WLC_API_H
-#define NFA_WLC_API_H
-
-#include "nfa_api.h"
-#include "nfc_target.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-enum {
- NFA_WLC_NON_AUTONOMOUS = 0, /* Default behavior: DH handles WLC protocol */
- NFA_WLC_SEMI_AUTONOMOUS, /* WLC protocol split between DH and NFCC */
- NFA_WLC_AUTONOMOUS /* NFCC handles WLC protocol */
-};
-typedef uint8_t tNFA_WLC_MODE;
-
-/*****************************************************************************
-** NFA WLC Constants and definitions
-*****************************************************************************/
-
-/* Union of all WLC callback structures */
-typedef union {
- tNFA_STATUS status; /* NFA_WLC_..._EVT */
- uint8_t wpt_end_cdt;
- uint8_t deact_reason;
-
-} tNFA_WLC_EVT_DATA;
-
-/* NFA WLC callback events */
-typedef enum {
- NFA_WLC_ENABLE_RESULT_EVT, /* The status for NFA_WlcEnable () */
- NFA_WLC_START_RESULT_EVT, /* The status for NFA_WlcStart () */
- NFA_WLC_START_WPT_RESULT_EVT, /* The status for NFA_WlcStartWPT () */
- NFA_WLC_CHARGING_RESULT_EVT, /* Notification of WPT_START completion */
-} tNFA_WLC_EVT;
-
-/* NFA WLC Callback */
-typedef void(tNFA_WLC_CBACK)(tNFA_WLC_EVT event, tNFA_WLC_EVT_DATA* p_data);
-
-/*****************************************************************************
-** External Function Declarations
-*****************************************************************************/
-
-/*******************************************************************************
-**
-** Function NFA_WlcEnable
-**
-** Description This function enables WLC module callback. Prior to calling
-** NFA_WlcEnable, WLC module must be enabled by NFA system
-** manager (done when NFA_Enable called).
-**
-** When the enabling is completed, an NFA_WLC_ENABLE_RESULT_EVT
-** is returned to the application using the tNFA_WLC_CBACK.
-**
-** p_wlc_cback: callback to notify later NFCC events
-**
-** Returns NFA_STATUS_OK if successfully initiated
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_WlcEnable(tNFA_WLC_CBACK* p_wlc_cback);
-
-/*******************************************************************************
-**
-** Function NFA_WlcStart
-**
-** Description Perform the WLC start procedure.
-**
-** Upon successful completion of RF Interface Extension start
-** (according to the NFC Forum NCI2.3 conditions) and upload
-** of WLC Poller parameters (Non-Autonomous mode only),
-** an NFA_WLC_START_RESULT_EVT is returned to the application
-** using the tNFA_WLC_CBACK.
-**
-** mode: WLC-P Non-Autonomous (0) or Semi-Autonomous mode
-**
-** Returns:
-** NFA_STATUS_OK if successfully started
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_WlcStart(tNFA_WLC_MODE mode);
-
-/*******************************************************************************
-**
-** Function NFA_WlcStartWPT
-**
-** Description Start a wireless power transfer cycle in Non-Autonomous
-** WLCP mode ([WLC2.0] Technical Specifications state 21
-** for negotiated or state 6 for static WLC mode).
-**
-** Upon successful completion of WPT start,
-** an NFA_WLC_START_WPT_RESULT_EVT is returned to the
-*application
-** using the tNFA_WLC_CBACK.
-**
-** When the duration for the power transfer ends or
-** any error/completion condition occurred, NFCC notifies the
-*DH
-** with an NFA_WLC_CHARGING_RESULT_EVT and end condition value.
-**
-** power_adj_req: POWER_ADUJUST_REQ as defined in [WLC]
-** wpt_time_int: WPT_INT_TIME as defined in [WLC]
-**
-** Returns:
-** NFA_STATUS_OK if successfully started
-** NFA_STATUS_FAILED otherwise
-**
-*******************************************************************************/
-extern tNFA_STATUS NFA_WlcStartWPT(uint8_t power_adj_req, uint8_t wpt_time_int);
-
-#endif /* NFA_WLC_API_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_wlc_int.h b/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_wlc_int.h
deleted file mode 100755
index a885ff2..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfa/include/nfa_wlc_int.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2023 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.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * This is the private interface file for NFA_WLC
- *
- ******************************************************************************/
-#ifndef NFA_WLC_INT_H
-#define NFA_WLC_INT_H
-
-#include "nfa_api.h"
-#include "nfa_sys.h"
-#include "nfa_wlc_api.h"
-#include "nfc_api.h"
-
-/*****************************************************************************
-** Constants and data types
-*****************************************************************************/
-#define WPT_DURATION_INT_MASK 0xC0
-#define WPT_DURATION_INT_MAX 0x13
-
-#define POWER_ADJ_REQ_INC_MAX 0x14
-#define POWER_ADJ_REQ_DEC_MIN 0xF6
-
-#define NCI_WPT_START_CMD_SIZE 6
-
-/* NFA_WLC flags */
-/* WLC is enabled */
-#define NFA_WLC_FLAGS_NON_AUTO_MODE_ENABLED 0x00000001
-/* Waiting for end of power transfer phase */
-#define NFA_WLC_FLAGS_WPT_NTF_PENDING 0x00000002
-
-/* WLC events */
-enum {
- /* device manager local device API events */
- NFA_WLC_API_ENABLE_EVT = NFA_SYS_EVT_START(NFA_ID_WLC),
- NFA_WLC_API_START_EVT,
- // NFA_WLC_API_STOP_EVT,
- NFA_WLC_API_NON_AUTO_START_WPT_EVT,
- NFA_WLC_API_REMOVE_EP_EVT,
-};
-
-/* WLC control block */
-typedef struct {
- uint32_t flags; /* NFA_WLC flags (see definitions for NFA_WLC_FLAGS_*) */
- tNFA_WLC_CBACK* p_wlc_cback; /* NFA WLC callback */
-
- /* NFCC power mode */
- uint8_t wlc_mode;
-} tNFA_WLC_CB;
-extern tNFA_WLC_CB nfa_wlc_cb;
-
-/* data type for NFA_DM_API_ENABLE_EVT */
-typedef struct {
- NFC_HDR hdr;
- // tNFA_DM_CBACK* p_dm_cback;
- tNFA_WLC_CBACK* p_wlc_cback;
-} tNFA_WLC_API_ENABLE;
-
-/* data type for NFA_WLC_API_START_EVT */
-typedef struct {
- NFC_HDR hdr;
- tNFA_WLC_MODE mode;
-} tNFA_WLC_API_START;
-
-/* data type for NFA_WLC_API_NON_AUTO_START_WPT_EVT */
-typedef struct {
- NFC_HDR hdr;
- uint8_t power_adj_req;
- uint8_t wpt_time_int;
-} tNFA_WLC_API_NON_AUTO_START_WPT;
-
-/* union of all data types */
-typedef union {
- /* GKI event buffer header */
- NFC_HDR hdr; /* For NFA_WLC_API_STOP_EVT */
- tNFA_WLC_API_ENABLE enable;
- tNFA_WLC_API_START start;
- tNFA_WLC_API_NON_AUTO_START_WPT non_auto_start_wpt;
-} tNFA_WLC_MSG;
-
-/* type definition for action functions */
-typedef bool (*tNFA_WLC_ACTION)(tNFA_WLC_MSG* p_data);
-
-/* Action function prototypes */
-extern bool nfa_wlc_enable(tNFA_WLC_MSG* p_data);
-extern bool nfa_wlc_start(tNFA_WLC_MSG* p_data);
-extern bool nfa_wlc_non_auto_start_wpt(tNFA_WLC_MSG* p_data);
-
-extern void nfa_wlc_init(void);
-extern void nfa_wlc_event_notify(tNFA_WLC_EVT event, tNFA_WLC_EVT_DATA* p_data);
-
-#endif /* NFA_WLC_INT_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc/include/ce_api.h b/libstpropnci/libstnfc-nci-headers/src/nfc/include/ce_api.h
deleted file mode 100755
index 1ed0f91..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc/include/ce_api.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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 the Near Field Communication (NFC) Card Emulation
- * mode related API function external definitions.
- *
- ******************************************************************************/
-
-#ifndef CE_API_H
-#define CE_API_H
-
-#include <stdbool.h>
-#include "nfc_api.h"
-#include "nfc_types.h"
-#include "tags_defs.h"
-
-#define CE_T3T_FIRST_EVT 0x60
-#define CE_T4T_FIRST_EVT 0x80
-
-enum {
- CE_T3T_NDEF_UPDATE_START_EVT = CE_T3T_FIRST_EVT,
- CE_T3T_NDEF_UPDATE_CPLT_EVT,
- CE_T3T_UPDATE_EVT,
- CE_T3T_RAW_FRAME_EVT,
-
- CE_T4T_NDEF_UPDATE_START_EVT = CE_T4T_FIRST_EVT,
- CE_T4T_NDEF_UPDATE_CPLT_EVT,
- CE_T4T_NDEF_UPDATE_ABORT_EVT,
- CE_T4T_RAW_FRAME_EVT
-};
-
-typedef uint8_t tCE_EVENT;
-
-typedef struct {
- tNFC_STATUS status;
- uint8_t* p_data;
- bool b_updated;
- uint32_t length;
-} tCE_UPDATE_INFO;
-
-typedef struct {
- tNFC_STATUS status;
- uint8_t aid_handle;
- NFC_HDR* p_data;
-} tCE_RAW_FRAME;
-
-typedef union {
- tNFC_STATUS status;
- tCE_UPDATE_INFO update_info;
- tCE_RAW_FRAME raw_frame;
-} tCE_DATA;
-
-typedef void(tCE_CBACK)(tCE_EVENT event, tCE_DATA* p_data);
-
-/* T4T definitions */
-typedef uint8_t tCE_T4T_AID_HANDLE; /* Handle for AID registration */
-/* Invalid tCE_T4T_AID_HANDLE */
-#define CE_T4T_AID_HANDLE_INVALID 0xFF
-/* reserved handle for wildcard aid */
-#define CE_T4T_WILDCARD_AID_HANDLE (CE_T4T_MAX_REG_AID)
-
-/*******************************************************************************
-**
-** Function CE_T3tSetLocalNDEFMsg
-**
-** Description Initialise CE Type 3 Tag with mandatory NDEF message
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern tNFC_STATUS CE_T3tSetLocalNDEFMsg(bool read_only, uint32_t size_max,
- uint32_t size_current, uint8_t* p_buf,
- uint8_t* p_scratch_buf);
-
-/*******************************************************************************
-**
-** Function CE_T3tSetLocalNDefParams
-**
-** Description Sets T3T-specific NDEF parameters. (Optional - if not
-** called, then CE will use default parameters)
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern tNFC_STATUS CE_T3tSetLocalNDefParams(uint8_t nbr, uint8_t nbw);
-
-/*******************************************************************************
-**
-** Function CE_T3tSendCheckRsp
-**
-** Description Send CHECK response message
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern tNFC_STATUS CE_T3tSendCheckRsp(uint8_t status1, uint8_t status2,
- uint8_t num_blocks,
- uint8_t* p_block_data);
-
-/*******************************************************************************
-**
-** Function CE_T3tSendUpdateRsp
-**
-** Description Send UPDATE response message
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern tNFC_STATUS CE_T3tSendUpdateRsp(uint8_t status1, uint8_t status2);
-
-/*******************************************************************************
-**
-** Function CE_T4tSetLocalNDEFMsg
-**
-** Description Initialise CE Type 4 Tag with mandatory NDEF message
-**
-** The following event may be returned
-** CE_T4T_UPDATE_START_EVT for starting update
-** CE_T4T_UPDATE_CPLT_EVT for complete update
-** CE_T4T_UPDATE_ABORT_EVT for failure of update
-** CE_T4T_RAW_FRAME_EVT for raw frame
-**
-** read_only: TRUE if read only
-** ndef_msg_max: Max NDEF message size
-** ndef_msg_len: NDEF message size
-** p_ndef_msg: NDEF message (excluding NLEN)
-** p_scratch_buf: temp storage for update
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern tNFC_STATUS CE_T4tSetLocalNDEFMsg(bool read_only, uint16_t ndef_msg_max,
- uint16_t ndef_msg_len,
- uint8_t* p_ndef_msg,
- uint8_t* p_scratch_buf);
-
-/*******************************************************************************
-**
-** Function CE_T4tRegisterAID
-**
-** Description Register AID in CE T4T
-**
-** aid_len: length of AID (up to NFC_MAX_AID_LEN)
-** p_aid: AID
-** p_cback: Raw frame will be forwarded with CE_RAW_FRAME_EVT
-**
-** Returns tCE_T4T_AID_HANDLE if successful,
-** CE_T4T_AID_HANDLE_INVALID otherwisse
-**
-*******************************************************************************/
-extern tCE_T4T_AID_HANDLE CE_T4tRegisterAID(uint8_t aid_len, uint8_t* p_aid,
- tCE_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function CE_T4tDeregisterAID
-**
-** Description Deregister AID in CE T4T
-**
-** aid_len: length of AID (up to NFC_MAX_AID_LEN)
-** p_aid: AID
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern void CE_T4tDeregisterAID(tCE_T4T_AID_HANDLE aid_handle);
-
-/*******************************************************************************
-**
-** Function CE_SendRawFrame
-**
-** Description This function sends a raw frame to the peer device.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS CE_SendRawFrame(uint8_t* p_raw_data, uint16_t data_len);
-
-/*******************************************************************************
-**
-** Function CE_SetActivatedTagType
-**
-** Description This function selects the tag type for Reader/Writer mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS CE_SetActivatedTagType(tNFC_ACTIVATE_DEVT* p_activate_params,
- uint16_t t3t_system_code,
- tCE_CBACK* p_cback);
-#endif /* CE_API_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc/include/ce_int.h b/libstpropnci/libstnfc-nci-headers/src/nfc/include/ce_int.h
deleted file mode 100755
index 5a1d74f..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc/include/ce_int.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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 the Near Field Communication (NFC) Card Emulation
- * mode related internal function / definitions.
- *
- ******************************************************************************/
-
-#ifndef CE_INT_H_
-#define CE_INT_H_
-
-#include "ce_api.h"
-
-#if (CE_TEST_INCLUDED == FALSE)
-#define CE_MIN_SUP_PROTO NCI_PROTOCOL_FELICA
-#define CE_MAX_SUP_PROTO NCI_PROTOCOL_ISO4
-#else
-#define CE_MIN_SUP_PROTO NCI_PROTOCOL_TYPE1
-#define CE_MAX_SUP_PROTO NCI_PROTOCOL_MIFARE
-#endif
-
-/* CE Type 3 Tag structures */
-
-/* Type 3 Tag NDEF card-emulation */
-typedef struct {
- bool initialized;
- uint8_t version; /* Ver: peer version */
- uint8_t
- nbr; /* NBr: number of blocks that can be read using one Check command */
- uint8_t nbw; /* Nbw: number of blocks that can be written using one Update
- command */
- uint16_t nmaxb; /* Nmaxb: maximum number of blocks available for NDEF data */
- uint8_t writef; /* WriteFlag: 00h if writing data finished; 0Fh if writing
- data in progress */
- uint8_t
- rwflag; /* RWFlag: 00h NDEF is read-only; 01h if read/write available */
- uint32_t ln;
- uint8_t* p_buf; /* Current contents for READs */
-
- /* Scratch NDEF buffer (for update NDEF commands) */
- uint8_t scratch_writef;
- uint32_t scratch_ln;
- uint8_t* p_scratch_buf; /* Scratch buffer for WRITE/readback */
-} tCE_T3T_NDEF_INFO;
-
-/* Type 3 Tag current command processing */
-typedef struct {
- uint16_t service_code_list[T3T_MSG_SERVICE_LIST_MAX];
- uint8_t* p_block_list_start;
- uint8_t* p_block_data_start;
- uint8_t num_services;
- uint8_t num_blocks;
-} tCE_T3T_CUR_CMD;
-
-/* Type 3 Tag control block */
-typedef struct {
- uint8_t state;
- uint16_t system_code;
- uint8_t local_nfcid2[NCI_RF_F_UID_LEN];
- uint8_t local_pmm[NCI_T3T_PMM_LEN];
- tCE_T3T_NDEF_INFO ndef_info;
- tCE_T3T_CUR_CMD cur_cmd;
-} tCE_T3T_MEM;
-
-/* CE Type 4 Tag control blocks */
-typedef struct {
- uint8_t aid_len;
- uint8_t aid[NFC_MAX_AID_LEN];
- tCE_CBACK* p_cback;
-} tCE_T4T_REG_AID; /* registered AID table */
-
-typedef struct {
- TIMER_LIST_ENT timer; /* timeout for update file */
- uint8_t cc_file[T4T_FC_TLV_OFFSET_IN_CC + T4T_FILE_CONTROL_TLV_SIZE];
- uint8_t* p_ndef_msg; /* storage of NDEF message */
- uint16_t nlen; /* current size of NDEF message */
- uint16_t max_file_size; /* size of storage + 2 bytes for NLEN */
- uint8_t* p_scratch_buf; /* temp storage of NDEF message for update */
-
-/* T4T CE App is selected */
-#define CE_T4T_STATUS_T4T_APP_SELECTED 0x01
-/* Registered AID is selected */
-#define CE_T4T_STATUS_REG_AID_SELECTED 0x02
-/* CC file is selected */
-#define CE_T4T_STATUS_CC_FILE_SELECTED 0x04
-/* NDEF file is selected */
-#define CE_T4T_STATUS_NDEF_SELECTED 0x08
-/* NDEF is read-only */
-#define CE_T4T_STATUS_NDEF_FILE_READ_ONLY 0x10
-/* NDEF is updating */
-#define CE_T4T_STATUS_NDEF_FILE_UPDATING 0x20
-/* Wildcard AID selected */
-#define CE_T4T_STATUS_WILDCARD_AID_SELECTED 0x40
-
- uint8_t status;
-
- tCE_CBACK* p_wildcard_aid_cback; /* registered wildcard AID callback */
- tCE_T4T_REG_AID reg_aid[CE_T4T_MAX_REG_AID]; /* registered AID table */
- uint8_t selected_aid_idx;
-} tCE_T4T_MEM;
-
-/* CE memory control blocks */
-typedef struct {
- tCE_T3T_MEM t3t;
- tCE_T4T_MEM t4t;
-} tCE_MEM;
-
-/* CE control blocks */
-typedef struct {
- tCE_MEM mem;
- tCE_CBACK* p_cback;
- uint8_t* p_ndef; /* the memory starting from NDEF */
- uint16_t ndef_max; /* max size of p_ndef */
- uint16_t ndef_cur; /* current size of p_ndef */
- tNFC_RF_TECH tech;
-} tCE_CB;
-
-/*
-** CE Type 4 Tag Definition
-*/
-
-/* Max data size using a single ReadBinary. 2 bytes are for status bytes */
-#define CE_T4T_MAX_LE \
- (NFC_CE_POOL_BUF_SIZE - NFC_HDR_SIZE - NCI_MSG_OFFSET_SIZE - \
- NCI_DATA_HDR_SIZE - T4T_RSP_STATUS_WORDS_SIZE)
-
-/* Max data size using a single UpdateBinary. 6 bytes are for CLA, INS, P1, P2,
- * Lc */
-#define CE_T4T_MAX_LC \
- (NFC_CE_POOL_BUF_SIZE - NFC_HDR_SIZE - NCI_DATA_HDR_SIZE - \
- T4T_CMD_MAX_HDR_SIZE)
-
-/*****************************************************************************
-** EXTERNAL FUNCTION DECLARATIONS
-*****************************************************************************/
-
-/* Global NFC data */
-extern tCE_CB ce_cb;
-
-extern void ce_init(void);
-
-/* ce_t3t internal functions */
-void ce_t3t_init(void);
-tNFC_STATUS ce_select_t3t(uint16_t system_code,
- uint8_t nfcid2[NCI_RF_F_UID_LEN]);
-
-/* ce_t4t internal functions */
-extern tNFC_STATUS ce_select_t4t(void);
-extern void ce_t4t_process_timeout(TIMER_LIST_ENT* p_tle);
-
-#endif /* CE_INT_H_ */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc/include/nci_hmsgs.h b/libstpropnci/libstnfc-nci-headers/src/nfc/include/nci_hmsgs.h
deleted file mode 100755
index 112b13c..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc/include/nci_hmsgs.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * defines NCI interface messages (for DH)
- *
- ******************************************************************************/
-#ifndef NFC_NCI_HMSGS_H
-#define NFC_NCI_HMSGS_H
-
-#include <stdbool.h>
-
-#include "nci_defs.h"
-#include "nfc_target.h"
-#include "nfc_types.h"
-
-bool nci_proc_core_rsp(NFC_HDR* p_msg);
-void nci_proc_rf_management_rsp(NFC_HDR* p_msg);
-void nci_proc_ee_management_rsp(NFC_HDR* p_msg);
-void nci_proc_core_ntf(NFC_HDR* p_msg);
-void nci_proc_rf_management_ntf(NFC_HDR* p_msg);
-void nci_proc_ee_management_ntf(NFC_HDR* p_msg);
-void nci_proc_prop_rsp(NFC_HDR* p_msg);
-void nci_proc_prop_raw_vs_rsp(NFC_HDR* p_msg);
-void nci_proc_prop_ntf(NFC_HDR* p_msg);
-
-uint8_t nci_snd_core_reset(uint8_t reset_type);
-uint8_t nci_snd_core_init(uint8_t nci_version);
-uint8_t nci_snd_core_get_config(uint8_t* param_ids, uint8_t num_ids);
-uint8_t nci_snd_core_set_config(uint8_t* p_param_tlvs, uint8_t tlv_size);
-
-uint8_t nci_snd_core_conn_create(uint8_t dest_type, uint8_t num_tlv,
- uint8_t tlv_size, uint8_t* p_param_tlvs);
-uint8_t nci_snd_core_conn_close(uint8_t conn_id);
-
-uint8_t nci_snd_discover_cmd(uint8_t num, tNCI_DISCOVER_PARAMS* p_param);
-
-uint8_t nci_snd_discover_select_cmd(uint8_t rf_disc_id, uint8_t protocol,
- uint8_t rf_interface);
-uint8_t nci_snd_deactivate_cmd(uint8_t de_act_type);
-uint8_t nci_snd_discover_map_cmd(uint8_t num, tNCI_DISCOVER_MAPS* p_maps);
-uint8_t nci_snd_t3t_polling(uint16_t system_code, uint8_t rc, uint8_t tsn);
-uint8_t nci_snd_parameter_update_cmd(uint8_t* p_param_tlvs, uint8_t tlv_size);
-uint8_t nci_snd_iso_dep_nak_presence_check_cmd();
-uint8_t nci_snd_core_set_power_sub_state(uint8_t screen_state);
-
-#if (NFC_NFCEE_INCLUDED == TRUE && NFC_RW_ONLY == FALSE)
-uint8_t nci_snd_nfcee_discover(uint8_t discover_action);
-uint8_t nci_snd_nfcee_mode_set(uint8_t nfcee_id, uint8_t nfcee_mode);
-uint8_t nci_snd_set_routing_cmd(bool more, uint8_t num_tlv, uint8_t tlv_size,
- uint8_t* p_param_tlvs);
-uint8_t nci_snd_get_routing_cmd(void);
-uint8_t nci_snd_nfcee_power_link_control(uint8_t nfcee_id, uint8_t pl_config);
-#endif
-
-uint8_t nci_snd_rf_extension_control_cmd(uint8_t mode, uint8_t rf_ext_id,
- uint8_t* p_data, uint8_t data_len);
-uint8_t nci_snd_ep_removal_detection_cmd(uint8_t waiting_time);
-uint8_t nci_snd_rf_wpt_control_cmd(uint8_t* p_param_tlvs, uint8_t tlv_size);
-uint8_t nci_snd_android_get_caps_cmd(void);
-
-#endif /* NFC_NCI_MSGS_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc/include/ndef_utils.h b/libstpropnci/libstnfc-nci-headers/src/nfc/include/ndef_utils.h
deleted file mode 100755
index c3cf09f..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc/include/ndef_utils.h
+++ /dev/null
@@ -1,360 +0,0 @@
-/******************************************************************************
- *
- * 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 definitions for some utility functions to help parse
- * and build NFC Data Exchange Format (NDEF) messages
- *
- ******************************************************************************/
-
-#ifndef NDEF_UTILS_H
-#define NDEF_UTILS_H
-
-#include "bt_types.h"
-
-#define NDEF_MB_MASK 0x80 /* Message Begin */
-#define NDEF_ME_MASK 0x40 /* Message End */
-#define NDEF_CF_MASK 0x20 /* Chunk Flag */
-#define NDEF_SR_MASK 0x10 /* Short Record */
-#define NDEF_IL_MASK 0x08 /* ID Length */
-#define NDEF_TNF_MASK 0x07 /* Type Name Format */
-/* First valid ASCII as per RTD specification */
-#define NDEF_RTD_VALID_START 0x20
-/* Last valid ASCII as per RTD specification */
-#define NDEF_RTD_VALID_END 0x7E
-
-/* NDEF Type Name Format */
-#define NDEF_TNF_EMPTY 0 /* Empty (type/id/payload len =0) */
-#define NDEF_TNF_WKT 1 /* NFC Forum well-known type/RTD */
-#define NDEF_TNF_MEDIA 2 /* Media-type as defined in RFC 2046 */
-#define NDEF_TNF_URI 3 /* Absolute URI as defined in RFC 3986 */
-#define NDEF_TNF_EXT 4 /* NFC Forum external type/RTD */
-#define NDEF_TNF_UNKNOWN 5 /* Unknown (type len =0) */
-#define NDEF_TNF_UNCHANGED 6 /* Unchanged (type len =0) */
-#define NDEF_TNF_RESERVED 7 /* Reserved */
-
-/* Define the status code returned from the Validate, Parse or Build functions
- */
-enum {
- NDEF_OK, /* 0 - OK */
-
- NDEF_REC_NOT_FOUND, /* 1 - No record matching the find criteria */
- NDEF_MSG_TOO_SHORT, /* 2 - Message was too short (< 3 bytes) */
- NDEF_MSG_NO_MSG_BEGIN, /* 3 - No 'begin' flag at start of message */
- NDEF_MSG_NO_MSG_END, /* 4 - No 'end' flag at end of message */
- NDEF_MSG_EXTRA_MSG_BEGIN, /* 5 - 'begin' flag after start of message */
- NDEF_MSG_UNEXPECTED_CHUNK, /* 6 - Unexpected chunk found */
- NDEF_MSG_INVALID_EMPTY_REC, /* 7 - Empty record with non-zero contents */
- NDEF_MSG_INVALID_CHUNK, /* 8 - Invalid chunk found */
- NDEF_MSG_LENGTH_MISMATCH, /* 9 - Overall message length doesn't match */
- NDEF_MSG_INSUFFICIENT_MEM, /* 10 - Insuffiecient memory to add record */
- NDEF_MSG_INVALID_TYPE /* 11 - TYPE field contains invalid characters */
-};
-typedef uint8_t tNDEF_STATUS;
-
-/* Functions to parse a received NDEF Message
- */
-/*******************************************************************************
-**
-** Function NDEF_MsgValidate
-**
-** Description This function validates an NDEF message.
-**
-** Returns TRUE if all OK, or FALSE if the message is invalid.
-**
-*******************************************************************************/
-extern tNDEF_STATUS NDEF_MsgValidate(uint8_t* p_msg, uint32_t msg_len,
- bool b_allow_chunks);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgGetNumRecs
-**
-** Description This function gets the number of records in the given NDEF
-** message.
-**
-** Returns The record count, or 0 if the message is invalid.
-**
-*******************************************************************************/
-extern int32_t NDEF_MsgGetNumRecs(uint8_t* p_msg);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgGetRecLength
-**
-** Description This function returns length of the current record in the
-** given NDEF message.
-**
-** Returns Length of record
-**
-*******************************************************************************/
-extern uint32_t NDEF_MsgGetRecLength(uint8_t* p_cur_rec);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgGetNextRec
-**
-** Description This function gets a pointer to the next record after the
-** current one.
-**
-** Returns Pointer to the start of the record, or NULL if no more
-**
-*******************************************************************************/
-extern uint8_t* NDEF_MsgGetNextRec(uint8_t* p_cur_rec);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgGetRecByIndex
-**
-** Description This function gets a pointer to the record with the given
-** index (0-based index) in the given NDEF message.
-**
-** Returns Pointer to the start of the record, or NULL
-**
-*******************************************************************************/
-extern uint8_t* NDEF_MsgGetRecByIndex(uint8_t* p_msg, int32_t index);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgGetLastRecInMsg
-**
-** Description This function gets a pointer to the last record in the
-** given NDEF message.
-**
-** Returns Pointer to the start of the last record, or NULL if some
-** problem
-**
-*******************************************************************************/
-extern uint8_t* NDEF_MsgGetLastRecInMsg(uint8_t* p_msg);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgGetFirstRecByType
-**
-** Description This function gets a pointer to the first record with the
-** given record type in the given NDEF message.
-**
-** Returns Pointer to the start of the record, or NULL
-**
-*******************************************************************************/
-extern uint8_t* NDEF_MsgGetFirstRecByType(uint8_t* p_msg, uint8_t tnf,
- uint8_t* p_type, uint8_t tlen);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgGetNextRecByType
-**
-** Description This function gets a pointer to the next record with the
-** given record type in the given NDEF message.
-**
-** Returns Pointer to the start of the record, or NULL
-**
-*******************************************************************************/
-extern uint8_t* NDEF_MsgGetNextRecByType(uint8_t* p_cur_rec, uint8_t tnf,
- uint8_t* p_type, uint8_t tlen);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgGetFirstRecById
-**
-** Description This function gets a pointer to the first record with the
-** given record id in the given NDEF message.
-**
-** Returns Pointer to the start of the record, or NULL
-**
-*******************************************************************************/
-extern uint8_t* NDEF_MsgGetFirstRecById(uint8_t* p_msg, uint8_t* p_id,
- uint8_t ilen);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgGetNextRecById
-**
-** Description This function gets a pointer to the next record with the
-** given record id in the given NDEF message.
-**
-** Returns Pointer to the start of the record, or NULL
-**
-*******************************************************************************/
-extern uint8_t* NDEF_MsgGetNextRecById(uint8_t* p_cur_rec, uint8_t* p_id,
- uint8_t ilen);
-
-/*******************************************************************************
-**
-** Function NDEF_RecGetType
-**
-** Description This function gets a pointer to the record type for the
-** given NDEF record.
-**
-** Returns Pointer to Type (NULL if none). TNF and len are filled in.
-**
-*******************************************************************************/
-extern uint8_t* NDEF_RecGetType(uint8_t* p_rec, uint8_t* p_tnf,
- uint8_t* p_type_len);
-
-/*******************************************************************************
-**
-** Function NDEF_RecGetId
-**
-** Description This function gets a pointer to the record id for the given
-** NDEF record.
-**
-** Returns Pointer to Id (NULL if none). ID Len is filled in.
-**
-*******************************************************************************/
-extern uint8_t* NDEF_RecGetId(uint8_t* p_rec, uint8_t* p_id_len);
-
-/*******************************************************************************
-**
-** Function NDEF_RecGetPayload
-**
-** Description This function gets a pointer to the payload for the given
-** NDEF record.
-**
-** Returns a pointer to the payload (NULL if none). Payload len filled
-** in.
-**
-*******************************************************************************/
-extern uint8_t* NDEF_RecGetPayload(uint8_t* p_rec, uint32_t* p_payload_len);
-
-/* Functions to build an NDEF Message
- */
-/*******************************************************************************
-**
-** Function NDEF_MsgInit
-**
-** Description This function initializes an NDEF message.
-**
-** Returns void
-** *p_cur_size is initialized to 0
-**
-*******************************************************************************/
-extern void NDEF_MsgInit(uint8_t* p_msg, uint32_t max_size,
- uint32_t* p_cur_size);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAddRec
-**
-** Description This function adds an NDEF record to the end of an NDEF
-** message.
-**
-** Returns OK, or error if the record did not fit
-** *p_cur_size is updated
-**
-*******************************************************************************/
-extern tNDEF_STATUS NDEF_MsgAddRec(uint8_t* p_msg, uint32_t max_size,
- uint32_t* p_cur_size, uint8_t tnf,
- uint8_t* p_type, uint8_t type_len,
- uint8_t* p_id, uint8_t id_len,
- uint8_t* p_payload, uint32_t payload_len);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgAppendPayload
-**
-** Description This function appends extra payload to a specific record in
-** the given NDEF message
-**
-** Returns OK, or error if the extra payload did not fit
-** *p_cur_size is updated
-**
-*******************************************************************************/
-extern tNDEF_STATUS NDEF_MsgAppendPayload(uint8_t* p_msg, uint32_t max_size,
- uint32_t* p_cur_size, uint8_t* p_rec,
- uint8_t* p_add_pl,
- uint32_t add_pl_len);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgReplacePayload
-**
-** Description This function replaces the payload of a specific record in
-** the given NDEF message
-**
-** Returns OK, or error if the new payload did not fit
-** *p_cur_size is updated
-**
-*******************************************************************************/
-extern tNDEF_STATUS NDEF_MsgReplacePayload(uint8_t* p_msg, uint32_t max_size,
- uint32_t* p_cur_size, uint8_t* p_rec,
- uint8_t* p_new_pl,
- uint32_t new_pl_len);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgReplaceType
-**
-** Description This function replaces the type field of a specific record
-** in the given NDEF message
-**
-** Returns OK, or error if the new type field did not fit
-** *p_cur_size is updated
-**
-*******************************************************************************/
-extern tNDEF_STATUS NDEF_MsgReplaceType(uint8_t* p_msg, uint32_t max_size,
- uint32_t* p_cur_size, uint8_t* p_rec,
- uint8_t* p_new_type,
- uint8_t new_type_len);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgReplaceId
-**
-** Description This function replaces the ID field of a specific record in
-** the given NDEF message
-**
-** Returns OK, or error if the new ID field did not fit
-** *p_cur_size is updated
-**
-*******************************************************************************/
-extern tNDEF_STATUS NDEF_MsgReplaceId(uint8_t* p_msg, uint32_t max_size,
- uint32_t* p_cur_size, uint8_t* p_rec,
- uint8_t* p_new_id, uint8_t new_id_len);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgRemoveRec
-**
-** Description This function removes the record at the given
-** index in the given NDEF message.
-**
-** Returns OK, or error if the index was invalid
-** *p_cur_size is updated
-**
-*******************************************************************************/
-extern tNDEF_STATUS NDEF_MsgRemoveRec(uint8_t* p_msg, uint32_t* p_cur_size,
- int32_t index);
-
-/*******************************************************************************
-**
-** Function NDEF_MsgCopyAndDechunk
-**
-** Description This function copies and de-chunks an NDEF message.
-** It is assumed that the destination is at least as large
-** as the source, since the source may not actually contain
-** any chunks.
-**
-** Returns The output byte count
-**
-*******************************************************************************/
-extern tNDEF_STATUS NDEF_MsgCopyAndDechunk(uint8_t* p_src, uint32_t src_len,
- uint8_t* p_dest,
- uint32_t* p_out_len);
-#endif /* NDEF_UTILS_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc/include/nfc_api.h b/libstpropnci/libstnfc-nci-headers/src/nfc/include/nfc_api.h
deleted file mode 100755
index 39f9136..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc/include/nfc_api.h
+++ /dev/null
@@ -1,1416 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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 the Near Field Communication (NFC) API function
- * external definitions.
- *
- ******************************************************************************/
-
-#ifndef NFC_API_H
-#define NFC_API_H
-
-#include "gki.h"
-#include "nci_defs.h"
-#include "nfc_hal_api.h"
-#include "nfc_target.h"
-
-#include "vendor_cfg.h"
-
-/* NFC application return status codes */
-/* Command succeeded */
-#define NFC_STATUS_OK NCI_STATUS_OK
-/* Command is rejected. */
-#define NFC_STATUS_REJECTED NCI_STATUS_REJECTED
-/* Message is corrupted */
-#define NFC_STATUS_MSG_CORRUPTED NCI_STATUS_MESSAGE_CORRUPTED
-/* buffer full */
-#define NFC_STATUS_BUFFER_FULL NCI_STATUS_BUFFER_FULL
-/* failed */
-#define NFC_STATUS_FAILED NCI_STATUS_FAILED
-/* not initialized */
-#define NFC_STATUS_NOT_INITIALIZED NCI_STATUS_NOT_INITIALIZED
-/* Syntax error */
-#define NFC_STATUS_SYNTAX_ERROR NCI_STATUS_SYNTAX_ERROR
-/* Semantic error */
-#define NFC_STATUS_SEMANTIC_ERROR NCI_STATUS_SEMANTIC_ERROR
-/* Unknown NCI Group ID */
-#define NFC_STATUS_UNKNOWN_GID NCI_STATUS_UNKNOWN_GID
-/* Unknown NCI Opcode */
-#define NFC_STATUS_UNKNOWN_OID NCI_STATUS_UNKNOWN_OID
-/* Invalid Parameter */
-#define NFC_STATUS_INVALID_PARAM NCI_STATUS_INVALID_PARAM
-/* Message size too big */
-#define NFC_STATUS_MSG_SIZE_TOO_BIG NCI_STATUS_MSG_SIZE_TOO_BIG
-/* Already started */
-#define NFC_STATUS_ALREADY_STARTED NCI_STATUS_ALREADY_STARTED
-/* Activation Failed */
-#define NFC_STATUS_ACTIVATION_FAILED NCI_STATUS_ACTIVATION_FAILED
-/* Tear Down Error */
-#define NFC_STATUS_TEAR_DOWN NCI_STATUS_TEAR_DOWN
-#define NFC_STATUS_RF_FRAME_CORRUPTED NCI_STATUS_RF_FRAME_CORRUPTED
-/* RF transmission error*/
-#define NFC_STATUS_RF_TRANSMISSION_ERR NCI_STATUS_RF_TRANSMISSION_ERR
-/* RF protocol error */
-#define NFC_STATUS_RF_PROTOCOL_ERR NCI_STATUS_RF_PROTOCOL_ERR
-/* RF Timeout */
-#define NFC_STATUS_TIMEOUT NCI_STATUS_TIMEOUT
-/* EE Intf activate err */
-#define NFC_STATUS_EE_INTF_ACTIVE_FAIL NCI_STATUS_EE_INTF_ACTIVE_FAIL
-/* EE transmission error*/
-#define NFC_STATUS_EE_TRANSMISSION_ERR NCI_STATUS_EE_TRANSMISSION_ERR
-/* EE protocol error */
-#define NFC_STATUS_EE_PROTOCOL_ERR NCI_STATUS_EE_PROTOCOL_ERR
-/* EE Timeout */
-#define NFC_STATUS_EE_TIMEOUT NCI_STATUS_EE_TIMEOUT
-
-/* 0xE0 ~0xFF are proprietary status codes */
-/* Command started successfully */
-#define NFC_STATUS_CMD_STARTED 0xE3
-/* NFCC Timeout in responding to an NCI command */
-#define NFC_STATUS_HW_TIMEOUT 0xE4
-/* More (same) event to follow */
-#define NFC_STATUS_CONTINUE 0xE5
-/* API is called to perform illegal function */
-#define NFC_STATUS_REFUSED 0xE6
-/* Wrong format of R-APDU, CC file or NDEF file */
-#define NFC_STATUS_BAD_RESP 0xE7
-/* 7816 Status Word is not command complete(0x9000) */
-#define NFC_STATUS_CMD_NOT_CMPLTD 0xE8
-/* Out of GKI buffers */
-#define NFC_STATUS_NO_BUFFERS 0xE9
-/* Protocol mismatch between API and activated one */
-#define NFC_STATUS_WRONG_PROTOCOL 0xEA
-/* Another Tag command is already in progress */
-#define NFC_STATUS_BUSY 0xEB
-
-/* Link Loss */
-#define NFC_STATUS_LINK_LOSS 0xFC
-/* data len exceeds MIU */
-#define NFC_STATUS_BAD_LENGTH 0xFD
-/* invalid handle */
-#define NFC_STATUS_BAD_HANDLE 0xFE
-/* congested */
-#define NFC_STATUS_CONGESTED 0xFF
-typedef uint8_t tNFC_STATUS;
-
-/**********************************************
- * NFC Config Parameter IDs defined by NCI
- **********************************************/
-#define NFC_PMID_TOTAL_DURATION NCI_PARAM_ID_TOTAL_DURATION
-#define NFC_PMID_PA_BAILOUT NCI_PARAM_ID_PA_BAILOUT
-#define NFC_PMID_PF_RC NCI_PARAM_ID_PF_RC
-#define NFC_PMID_PB_BAILOUT NCI_PARAM_ID_PB_BAILOUT
-#define NFC_PMID_PF_BIT_RATE NCI_PARAM_ID_PF_BIT_RATE
-#define NFC_PMID_PF_BAILOUT NCI_PARAM_ID_PF_BAILOUT
-#define NFC_PMID_PF_DEVICES_LIMIT NCI_PARAM_ID_PF_DEVICES_LIMIT
-#define NFC_PMID_LA_HIST_BY NCI_PARAM_ID_LA_HIST_BY
-#define NFC_PMID_LA_NFCID1 NCI_PARAM_ID_LA_NFCID1
-#define NFC_PMID_LA_BIT_FRAME_SDD NCI_PARAM_ID_LA_BIT_FRAME_SDD
-#define NFC_PMID_LA_PLATFORM_CONFIG NCI_PARAM_ID_LA_PLATFORM_CONFIG
-#define NFC_PMID_LA_SEL_INFO NCI_PARAM_ID_LA_SEL_INFO
-#define NFC_PMID_LB_SENSB_INFO NCI_PARAM_ID_LB_SENSB_INFO
-#define NFC_PMID_LB_H_INFO NCI_PARAM_ID_LB_H_INFO_RSP
-#define NFC_PMID_LB_NFCID0 NCI_PARAM_ID_LB_NFCID0
-#define NFC_PMID_LB_APPDATA NCI_PARAM_ID_LB_APPDATA
-#define NFC_PMID_LB_SFGI NCI_PARAM_ID_LB_SFGI
-#define NFC_PMID_LB_ADC_FO NCI_PARAM_ID_LB_ADC_FO
-#define NFC_PMID_LF_T3T_ID1 NCI_PARAM_ID_LF_T3T_ID1
-#define NFC_PMID_LF_PROTOCOL NCI_PARAM_ID_LF_PROTOCOL
-#define NFC_PMID_LF_T3T_PMM NCI_PARAM_ID_LF_T3T_PMM
-#define NFC_PMID_LF_T3T_FLAGS2 NCI_PARAM_ID_LF_T3T_FLAGS2
-#define NFC_PMID_FWI NCI_PARAM_ID_FWI
-#define NFC_PMID_LF_CON_BITR_F NCI_PARAM_ID_LF_CON_BITR_F
-#define NFC_PMID_RF_FIELD_INFO NCI_PARAM_ID_RF_FIELD_INFO
-
-/* Technology based routing */
-#define NFC_ROUTE_TAG_TECH NCI_ROUTE_TAG_TECH
-/* Protocol based routing */
-#define NFC_ROUTE_TAG_PROTO NCI_ROUTE_TAG_PROTO
-#define NFC_ROUTE_TAG_AID NCI_ROUTE_TAG_AID /* AID routing */
-#define NFC_ROUTE_TAG_SYSCODE NCI_ROUTE_TAG_SYSCODE /* System Code routing*/
-/* tag, len, 2 byte value for technology/protocol based routing */
-
-/* For routing */
-#define NFC_DH_ID NCI_DH_ID /* for DH */
-/* To identify the loopback test */
-/* use a proprietary range */
-#define NFC_TEST_ID NCI_TEST_ID
-
-#define NFC_TL_SIZE 2
-#define NFC_SAVED_CMD_SIZE 2
-
-typedef tNCI_DISCOVER_MAPS tNFC_DISCOVER_MAPS;
-typedef tNCI_DISCOVER_PARAMS tNFC_DISCOVER_PARAMS;
-
-/* all NFC Manager Callback functions have prototype like void (cback) (uint8_t
- * event, void *p_data)
- * tNFC_DATA_CBACK uses connection id as the first parameter; range 0x00-0x0F.
- * tNFC_DISCOVER_CBACK uses tNFC_DISCOVER_EVT; range 0x4000 ~
- * tNFC_RESPONSE_CBACK uses tNFC_RESPONSE_EVT; range 0x5000 ~
- */
-
-#define NFC_FIRST_DEVT 0x4000
-#define NFC_FIRST_REVT 0x5000
-#define NFC_FIRST_CEVT 0x6000
-#define NFC_FIRST_TEVT 0x8000
-
-/* the events reported on tNFC_RESPONSE_CBACK */
-enum {
- NFC_ENABLE_REVT = NFC_FIRST_REVT, /* 0 Enable event */
- NFC_DISABLE_REVT, /* 1 Disable event */
- NFC_SET_CONFIG_REVT, /* 2 Set Config Response */
- NFC_GET_CONFIG_REVT, /* 3 Get Config Response */
- NFC_NFCEE_DISCOVER_REVT, /* 4 Discover NFCEE response */
- NFC_NFCEE_INFO_REVT, /* 5 Discover NFCEE Notification */
- NFC_NFCEE_MODE_SET_REVT, /* 6 NFCEE Mode Set response */
- NFC_RF_FIELD_REVT, /* 7 RF Field information */
- NFC_EE_ACTION_REVT, /* 8 EE Action notification */
- NFC_EE_DISCOVER_REQ_REVT, /* 9 EE Discover Req notification */
- NFC_SET_ROUTING_REVT, /* 10 Configure Routing response */
- NFC_GET_ROUTING_REVT, /* 11 Retrieve Routing response */
- NFC_RF_COMM_PARAMS_UPDATE_REVT, /* 12 RF Communication Param Update */
- NFC_GEN_ERROR_REVT, /* 13 generic error notification */
- NFC_NFCC_RESTART_REVT, /* 14 NFCC has been re-initialized */
- NFC_NFCC_TIMEOUT_REVT, /* 15 NFCC is not responding */
- NFC_NFCC_TRANSPORT_ERR_REVT, /* 16 NCI Tranport error */
- NFC_NFCC_POWER_OFF_REVT, /* 17 NFCC turned off */
- NFC_SET_POWER_SUB_STATE_REVT, /* 18 Set power sub state response */
- NFC_NFCEE_PL_CONTROL_REVT, /* NFCEE Power/Link Ctrl response*/
- NFC_NFCEE_STATUS_REVT /* NFCEE Status Notification */
- /* First vendor-specific rsp event */
-};
-typedef uint16_t tNFC_RESPONSE_EVT;
-
-enum {
- NFC_CONN_CREATE_CEVT = NFC_FIRST_CEVT, /* 0 Conn Create Response */
- NFC_CONN_CLOSE_CEVT, /* 1 Conn Close Response */
- NFC_DEACTIVATE_CEVT, /* 2 Deactivate response/notificatn*/
- NFC_DATA_CEVT, /* 3 Data */
- NFC_ERROR_CEVT, /* 4 generic or interface error */
- NFC_DATA_START_CEVT /* 5 received the first fragment on RF link */
-};
-typedef uint16_t tNFC_CONN_EVT;
-
-#define NFC_NFCC_INFO_LEN 4
-#ifndef NFC_NFCC_MAX_NUM_VS_INTERFACE
-#define NFC_NFCC_MAX_NUM_VS_INTERFACE 5
-#endif
-typedef struct {
- tNFC_STATUS status; /* The event status. */
- uint8_t nci_version; /* the NCI version of NFCC */
- uint8_t max_conn; /* max number of connections by NFCC*/
- uint32_t nci_features; /* the NCI features of NFCC */
- uint16_t nci_interfaces; /* the NCI interfaces of NFCC */
- uint16_t max_ce_table; /* the max routing table size */
- uint16_t max_param_size; /* Max Size for Large Parameters */
- uint8_t manufacture_id; /* the Manufacture ID for NFCC */
- uint8_t nfcc_info[NFC_NFCC_INFO_LEN]; /* the Manufacture Info for NFCC */
- uint8_t vs_interface[NFC_NFCC_MAX_NUM_VS_INTERFACE]; /* the NCI VS interfaces
- of NFCC */
- uint8_t hci_packet_size; /*HCI payload size*/
- uint8_t hci_conn_credits; /*max number of HCI credits*/
- uint16_t max_nfc_v_size; /* maximum frame size for NFC-V*/
-} tNFC_ENABLE_REVT;
-
-#define NFC_MAX_NUM_IDS 125
-/* the data type associated with NFC_SET_CONFIG_REVT */
-typedef struct {
- tNFC_STATUS status; /* The event status. */
- uint8_t num_param_id; /* Number of rejected NCI Param ID */
- uint8_t param_ids[NFC_MAX_NUM_IDS]; /* NCI Param ID */
-} tNFC_SET_CONFIG_REVT;
-
-/* the data type associated with NFC_GET_CONFIG_REVT */
-typedef struct {
- tNFC_STATUS status; /* The event status. */
- uint16_t tlv_size; /* The length of TLV */
- uint8_t* p_param_tlvs; /* TLV */
-} tNFC_GET_CONFIG_REVT;
-
-/* the data type associated with NFC_NFCEE_DISCOVER_REVT */
-typedef struct {
- tNFC_STATUS status; /* The event status. */
- uint8_t num_nfcee; /* The number of NFCEE */
-} tNFC_NFCEE_DISCOVER_REVT;
-
-#define NFC_NFCEE_INTERFACE_APDU NCI_NFCEE_INTERFACE_APDU
-#define NFC_NFCEE_INTERFACE_HCI_ACCESS NCI_NFCEE_INTERFACE_HCI_ACCESS
-#define NFC_NFCEE_INTERFACE_T3T NCI_NFCEE_INTERFACE_T3T
-#define NFC_NFCEE_INTERFACE_TRANSPARENT NCI_NFCEE_INTERFACE_TRANSPARENT
-#define NFC_NFCEE_INTERFACE_PROPRIETARY NCI_NFCEE_INTERFACE_PROPRIETARY
-
-#define NFC_NFCEE_TAG_HW_ID NCI_NFCEE_TAG_HW_ID
-#define NFC_NFCEE_TAG_ATR_BYTES NCI_NFCEE_TAG_ATR_BYTES
-#define NFC_NFCEE_TAG_T3T_INFO NCI_NFCEE_TAG_T3T_INFO
-#define NFC_NFCEE_TAG_HCI_HOST_ID NCI_NFCEE_TAG_HCI_HOST_ID
-typedef uint8_t tNFC_NFCEE_TAG;
-/* additional NFCEE Info */
-typedef struct {
- tNFC_NFCEE_TAG tag;
- uint8_t len;
- uint8_t info[NFC_MAX_EE_INFO];
-} tNFC_NFCEE_TLV;
-
-/* NFCEE unrecoverable error */
-#define NFC_NFCEE_STATUS_UNRECOVERABLE_ERROR NCI_NFCEE_STS_UNRECOVERABLE_ERROR
-/* NFCEE connected and inactive */
-#define NFC_NFCEE_STATUS_INACTIVE NCI_NFCEE_STS_CONN_INACTIVE
-/* NFCEE connected and active */
-#define NFC_NFCEE_STATUS_ACTIVE NCI_NFCEE_STS_CONN_ACTIVE
-/* NFCEE removed */
-#define NFC_NFCEE_STATUS_REMOVED NCI_NFCEE_STS_REMOVED
-
-/* the data type associated with NFC_NFCEE_INFO_REVT */
-typedef struct {
- tNFC_STATUS status; /* The event status - place holder */
- uint8_t nfcee_id; /* NFCEE ID */
- uint8_t ee_status; /* The NFCEE status. */
- uint8_t num_interface; /* number of NFCEE interfaces */
- uint8_t ee_interface[NFC_MAX_EE_INTERFACE]; /* NFCEE interface */
- uint8_t num_tlvs; /* number of TLVs */
- tNFC_NFCEE_TLV ee_tlv[NFC_MAX_EE_TLVS]; /* The TLVs associated with NFCEE */
- bool nfcee_power_ctrl; /* 1, if NFCC has control of NFCEE Power Supply */
-} tNFC_NFCEE_INFO_REVT;
-
-#define NFC_MODE_ACTIVATE NCI_NFCEE_MD_ACTIVATE
-#define NFC_MODE_DEACTIVATE NCI_NFCEE_MD_DEACTIVATE
-typedef uint8_t tNFC_NFCEE_MODE;
-/* the data type associated with NFC_NFCEE_MODE_SET_REVT */
-typedef struct {
- tNFC_STATUS status; /* The event status.*/
- uint8_t nfcee_id; /* NFCEE ID */
- tNFC_NFCEE_MODE mode; /* NFCEE mode */
-} tNFC_NFCEE_MODE_SET_REVT;
-
-#if (APPL_DTA_MODE == TRUE)
-/* This data type is for FW Version */
-typedef struct {
- uint8_t rom_code_version; /* ROM code Version */
- uint8_t major_version; /* Major Version */
- uint8_t minor_version; /* Minor Version */
-} tNFC_FW_VERSION;
-#endif
-#define NFC_MAX_AID_LEN NCI_MAX_AID_LEN /* 16 */
-
-/* the data type associated with NFC_CE_GET_ROUTING_REVT */
-typedef struct {
- tNFC_STATUS status; /* The event status */
- uint8_t nfcee_id; /* NFCEE ID */
- uint8_t num_tlvs; /* number of TLVs */
- uint8_t tlv_size; /* the total len of all TLVs */
- uint8_t qualifier_type; /* qualifier type */
- uint8_t param_tlvs[NFC_MAX_EE_TLV_SIZE]; /* the TLVs */
-} tNFC_GET_ROUTING_REVT;
-
-/* the data type associated with NFC_CONN_CREATE_CEVT */
-typedef struct {
- tNFC_STATUS status; /* The event status */
- uint8_t dest_type; /* the destination type */
- uint8_t id; /* NFCEE ID or RF Discovery ID */
- uint8_t buff_size; /* The max buffer size */
- uint8_t num_buffs; /* The number of buffers */
-} tNFC_CONN_CREATE_CEVT;
-
-/* the data type associated with NFC_CONN_CLOSE_CEVT */
-typedef struct {
- tNFC_STATUS status; /* The event status */
-} tNFC_CONN_CLOSE_CEVT;
-
-/* the data type associated with NFC_DATA_CEVT */
-typedef struct {
- tNFC_STATUS status; /* The event status */
- NFC_HDR* p_data; /* The received Data */
-} tNFC_DATA_CEVT;
-
-/* the data type associated with NFC_NFCEE_PL_CONTROL_REVT */
-typedef struct {
- tNFC_STATUS status; /* The event status */
- uint8_t nfcee_id; /* NFCEE ID */
- tNCI_NFCEE_PL_CONFIG pl_control; /* Power/Link Control command */
-} tNFC_NFCEE_PL_CONTROL_REVT;
-
-/* the data type associated with NFC_NFCEE_STATUS_REVT */
-typedef struct {
- tNFC_STATUS status; /* The event status */
- uint8_t nfcee_id; /* NFCEE ID */
- tNCI_EE_NTF_STATUS nfcee_status; /* NFCEE status */
-} tNFC_NFCEE_STATUS_REVT;
-/* RF Field Status */
-typedef uint8_t tNFC_RF_STS;
-
-/* RF Field Technologies */
-#define NFC_RF_TECHNOLOGY_A NCI_RF_TECHNOLOGY_A
-#define NFC_RF_TECHNOLOGY_B NCI_RF_TECHNOLOGY_B
-#define NFC_RF_TECHNOLOGY_F NCI_RF_TECHNOLOGY_F
-typedef uint8_t tNFC_RF_TECH;
-
-extern uint8_t NFC_GetNCIVersion();
-extern bool NFC_IsRfRemovalDetectionSupported();
-
-/* Supported Protocols */
-#define NFC_PROTOCOL_UNKNOWN NCI_PROTOCOL_UNKNOWN /* Unknown */
-/* Type1Tag - NFC-A */
-#define NFC_PROTOCOL_T1T NCI_PROTOCOL_T1T
-/* Type2Tag - NFC-A */
-#define NFC_PROTOCOL_T2T NCI_PROTOCOL_T2T
-/* Type3Tag - NFC-F */
-#define NFC_PROTOCOL_T3T NCI_PROTOCOL_T3T
-/* Type5Tag - NFC-V/ISO15693*/
-#define NFC_PROTOCOL_T5T NFC_PROTOCOL_T5T_(NFC_GetNCIVersion())
-#define NFC_PROTOCOL_T5T_(x) \
- (((x) >= NCI_VERSION_2_0) ? NCI_PROTOCOL_T5T : NCI_PROTOCOL_15693)
-#define NFC_PROTOCOL_CI NCI_PROTOCOL_CI
-/* Type 4A,4B - NFC-A or NFC-B */
-#define NFC_PROTOCOL_ISO_DEP NCI_PROTOCOL_ISO_DEP
-/* NFCDEP/LLCP - NFC-A or NFC-F */
-#define NFC_PROTOCOL_NFC_DEP NCI_PROTOCOL_NFC_DEP
-#define NFC_PROTOCOL_MIFARE NCI_PROTOCOL_MIFARE
-#define NFC_PROTOCOL_ISO15693 NCI_PROTOCOL_15693
-#define NFC_PROTOCOL_B_PRIME NCI_PROTOCOL_B_PRIME
-#define NFC_PROTOCOL_KOVIO NCI_PROTOCOL_KOVIO
-typedef uint8_t tNFC_PROTOCOL;
-
-/* Discovery Types/Detected Technology and Mode */
-#define NFC_DISCOVERY_TYPE_POLL_A NCI_DISCOVERY_TYPE_POLL_A
-#define NFC_DISCOVERY_TYPE_POLL_B NCI_DISCOVERY_TYPE_POLL_B
-#define NFC_DISCOVERY_TYPE_POLL_F NCI_DISCOVERY_TYPE_POLL_F
-#define NFC_DISCOVERY_TYPE_POLL_V NCI_DISCOVERY_TYPE_POLL_V
-#define NFC_DISCOVERY_TYPE_POLL_B_PRIME NCI_DISCOVERY_TYPE_POLL_B_PRIME
-#define NFC_DISCOVERY_TYPE_POLL_KOVIO NCI_DISCOVERY_TYPE_POLL_KOVIO
-#define NFC_DISCOVERY_TYPE_LISTEN_A NCI_DISCOVERY_TYPE_LISTEN_A
-#define NFC_DISCOVERY_TYPE_LISTEN_B NCI_DISCOVERY_TYPE_LISTEN_B
-#define NFC_DISCOVERY_TYPE_LISTEN_F NCI_DISCOVERY_TYPE_LISTEN_F
-#define NFC_DISCOVERY_TYPE_LISTEN_ISO15693 NCI_DISCOVERY_TYPE_LISTEN_ISO15693
-#define NFC_DISCOVERY_TYPE_LISTEN_B_PRIME NCI_DISCOVERY_TYPE_LISTEN_B_PRIME
-typedef uint8_t tNFC_DISCOVERY_TYPE;
-typedef uint8_t tNFC_RF_TECH_N_MODE;
-
-/* Select Response codes */
-#define NFC_SEL_RES_NFC_FORUM_T2T 0x00
-#define NFC_SEL_RES_MF_CLASSIC 0x08
-
-/* Bit Rates */
-#define NFC_BIT_RATE_212 NCI_BIT_RATE_212 /* 212 kbit/s */
-#define NFC_BIT_RATE_424 NCI_BIT_RATE_424 /* 424 kbit/s */
-typedef uint8_t tNFC_BIT_RATE;
-
-/**********************************************
- * Interface Types
- **********************************************/
-#define NFC_INTERFACE_EE_DIRECT_RF NCI_INTERFACE_EE_DIRECT_RF
-#define NFC_INTERFACE_FRAME NCI_INTERFACE_FRAME
-#define NFC_INTERFACE_ISO_DEP NCI_INTERFACE_ISO_DEP
-#define NFC_INTERFACE_MIFARE NCI_INTERFACE_VS_MIFARE
-typedef tNCI_INTF_TYPE tNFC_INTF_TYPE;
-
-typedef tNCI_INTF_EXT_TYPE tNFC_INTF_EXT_TYPE;
-
-#define NFC_RF_INTF_EXT_START 0
-#define NFC_RF_INTF_EXT_STOP 1
-/**********************************************
- * Deactivation Type
- **********************************************/
-#define NFC_DEACTIVATE_TYPE_IDLE NCI_DEACTIVATE_TYPE_IDLE
-#define NFC_DEACTIVATE_TYPE_SLEEP NCI_DEACTIVATE_TYPE_SLEEP
-#define NFC_DEACTIVATE_TYPE_SLEEP_AF NCI_DEACTIVATE_TYPE_SLEEP_AF
-#define NFC_DEACTIVATE_TYPE_DISCOVERY NCI_DEACTIVATE_TYPE_DISCOVERY
-typedef uint8_t tNFC_DEACT_TYPE;
-
-/**********************************************
- * Deactivation Reasons
- **********************************************/
-#define NFC_DEACTIVATE_REASON_DH_REQ_FAILED NCI_DEACTIVATE_REASON_DH_REQ_FAILED
-#define NFC_DEACTIVATE_REASON_DH_REQ NCI_DEACTIVATE_REASON_DH_REQ
-typedef uint8_t tNFC_DEACT_REASON;
-
-/* the data type associated with NFC_RF_FIELD_REVT */
-typedef struct {
- tNFC_STATUS status; /* The event status - place holder. */
- tNFC_RF_STS rf_field; /* RF Field Status */
-} tNFC_RF_FIELD_REVT;
-
-#define NFC_MAX_APP_DATA_LEN 40
-typedef struct {
- uint8_t len_aid; /* length of application id */
- uint8_t aid[NFC_MAX_AID_LEN]; /* application id */
-} tNFC_AID;
-typedef struct {
- uint8_t len_aid; /* length of application id */
- uint8_t aid[NFC_MAX_AID_LEN]; /* application id */
- uint8_t len_data; /* len of application data */
- uint8_t data[NFC_MAX_APP_DATA_LEN]; /* application data */
-} tNFC_APP_INIT;
-
-/* ISO 7816-4 SELECT command */
-#define NFC_EE_TRIG_SELECT NCI_EE_TRIG_7816_SELECT
-/* RF Protocol changed */
-#define NFC_EE_TRIG_RF_PROTOCOL NCI_EE_TRIG_RF_PROTOCOL
-/* RF Technology changed */
-#define NFC_EE_TRIG_RF_TECHNOLOGY NCI_EE_TRIG_RF_TECHNOLOGY
-/* Application initiation */
-#define NFC_EE_TRIG_APP_INIT NCI_EE_TRIG_APP_INIT
-typedef uint8_t tNFC_EE_TRIGGER;
-typedef struct {
- tNFC_EE_TRIGGER trigger; /* the trigger of this event */
- union {
- tNFC_PROTOCOL protocol;
- tNFC_RF_TECH technology;
- tNFC_AID aid;
- tNFC_APP_INIT app_init;
- } param; /* Discovery Type specific parameters */
-} tNFC_ACTION_DATA;
-
-/* the data type associated with NFC_EE_ACTION_REVT */
-typedef struct {
- tNFC_STATUS status; /* The event status - place holder */
- uint8_t nfcee_id; /* NFCEE ID */
- tNFC_ACTION_DATA act_data; /* data associated /w the action */
-} tNFC_EE_ACTION_REVT;
-
-#define NFC_EE_DISC_OP_ADD 0
-typedef uint8_t tNFC_EE_DISC_OP;
-typedef struct {
- tNFC_EE_DISC_OP op; /* add or remove this entry */
- uint8_t nfcee_id; /* NFCEE ID */
- tNFC_RF_TECH_N_MODE tech_n_mode; /* Discovery Technology and Mode */
- tNFC_PROTOCOL protocol; /* NFC protocol */
-} tNFC_EE_DISCOVER_INFO;
-
-#ifndef NFC_MAX_EE_DISC_ENTRIES
-#define NFC_MAX_EE_DISC_ENTRIES 6
-#endif
-/* T, L, V(NFCEE ID, TechnMode, Protocol) */
-#define NFC_EE_DISCOVER_ENTRY_LEN 5
-#define NFC_EE_DISCOVER_INFO_LEN 3 /* NFCEE ID, TechnMode, Protocol */
-/* the data type associated with NFC_EE_DISCOVER_REQ_REVT */
-typedef struct {
- tNFC_STATUS status; /* The event status - place holder */
- uint8_t num_info; /* number of entries in info[] */
- tNFC_EE_DISCOVER_INFO
- info[NFC_MAX_EE_DISC_ENTRIES]; /* discovery request from NFCEE */
-} tNFC_EE_DISCOVER_REQ_REVT;
-
-typedef union {
- tNFC_STATUS status; /* The event status. */
- tNFC_ENABLE_REVT enable;
- tNFC_SET_CONFIG_REVT set_config;
- tNFC_GET_CONFIG_REVT get_config;
- tNFC_NFCEE_DISCOVER_REVT nfcee_discover;
- tNFC_NFCEE_INFO_REVT nfcee_info;
- tNFC_NFCEE_MODE_SET_REVT mode_set;
- tNFC_NFCEE_PL_CONTROL_REVT pl_control;
- tNFC_NFCEE_STATUS_REVT nfcee_status;
- tNFC_RF_FIELD_REVT rf_field;
- tNFC_STATUS cfg_routing;
- tNFC_GET_ROUTING_REVT get_routing;
- tNFC_EE_ACTION_REVT ee_action;
- tNFC_EE_DISCOVER_REQ_REVT ee_discover_req;
- void* p_vs_evt_data;
-} tNFC_RESPONSE;
-
-/*************************************
-** RESPONSE Callback Functions
-**************************************/
-typedef void(tNFC_RESPONSE_CBACK)(tNFC_RESPONSE_EVT event,
- tNFC_RESPONSE* p_data);
-
-/* The events reported on tNFC_VS_CBACK */
-/* The event is (NCI_RSP_BIT|oid) for response and (NCI_NTF_BIT|oid) for
- * notification*/
-
-typedef uint8_t tNFC_VS_EVT;
-
-/*************************************
-** Proprietary (Vendor Specific) Callback Functions
-**************************************/
-typedef void(tNFC_VS_CBACK)(tNFC_VS_EVT event, uint16_t data_len,
- uint8_t* p_data);
-
-/* the events reported on tNFC_DISCOVER_CBACK */
-enum {
- NFC_START_DEVT = NFC_FIRST_DEVT, /* Status of NFC_DiscoveryStart */
- NFC_MAP_DEVT, /* Status of NFC_DiscoveryMap */
- NFC_RESULT_DEVT, /* The responses from remote device */
- NFC_SELECT_DEVT, /* Status of NFC_DiscoverySelect */
- NFC_ACTIVATE_DEVT, /* RF interface is activated */
- NFC_DEACTIVATE_DEVT, /* Status of RF deactivation */
- NFC_INTF_EXT_START_DEVT, /* Status of NFC_StartRfIntfExtension */
- NFC_INTF_EXT_STOP_DEVT, /* Status of NFC_StopRfIntfExtension */
- NFC_DETECTION_START_DEVT, /* Status of NFC_StartEPRemovalDetection */
- NFC_DETECTION_RESULT_DEVT, /* Removal Detection ended */
- NFC_WPT_START_DEVT, /* Status of NFC_StartPowerTransfert*/
- NFC_WPT_RESULT_DEVT, /* Wireless Power Transfert ended */
-};
-typedef uint16_t tNFC_DISCOVER_EVT;
-
-/* the data type associated with NFC_START_DEVT */
-typedef tNFC_STATUS tNFC_START_DEVT;
-
-typedef tNCI_RF_PA_PARAMS tNFC_RF_PA_PARAMS;
-#define NFC_MAX_SENSB_RES_LEN NCI_MAX_SENSB_RES_LEN
-#define NFC_NFCID0_MAX_LEN 4
-typedef struct {
- uint8_t sensb_res_len; /* Length of SENSB_RES Response (Byte 2 - Byte 12 or
- 13) Available after Technology Detection */
- uint8_t sensb_res[NFC_MAX_SENSB_RES_LEN]; /* SENSB_RES Response (ATQ) */
- uint8_t nfcid0[NFC_NFCID0_MAX_LEN];
- uint8_t fwi;
-} tNFC_RF_PB_PARAMS;
-
-#define NFC_MAX_SENSF_RES_LEN NCI_MAX_SENSF_RES_LEN
-#define NFC_NFCID2_LEN NCI_NFCID2_LEN
-typedef struct {
- uint8_t bit_rate; /* NFC_BIT_RATE_212 or NFC_BIT_RATE_424 */
- uint8_t sensf_res_len; /* Length of SENSF_RES Response (Byte 2 - Byte 17 or
- 19) Available after Technology Detection */
- uint8_t sensf_res[NFC_MAX_SENSF_RES_LEN]; /* SENSB_RES Response */
- uint8_t nfcid2[NFC_NFCID2_LEN]; /* NFCID2 generated by the Local NFCC for
- NFC-DEP Protocol.Available for Frame
- Interface */
- uint8_t mrti_check;
- uint8_t mrti_update;
-} tNFC_RF_PF_PARAMS;
-
-typedef tNCI_RF_LF_PARAMS tNFC_RF_LF_PARAMS;
-
-#define NFC_ISO15693_UID_LEN 8
-typedef struct {
- uint8_t flag;
- uint8_t dsfid;
- uint8_t uid[NFC_ISO15693_UID_LEN];
-} tNFC_RF_PISO15693_PARAMS;
-
-#ifndef NFC_KOVIO_MAX_LEN
-#define NFC_KOVIO_MAX_LEN 32
-#endif
-typedef struct {
- uint8_t uid_len;
- uint8_t uid[NFC_KOVIO_MAX_LEN];
-} tNFC_RF_PKOVIO_PARAMS;
-
-typedef tNCI_RF_ACM_P_PARAMS tNFC_RF_ACM_P_PARAMS;
-
-typedef union {
- tNFC_RF_PA_PARAMS pa;
- tNFC_RF_PB_PARAMS pb;
- tNFC_RF_PF_PARAMS pf;
- tNFC_RF_LF_PARAMS lf;
- tNFC_RF_PISO15693_PARAMS pi93;
- tNFC_RF_PKOVIO_PARAMS pk;
- tNFC_RF_ACM_P_PARAMS acm_p;
-} tNFC_RF_TECH_PARAMU;
-
-typedef struct {
- tNFC_DISCOVERY_TYPE mode;
- tNFC_RF_TECH_PARAMU param;
-} tNFC_RF_TECH_PARAMS;
-
-/* the data type associated with NFC_RESULT_DEVT */
-typedef struct {
- tNFC_STATUS status; /* The event status - place holder. */
- uint8_t rf_disc_id; /* RF Discovery ID */
- uint8_t protocol; /* supported protocol */
- tNFC_RF_TECH_PARAMS rf_tech_param; /* RF technology parameters */
- uint8_t more; /* 0: last, 1: last (limit), 2: more */
-} tNFC_RESULT_DEVT;
-
-/* the data type associated with NFC_SELECT_DEVT */
-typedef tNFC_STATUS tNFC_SELECT_DEVT;
-
-typedef tNFC_STATUS tNFC_INTF_EXT_START_DEVT;
-typedef tNFC_STATUS tNFC_INTF_EXT_STOP_DEVT;
-/* the data type associated with NFC_STOP_DEVT */
-typedef tNFC_STATUS tNFC_STOP_DEVT;
-
-#define NFC_MAX_ATS_LEN NCI_MAX_ATS_LEN
-#define NFC_MAX_HIS_BYTES_LEN NCI_MAX_HIS_BYTES_LEN
-#define NFC_MAX_GEN_BYTES_LEN NCI_MAX_GEN_BYTES_LEN
-
-typedef struct {
- uint8_t ats_res_len; /* Length of ATS RES */
- uint8_t ats_res[NFC_MAX_ATS_LEN]; /* ATS RES */
- bool nad_used; /* NAD is used or not */
- uint8_t fwi; /* Frame Waiting time Integer */
- uint8_t sfgi; /* Start-up Frame Guard time Integer*/
- uint8_t his_byte_len; /* len of historical bytes */
- uint8_t his_byte[NFC_MAX_HIS_BYTES_LEN]; /* historical bytes */
-} tNFC_INTF_PA_ISO_DEP;
-
-typedef struct {
- uint8_t rats; /* RATS */
-} tNFC_INTF_LA_ISO_DEP;
-
-#define NFC_MAX_ATTRIB_LEN NCI_MAX_ATTRIB_LEN
-
-typedef struct {
- uint8_t attrib_res_len; /* Length of ATTRIB RES */
- uint8_t attrib_res[NFC_MAX_ATTRIB_LEN]; /* ATTRIB RES */
- uint8_t hi_info_len; /* len of Higher layer Info */
- uint8_t hi_info[NFC_MAX_GEN_BYTES_LEN]; /* Higher layer Info */
- uint8_t mbli; /* Maximum buffer length. */
-} tNFC_INTF_PB_ISO_DEP;
-
-typedef struct {
- uint8_t attrib_req_len; /* Length of ATTRIB REQ */
- uint8_t attrib_req[NFC_MAX_ATTRIB_LEN]; /* ATTRIB REQ (Byte 2 - 10+k)*/
- uint8_t hi_info_len; /* len of Higher layer Info */
- uint8_t hi_info[NFC_MAX_GEN_BYTES_LEN]; /* Higher layer Info */
- uint8_t nfcid0[NFC_NFCID0_MAX_LEN]; /* NFCID0 */
-} tNFC_INTF_LB_ISO_DEP;
-
-#ifndef NFC_MAX_RAW_PARAMS
-#define NFC_MAX_RAW_PARAMS 16
-#endif
-#define NFC_MAX_RAW_PARAMS 16
-typedef struct {
- uint8_t param_len;
- uint8_t param[NFC_MAX_RAW_PARAMS];
-} tNFC_INTF_FRAME;
-
-typedef struct {
- tNFC_INTF_TYPE type; /* Interface Type 1 Byte See Table 67 */
- union {
- tNFC_INTF_LA_ISO_DEP la_iso;
- tNFC_INTF_PA_ISO_DEP pa_iso;
- tNFC_INTF_LB_ISO_DEP lb_iso;
- tNFC_INTF_PB_ISO_DEP pb_iso;
- tNFC_INTF_FRAME frame;
- } intf_param; /* Activation Parameters 0 - n Bytes */
-} tNFC_INTF_PARAMS;
-
-/* the data type associated with NFC_ACTIVATE_DEVT */
-typedef struct {
- uint8_t rf_disc_id; /* RF Discovery ID */
- tNFC_PROTOCOL protocol; /* supported protocol */
- tNFC_RF_TECH_PARAMS rf_tech_param; /* RF technology parameters */
- tNFC_DISCOVERY_TYPE data_mode; /* for future Data Exchange */
- tNFC_BIT_RATE tx_bitrate; /* Data Exchange Tx Bitrate */
- tNFC_BIT_RATE rx_bitrate; /* Data Exchange Rx Bitrate */
- tNFC_INTF_PARAMS intf_param; /* interface type and params*/
-} tNFC_ACTIVATE_DEVT;
-
-/* the data type associated with NFC_DEACTIVATE_DEVT and NFC_DEACTIVATE_CEVT */
-typedef struct {
- tNFC_STATUS status; /* The event status. */
- tNFC_DEACT_TYPE type; /* De-activate type */
- bool is_ntf; /* TRUE, if deactivate notif*/
- tNFC_DEACT_REASON reason; /* De-activate reason */
-} tNFC_DEACTIVATE_DEVT;
-
-typedef union {
- tNFC_STATUS status; /* The event status. */
- tNFC_START_DEVT start;
- tNFC_RESULT_DEVT result;
- tNFC_SELECT_DEVT select;
- tNFC_STOP_DEVT stop;
- tNFC_ACTIVATE_DEVT activate;
- tNFC_DEACTIVATE_DEVT deactivate;
- uint8_t wpt_result;
-} tNFC_DISCOVER;
-
-typedef struct {
- bool include_rf_tech_mode; /* TRUE if including RF Tech and Mode update */
- tNFC_RF_TECH_N_MODE rf_tech_n_mode; /* RF tech and mode */
- bool include_tx_bit_rate; /* TRUE if including Tx bit rate update */
- tNFC_BIT_RATE tx_bit_rate; /* Transmit Bit Rate */
- bool include_rx_bit_rate; /* TRUE if including Rx bit rate update */
- tNFC_BIT_RATE rx_bit_rate; /* Receive Bit Rate */
- bool include_nfc_b_config; /* TRUE if including NFC-B data exchange config */
- uint8_t min_tr0; /* Minimum TR0 */
- uint8_t min_tr1; /* Minimum TR1 */
- uint8_t suppression_eos; /* Suppression of EoS */
- uint8_t suppression_sos; /* Suppression of SoS */
- uint8_t min_tr2; /* Minimum TR1 */
-} tNFC_RF_COMM_PARAMS;
-
-/*************************************
-** DISCOVER Callback Functions
-**************************************/
-typedef void(tNFC_DISCOVER_CBACK)(tNFC_DISCOVER_EVT event,
- tNFC_DISCOVER* p_data);
-
-typedef uint16_t tNFC_TEST_EVT;
-
-/* the data type associated with NFC_LOOPBACK_TEVT */
-typedef struct {
- tNFC_STATUS status; /* The event status. */
- NFC_HDR* p_data; /* The loop back data from NFCC */
-} tNFC_LOOPBACK_TEVT;
-
-/* the data type associated with NFC_RF_CONTROL_TEVT */
-typedef tNFC_STATUS tNFC_RF_CONTROL_TEVT;
-
-typedef union {
- tNFC_STATUS status; /* The event status. */
- tNFC_LOOPBACK_TEVT loop_back;
- tNFC_RF_CONTROL_TEVT rf_control;
-} tNFC_TEST;
-
-/*************************************
-** TEST Callback Functions
-**************************************/
-typedef void(tNFC_TEST_CBACK)(tNFC_TEST_EVT event, tNFC_TEST* p_data);
-
-typedef tNFC_DEACTIVATE_DEVT tNFC_DEACTIVATE_CEVT;
-typedef union {
- tNFC_STATUS status; /* The event status. */
- tNFC_CONN_CREATE_CEVT conn_create;
- tNFC_CONN_CLOSE_CEVT conn_close;
- tNFC_DEACTIVATE_CEVT deactivate;
- tNFC_DATA_CEVT data;
-} tNFC_CONN;
-
-/*************************************
-** Data Callback Functions
-**************************************/
-typedef void(tNFC_CONN_CBACK)(uint8_t conn_id, tNFC_CONN_EVT event,
- tNFC_CONN* p_data);
-#define NFC_MAX_CONN_ID 15
-#define NFC_ILLEGAL_CONN_ID 0xFF
-/* the static connection ID for RF traffic */
-#define NFC_RF_CONN_ID 0
-/* the static connection ID for HCI transport */
-#define NFC_HCI_CONN_ID 1
-#define NFC_T4TNFCEE_CONN_ID 0x05
-
-/*****************************************************************************
-** EXTERNAL FUNCTION DECLARATIONS
-*****************************************************************************/
-
-/*******************************************************************************
-**
-** Function NFC_Enable
-**
-** Description This function enables NFC. Prior to calling NFC_Enable:
-** - the NFCC must be powered up, and ready to receive
-** commands.
-** - GKI must be enabled
-** - NFC_TASK must be started
-** - NCIT_TASK must be started (if using dedicated NCI
-** transport)
-**
-** This function opens the NCI transport (if applicable),
-** resets the NFC controller, and initializes the NFC
-** subsystems.
-**
-** When the NFC startup procedure is completed, an
-** NFC_ENABLE_REVT is returned to the application using the
-** tNFC_RESPONSE_CBACK.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_Enable(tNFC_RESPONSE_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFC_Disable
-**
-** Description This function performs clean up routines for shutting down
-** NFC and closes the NCI transport (if using dedicated NCI
-** transport).
-**
-** When the NFC shutdown procedure is completed, an
-** NFC_DISABLED_REVT is returned to the application using the
-** tNFC_RESPONSE_CBACK.
-**
-** Returns nothing
-**
-*******************************************************************************/
-extern void NFC_Disable(void);
-
-/*******************************************************************************
-**
-** Function NFC_Init
-**
-** Description This function initializes control blocks for NFC
-**
-** Returns nothing
-**
-*******************************************************************************/
-extern void NFC_Init(tHAL_NFC_ENTRY* p_hal_entry_tbl);
-
-/*******************************************************************************
-**
-** Function NFC_GetLmrtSize
-**
-** Description Called by application wto query the Listen Mode Routing
-** Table size supported by NFCC
-**
-** Returns Listen Mode Routing Table size
-**
-*******************************************************************************/
-extern uint16_t NFC_GetLmrtSize(void);
-
-/*******************************************************************************
-**
-** Function NFC_SetConfig
-**
-** Description This function is called to send the configuration parameter
-** TLV to NFCC. The response from NFCC is reported by
-** tNFC_RESPONSE_CBACK as NFC_SET_CONFIG_REVT.
-**
-** Parameters tlv_size - the length of p_param_tlvs.
-** p_param_tlvs - the parameter ID/Len/Value list
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_SetConfig(uint8_t tlv_size, uint8_t* p_param_tlvs);
-
-/*******************************************************************************
-**
-** Function NFC_GetConfig
-**
-** Description This function is called to retrieve the parameter TLV from
-** NFCC. The response from NFCC is reported by
-** tNFC_RESPONSE_CBACK as NFC_GET_CONFIG_REVT.
-**
-** Parameters num_ids - the number of parameter IDs
-** p_param_ids - the parameter ID list.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_GetConfig(uint8_t num_ids, uint8_t* p_param_ids);
-
-/*******************************************************************************
-**
-** Function NFC_NfceeDiscover
-**
-** Description This function is called to enable or disable NFCEE
-** Discovery. The response from NFCC is reported by
-** tNFC_RESPONSE_CBACK as NFC_NFCEE_DISCOVER_REVT.
-** The notification from NFCC is reported by
-** tNFC_RESPONSE_CBACK as NFC_NFCEE_INFO_REVT.
-**
-** Parameters discover - 1 to enable discover, 0 to disable.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_NfceeDiscover(bool discover);
-
-/*******************************************************************************
-**
-** Function NFC_NfceeModeSet
-**
-** Description This function is called to activate or de-activate an NFCEE
-** connected to the NFCC.
-** The response from NFCC is reported by tNFC_RESPONSE_CBACK
-** as NFC_NFCEE_MODE_SET_REVT.
-**
-** Parameters nfcee_id - the NFCEE to activate or de-activate.
-** mode - 0 to activate NFCEE, 1 to de-activate.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_NfceeModeSet(uint8_t nfcee_id, tNFC_NFCEE_MODE mode);
-/*******************************************************************************
-**
-** Function NFC_DiscoveryMap
-**
-** Description This function is called to set the discovery interface
-** mapping. The response from NFCC is reported by
-** tNFC_DISCOVER_CBACK as. NFC_MAP_DEVT.
-**
-** Parameters num - the number of items in p_params.
-** p_maps - the discovery interface mappings
-** p_cback - the discovery callback function
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_DiscoveryMap(uint8_t num, tNFC_DISCOVER_MAPS* p_maps,
- tNFC_DISCOVER_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFC_DiscoveryStart
-**
-** Description This function is called to start Polling and/or Listening.
-** The response from NFCC is reported by tNFC_DISCOVER_CBACK
-** as NFC_START_DEVT. The notification from NFCC is reported by
-** tNFC_DISCOVER_CBACK as NFC_RESULT_DEVT.
-**
-** Parameters num_params - the number of items in p_params.
-** p_params - the discovery parameters
-** p_cback - the discovery callback function
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_DiscoveryStart(uint8_t num_params,
- tNFC_DISCOVER_PARAMS* p_params,
- tNFC_DISCOVER_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFC_DiscoverySelect
-**
-** Description If tNFC_DISCOVER_CBACK reports status=NFC_MULTIPLE_PROT,
-** the application needs to use this function to select the
-** the logical endpoint to continue. The response from NFCC is
-** reported by tNFC_DISCOVER_CBACK as NFC_SELECT_DEVT.
-**
-** Parameters rf_disc_id - The ID identifies the remote device.
-** protocol - the logical endpoint on the remote device
-** rf_interface - the RF interface to communicate with NFCC
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_DiscoverySelect(uint8_t rf_disc_id, uint8_t protocol,
- uint8_t rf_interface);
-
-/*******************************************************************************
-**
-** Function NFC_StartRfIntfExtension
-**
-** Description If tNFC_DISCOVER_CBACK reports status=NFC_MULTIPLE_PROT,
-** the application needs to use this function to select the
-** the logical endpoint to continue. The response from NFCC is
-** reported by tNFC_DISCOVER_CBACK as NFC_SELECT_DEVT.
-**
-** Parameters rf_disc_id - The ID identifies the remote device.
-** protocol - the logical endpoint on the remote device
-** rf_interface - the RF interface to communicate with NFCC
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_StartRfIntfExtension(uint8_t rf_ext_id, uint8_t* p_data,
- uint8_t len);
-
-/*******************************************************************************
-**
-** Function NFC_StartEPRemovalDetection
-**
-** Description If tNFC_DISCOVER_CBACK reports status=NFC_MULTIPLE_PROT,
-** the application needs to use this function to select the
-** the logical endpoint to continue. The response from NFCC is
-** reported by tNFC_DISCOVER_CBACK as NFC_SELECT_DEVT.
-**
-** Parameters rf_disc_id - The ID identifies the remote device.
-** protocol - the logical endpoint on the remote device
-** rf_interface - the RF interface to communicate with NFCC
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_StartEPRemovalDetection(uint8_t waiting_time);
-
-/*******************************************************************************
-**
-** Function NFC_StopRfIntfExtension
-**
-** Description If tNFC_DISCOVER_CBACK reports status=NFC_MULTIPLE_PROT,
-** the application needs to use this function to select the
-** the logical endpoint to continue. The response from NFCC is
-** reported by tNFC_DISCOVER_CBACK as NFC_SELECT_DEVT.
-**
-** Parameters rf_disc_id - The ID identifies the remote device.
-** protocol - the logical endpoint on the remote device
-** rf_interface - the RF interface to communicate with NFCC
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_StopRfIntfExtension(uint8_t rf_ext_id, uint8_t* p_data,
- uint8_t len);
-
-/*******************************************************************************
-**
-** Function NFC_StartPowerTransfert
-**
-** Description If tNFC_DISCOVER_CBACK reports status=NFC_MULTIPLE_PROT,
-** the application needs to use this function to select the
-** the logical endpoint to continue. The response from NFCC is
-** reported by tNFC_DISCOVER_CBACK as NFC_SELECT_DEVT.
-**
-** Parameters rf_disc_id - The ID identifies the remote device.
-** protocol - the logical endpoint on the remote device
-** rf_interface - the RF interface to communicate with NFCC
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_StartPowerTransfert(uint8_t* p_param, uint8_t param_len);
-
-/*******************************************************************************
-**
-** Function NFC_ConnCreate
-**
-** Description This function is called to create a logical connection with
-** NFCC for data exchange.
-** The response from NFCC is reported in tNFC_CONN_CBACK
-** as NFC_CONN_CREATE_CEVT.
-**
-** Parameters dest_type - the destination type
-** id - the NFCEE ID or RF Discovery ID .
-** protocol - the protocol
-** p_cback - the data callback function to receive data from
-** NFCC
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_ConnCreate(uint8_t dest_type, uint8_t id,
- uint8_t protocol, tNFC_CONN_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFC_ConnClose
-**
-** Description This function is called to close a logical connection with
-** NFCC.
-** The response from NFCC is reported in tNFC_CONN_CBACK
-** as NFC_CONN_CLOSE_CEVT.
-**
-** Parameters conn_id - the connection id.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_ConnClose(uint8_t conn_id);
-
-/*******************************************************************************
-**
-** Function NFC_SetStaticRfCback
-**
-** Description This function is called to update the data callback function
-** to receive the data for the given connection id.
-**
-** Parameters p_cback - the connection callback function
-**
-** Returns Nothing
-**
-*******************************************************************************/
-extern void NFC_SetStaticRfCback(tNFC_CONN_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFC_SetStaticT4tNfceeCback
-**
-** Description This function is called to update the data callback function
-** to receive the data for the given connection id.
-**
-** Parameters p_cback - the connection callback function
-** connId - connection ID for T4T NFCEE
-**
-** Returns Nothing
-**
-*******************************************************************************/
-void NFC_SetStaticT4tNfceeCback(tNFC_CONN_CBACK* p_cback, uint8_t connId);
-
-/*******************************************************************************
-**
-** Function NFC_SetReassemblyFlag
-**
-** Description This function is called to set if nfc will reassemble
-** nci packet as much as its buffer can hold or it should not
-** reassemble but forward the fragmented nci packet to layer
-** above. If nci data pkt is fragmented, nfc may send multiple
-** NFC_DATA_CEVT with status NFC_STATUS_CONTINUE before sending
-** NFC_DATA_CEVT with status NFC_STATUS_OK based on reassembly
-** configuration and reassembly buffer size
-**
-** Parameters reassembly - flag to indicate if nfc may reassemble or not
-**
-** Returns Nothing
-**
-*******************************************************************************/
-extern void NFC_SetReassemblyFlag(bool reassembly);
-
-/*******************************************************************************
-**
-** Function NFC_SendData
-**
-** Description This function is called to send the given data packet
-** to the connection identified by the given connection id.
-**
-** Parameters conn_id - the connection id.
-** p_data - the data packet
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_SendData(uint8_t conn_id, NFC_HDR* p_data);
-
-/*******************************************************************************
-**
-** Function NFC_FlushData
-**
-** Description This function is called to discard the tx data queue of
-** the given connection id.
-**
-** Parameters conn_id - the connection id.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_FlushData(uint8_t conn_id);
-
-/*******************************************************************************
-**
-** Function NFC_Deactivate
-**
-** Description This function is called to stop the discovery process or
-** put the listen device in sleep mode or terminate the NFC
-** link.
-**
-** The response from NFCC is reported by tNFC_DISCOVER_CBACK
-** as NFC_DEACTIVATE_DEVT.
-**
-** Parameters deactivate_type - NFC_DEACTIVATE_TYPE_IDLE, to IDLE mode.
-** NFC_DEACTIVATE_TYPE_SLEEP to SLEEP mode.
-** NFC_DEACTIVATE_TYPE_SLEEP_AF to SLEEP_AF
-** mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_Deactivate(tNFC_DEACT_TYPE deactivate_type);
-
-/*******************************************************************************
-**
-** Function NFC_UpdateRFCommParams
-**
-** Description This function is called to update RF Communication
-** parameters once the Frame RF Interface has been activated.
-**
-** The response from NFCC is reported by tNFC_RESPONSE_CBACK
-** as NFC_RF_COMM_PARAMS_UPDATE_REVT.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_UpdateRFCommParams(tNFC_RF_COMM_PARAMS* p_params);
-
-/*******************************************************************************
-**
-** Function NFC_SetPowerOffSleep
-**
-** Description This function closes/opens transport and turns off/on NFCC.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_SetPowerOffSleep(bool enable);
-
-/*******************************************************************************
-**
-** Function NFC_SetPowerSubState
-**
-** Description This function is called to send the power sub state(screen
-** state) to NFCC. The response from NFCC is reported by
-** tNFC_RESPONSE_CBACK as NFC_SET_POWER_STATE_REVT.
-**
-** Parameters scree_state
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_SetPowerSubState(uint8_t screen_state);
-
-/*******************************************************************************
-**
-** Function NFC_PowerCycleNFCC
-**
-** Description This function turns off and then on NFCC.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_PowerCycleNFCC(void);
-
-/*******************************************************************************
-**
-** Function NFC_SetRouting
-**
-** Description This function is called to configure the CE routing table.
-** The response from NFCC is reported by tNFC_RESPONSE_CBACK
-** as NFC_SET_ROUTING_REVT.
-**
-** Parameters
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_SetRouting(bool more, uint8_t num_tlv, uint8_t tlv_size,
- uint8_t* p_param_tlvs);
-
-/*******************************************************************************
-**
-** Function NFC_GetRouting
-**
-** Description This function is called to retrieve the CE routing table
-** from NFCC. The response from NFCC is reported by
-** tNFC_RESPONSE_CBACK as NFC_GET_ROUTING_REVT.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_GetRouting(void);
-
-/*******************************************************************************
-**
-** Function NFC_RegVSCback
-**
-** Description This function is called to register or de-register a
-** callback function to receive Proprietary NCI response and
-** notification events.
-** The maximum number of callback functions allowed is
-** NFC_NUM_VS_CBACKS
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_RegVSCback(bool is_register, tNFC_VS_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFC_SendVsCommand
-**
-** Description This function is called to send the given vendor specific
-** command to NFCC. The response from NFCC is reported to the
-** given tNFC_VS_CBACK as (oid).
-**
-** Parameters oid - The opcode of the VS command.
-** p_data - The parameters for the VS command
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_SendVsCommand(uint8_t oid, NFC_HDR* p_data,
- tNFC_VS_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFC_SendRawVsCommand
-**
-** Description This function is called to send the given raw command to
-** NFCC. The response from NFCC is reported to the given
-** tNFC_VS_CBACK.
-**
-** Parameters p_data - The command buffer
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_SendRawVsCommand(NFC_HDR* p_data,
- tNFC_VS_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFC_TestLoopback
-**
-** Description This function is called to send the given data packet
-** to NFCC for loopback test.
-** When loopback data is received from NFCC, tNFC_TEST_CBACK .
-** reports a NFC_LOOPBACK_TEVT.
-**
-** Parameters p_data - the data packet
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_TestLoopback(NFC_HDR* p_data);
-
-/*******************************************************************************
-**
-** Function NFC_ISODEPNakPresCheck
-**
-** Description This function is called to send the ISO DEP nak presence
-** check cmd to check that the remote end point in RF field.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_ISODEPNakPresCheck();
-
-#if (APPL_DTA_MODE == TRUE)
-/*******************************************************************************
-**
-** Function nfc_ncif_getFWVersion
-**
-** Description This function sets the trace level for NFC. If called with
-** a value of 0xFF, it simply returns the current trace level.
-**
-** Returns The new or current trace level
-**
-*******************************************************************************/
-extern tNFC_FW_VERSION nfc_ncif_getFWVersion();
-#endif
-
-/*******************************************************************************
-**
-** Function NFC_NfceePLConfig
-**
-** Description This function is called to set the Power and Link Control
-** to an NFCEE connected to the NFCC.
-** The response from NFCC is reported by tNFC_RESPONSE_CBACK
-** as NFC_NFCEE_PL_CONTROL_REVT.
-**
-** Parameters nfcee_id - the NFCEE to activate or de-activate.
-** pl_config -
-** NFCEE_PL_CONFIG_NFCC_DECIDES -NFCC decides (default)
-** NFCEE_PL_CONFIG_PWR_ALWAYS_ON -NFCEE power supply always on
-** NFCEE_PL_CONFIG_LNK_ON_WHEN_PWR_ON -
-** communication link is always active
-** when NFCEE is powered on
-** NFCEE_PL_CONFIG_PWR_LNK_ALWAYS_ON -
-** power supply and communication
-** link are always on
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS NFC_NfceePLConfig(uint8_t nfcee_id,
- tNCI_NFCEE_PL_CONFIG pl_config);
-
-/*******************************************************************************
-**
-** Function NFC_SetStaticHciCback
-**
-** Description This function to update the data callback function
-** to receive the data for the static Hci connection id.
-**
-** Parameters p_cback - the connection callback function
-**
-** Returns Nothing
-**
-*******************************************************************************/
-extern void NFC_SetStaticHciCback(tNFC_CONN_CBACK* p_cback);
-
-/*******************************************************************************
-**
-** Function NFC_GetStatusName
-**
-** Description This function returns the status name.
-**
-** NOTE conditionally compiled to save memory.
-**
-** Returns pointer to the name
-**
-*******************************************************************************/
-extern std::string NFC_GetStatusName(tNFC_STATUS status);
-
-#endif /* NFC_API_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc/include/nfc_int.h b/libstpropnci/libstnfc-nci-headers/src/nfc/include/nfc_int.h
deleted file mode 100755
index 7a62baa..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc/include/nfc_int.h
+++ /dev/null
@@ -1,328 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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 the main NFC Upper Layer internal definitions and
- * functions.
- *
- ******************************************************************************/
-
-#ifndef NFC_INT_H_
-#define NFC_INT_H_
-
-#include "gki.h"
-#include "nci_defs.h"
-#include "nfc_api.h"
-#include "nfc_target.h"
-
-/****************************************************************************
-** Internal NFC constants and definitions
-****************************************************************************/
-
-/****************************************************************************
-** NFC_TASK definitions
-****************************************************************************/
-
-/* NFC_TASK event masks */
-#define NFC_TASK_EVT_TRANSPORT_READY EVENT_MASK(APPL_EVT_0)
-
-/* NFC Timer events */
-#define NFC_TTYPE_NCI_WAIT_RSP 0
-#ifndef ST21NFC
-#define NFC_TTYPE_WAIT_2_DEACTIVATE 1
-#endif
-#define NFC_WAIT_RSP_RAW_VS 0x02
-#define NFC_TTYPE_WAIT_MODE_SET_NTF 2
-
-#define NFC_TTYPE_RW_T1T_RESPONSE 104
-#define NFC_TTYPE_RW_T2T_RESPONSE 105
-#define NFC_TTYPE_RW_T3T_RESPONSE 106
-#define NFC_TTYPE_RW_T4T_RESPONSE 107
-#define NFC_TTYPE_RW_I93_RESPONSE 108
-#define NFC_TTYPE_CE_T4T_UPDATE 109
-#define NFC_TTYPE_RW_MFC_RESPONSE 112
-#define NFC_TTYPE_RW_CI_RESPONSE 113
-/* time out for mode set notification */
-#define NFC_MODE_SET_NTF_TIMEOUT 2
-/* NFC Task event messages */
-
-enum {
- NFC_STATE_NONE, /* not start up yet */
- NFC_STATE_W4_HAL_OPEN, /* waiting for HAL_NFC_OPEN_CPLT_EVT */
- NFC_STATE_CORE_INIT, /* sending CORE_RESET and CORE_INIT */
- NFC_STATE_W4_POST_INIT_CPLT, /* waiting for HAL_NFC_POST_INIT_CPLT_EVT */
- NFC_STATE_IDLE, /* normal operation (discovery state) */
- NFC_STATE_OPEN, /* NFC link is activated */
- NFC_STATE_CLOSING, /* de-activating */
- NFC_STATE_W4_HAL_CLOSE, /* waiting for HAL_NFC_POST_INIT_CPLT_EVT */
- NFC_STATE_NFCC_POWER_OFF_SLEEP /* NFCC is power-off sleep mode */
-};
-typedef uint8_t tNFC_STATE;
-
-/* NFC control block flags */
-#ifndef ST21NFC
-/* NFC_Deactivate () is called and the NCI cmd is not sent */
-#define NFC_FL_DEACTIVATING 0x0001
-#endif
-/* restarting NFCC after PowerOffSleep */
-#define NFC_FL_RESTARTING 0x0002
-/* enterning power off sleep mode */
-#define NFC_FL_POWER_OFF_SLEEP 0x0004
-/* Power cycle NFCC */
-#define NFC_FL_POWER_CYCLE_NFCC 0x0008
-/* HAL requested control on NCI command window */
-#define NFC_FL_CONTROL_REQUESTED 0x0010
-/* NCI command window is on the HAL side */
-#define NFC_FL_CONTROL_GRANTED 0x0020
-/* NCI command window is on the HAL side */
-#define NFC_FL_DISCOVER_PENDING 0x0040
-/* NFC_FL_CONTROL_REQUESTED on HAL request */
-#define NFC_FL_HAL_REQUESTED 0x0080
-/* Waiting for NFCEE Mode Set NTF */
-#define NFC_FL_WAIT_MODE_SET_NTF 0x0100
-/* Waiting for RF Interface Extension Start or
- * Stop response before allowing NCI data again */
-#define NFC_FL_WAIT_RF_INTF_EXT_RSP 0x0200
-
-#define NFC_PEND_CONN_ID 0xFE
-#define NFC_CONN_ID_ID_MASK NCI_CID_MASK
-/* set num_buff to this for no flow control */
-#define NFC_CONN_NO_FC 0xFF
-
-#if (NFC_RW_ONLY == FALSE)
-/* only allow the entries that the NFCC can support */
-#define NFC_CHECK_MAX_CONN() \
- { \
- if (max > nfc_cb.max_conn) max = nfc_cb.max_conn; \
- }
-#else
-#define NFC_CHECK_MAX_CONN()
-#endif
-
-typedef struct {
- tNFC_CONN_CBACK* p_cback; /* the callback function to receive the data */
- BUFFER_Q tx_q; /* transmit queue */
- BUFFER_Q rx_q; /* receive queue */
- uint8_t id; /* NFCEE ID or RF Discovery ID or NFC_TEST_ID */
- uint8_t act_protocol; /* the active protocol on this logical connection */
- uint8_t act_interface; /* the active interface on this logical connection */
- uint8_t conn_id; /* the connection id assigned by NFCC for this conn */
- uint8_t buff_size; /* the max buffer size for this connection. . */
- uint8_t num_buff; /* num of buffers left to send on this connection */
- uint8_t init_credits; /* initial num of buffer credits */
-} tNFC_CONN_CB;
-
-/* This data type is for NFC task to send a NCI VS command to NCIT task */
-typedef struct {
- NFC_HDR bt_hdr; /* the NCI command */
- tNFC_VS_CBACK* p_cback; /* the callback function to receive RSP */
-} tNFC_NCI_VS_MSG;
-
-/* This data type is for HAL event */
-typedef struct {
- NFC_HDR hdr;
- uint8_t hal_evt; /* HAL event code */
- uint8_t status; /* tHAL_NFC_STATUS */
-} tNFC_HAL_EVT_MSG;
-
-/* callback function pointer(8; use 8 to be safe + NFC_SAVED_CMD_SIZE(2) */
-#define NFC_RECEIVE_MSGS_OFFSET (10)
-
-#define NFC_SAVED_HDR_SIZE (2)
-/* data Reassembly error (in NFC_HDR.layer_specific) */
-#define NFC_RAS_TOO_BIG 0x08
-#define NFC_RAS_FRAGMENTED 0x01
-
-/* NCI command buffer contains a VSC (in NFC_HDR.layer_specific) */
-#define NFC_WAIT_RSP_VSC 0x01
-
-/* NFC control blocks */
-typedef struct {
- uint16_t flags; /* NFC control block flags - NFC_FL_* */
- tNFC_CONN_CB conn_cb[NCI_MAX_CONN_CBS];
- uint8_t conn_id[NFC_MAX_CONN_ID + 1]; /* index: conn_id; conn_id[]: index(1
- based) to conn_cb[] */
- tNFC_DISCOVER_CBACK* p_discv_cback;
- tNFC_RESPONSE_CBACK* p_resp_cback;
- tNFC_TEST_CBACK* p_test_cback;
- tNFC_VS_CBACK*
- p_vs_cb[NFC_NUM_VS_CBACKS]; /* Register for vendor specific events */
-
-#if (NFC_RW_ONLY == FALSE)
- /* NFCC information at init rsp */
- uint32_t nci_features; /* the NCI features supported by NFCC */
- uint16_t max_ce_table; /* the max routing table size */
- uint8_t max_conn; /* the num of connections supported by NFCC */
-#endif
- uint8_t nci_ctrl_size; /* Max Control Packet Payload Size */
-
- const tNCI_DISCOVER_MAPS*
- p_disc_maps; /* NCI RF Discovery interface mapping */
- uint8_t vs_interface[NFC_NFCC_MAX_NUM_VS_INTERFACE]; /* the NCI VS interfaces
- of NFCC */
- uint16_t nci_interfaces; /* the NCI interfaces of NFCC */
- uint8_t nci_intf_extensions;
- uint8_t nci_intf_extension_map[NCI_INTERFACE_EXTENSION_MAX];
- uint8_t num_disc_maps; /* number of RF Discovery interface mappings */
- void* p_disc_pending; /* the parameters associated with pending
- NFC_DiscoveryStart */
-
- /* NFC_TASK timer management */
- TIMER_LIST_Q timer_queue; /* 1-sec timer event queue */
- TIMER_LIST_Q quick_timer_queue;
- TIMER_LIST_ENT mode_set_ntf_timer; /* Timer to wait for deactivation */
-#ifndef ST21NFC
- TIMER_LIST_ENT deactivate_timer; /* Timer to wait for deactivation */
-#endif
- tNFC_STATE nfc_state;
- bool reassembly; /* Reassemble fragmented data pkt */
- uint8_t last_hdr[NFC_SAVED_HDR_SIZE]; /* part of last NCI command header */
- uint8_t last_cmd[NFC_SAVED_CMD_SIZE]; /* part of last NCI command payload */
- uint8_t
- last_nfcee_cmd[NFC_SAVED_CMD_SIZE]; /* part of last NCI command payload */
- void* p_vsc_cback; /* the callback function for last VSC command */
- BUFFER_Q nci_cmd_xmit_q; /* NCI command queue */
- TIMER_LIST_ENT
- nci_wait_rsp_timer; /* Timer for waiting for nci command response */
- uint16_t nci_wait_rsp_tout; /* NCI command timeout (in ms) */
- uint8_t nci_wait_rsp; /* layer_specific for last NCI message */
-
- uint8_t nci_cmd_window; /* Number of commands the controller can accecpt
- without waiting for response */
-
- NFC_HDR* p_nci_init_rsp; /* holding INIT_RSP until receiving
- HAL_NFC_POST_INIT_CPLT_EVT */
- tHAL_NFC_ENTRY* p_hal;
-
- uint8_t nci_version; /* NCI version used for NCI communication*/
-
- bool isScbrSupported; /* indicating if system code based route is supported */
-
- uint8_t hci_packet_size; /* maximum hci payload size*/
-
- uint8_t hci_conn_credits; /* maximum conn credits for static HCI*/
-
- uint16_t nci_max_v_size; /*maximum NFC V rf frame size*/
-
- uint8_t rawVsCbflag;
- uint8_t deact_reason;
-
- TIMER_LIST_ENT nci_mode_set_ntf_timer; /*Mode set notification timer*/
-
- uint8_t nfcc_mode; /* NFC controller modes */
-
- tNFC_RESPONSE nfcee_data; /* pending NFCEE_STATUS_NTF*/
-
- bool is_nfcee_discovery_required; /* is NFCEE discovery required*/
-} tNFC_CB;
-
-/*****************************************************************************
-** EXTERNAL FUNCTION DECLARATIONS
-*****************************************************************************/
-
-/* Global NFC data */
-extern tNFC_CB nfc_cb;
-
-/****************************************************************************
-** Internal nfc functions
-****************************************************************************/
-
-#define NCI_CALCULATE_ACK(a, v) \
- { \
- (a) &= ((1 << (v)) - 1); \
- }
-#define MAX_NUM_VALID_BITS_FOR_ACK 0x07
-
-/* from nfc_utils.c */
-extern tNFC_CONN_CB* nfc_alloc_conn_cb(tNFC_CONN_CBACK* p_cback);
-extern tNFC_CONN_CB* nfc_find_conn_cb_by_conn_id(uint8_t conn_id);
-extern tNFC_CONN_CB* nfc_find_conn_cb_by_handle(uint8_t target_handle);
-extern void nfc_set_conn_id(tNFC_CONN_CB* p_cb, uint8_t conn_id);
-extern void nfc_free_conn_cb(tNFC_CONN_CB* p_cb);
-extern void nfc_reset_all_conn_cbs(void);
-extern void nfc_data_event(tNFC_CONN_CB* p_cb);
-
-extern uint8_t nfc_ncif_send_data(tNFC_CONN_CB* p_cb, NFC_HDR* p_data);
-extern void nfc_ncif_cmd_timeout(void);
-#ifndef ST21NFC
-extern void nfc_wait_2_deactivate_timeout(void);
-#endif
-extern void nfc_mode_set_ntf_timeout(void);
-
-extern bool nfc_ncif_process_event(NFC_HDR* p_msg);
-extern void nfc_ncif_check_cmd_queue(NFC_HDR* p_buf);
-extern void nfc_ncif_send_cmd(NFC_HDR* p_buf);
-extern void nfc_ncif_proc_discover_ntf(uint8_t* p, uint16_t plen);
-extern void nfc_ncif_rf_management_status(tNFC_DISCOVER_EVT event,
- uint8_t status);
-extern void nfc_ncif_set_config_status(uint8_t* p, uint8_t len);
-extern void nfc_ncif_event_status(tNFC_RESPONSE_EVT event, uint8_t status);
-extern void nfc_ncif_error_status(uint8_t conn_id, uint8_t status);
-extern void nfc_ncif_proc_credits(uint8_t* p, uint16_t plen);
-extern void nfc_ncif_proc_activate(uint8_t* p, uint8_t len);
-extern void nfc_ncif_proc_deactivate(uint8_t status, uint8_t deact_type,
- bool is_ntf);
-#if (NFC_NFCEE_INCLUDED == TRUE && NFC_RW_ONLY == FALSE)
-extern void nfc_ncif_proc_ee_action(uint8_t* p, uint16_t plen);
-extern void nfc_ncif_proc_ee_discover_req(uint8_t* p, uint16_t plen);
-extern void nfc_ncif_proc_get_routing(uint8_t* p, uint8_t len);
-#endif
-extern void nfc_ncif_proc_conn_create_rsp(uint8_t* p, uint16_t plen,
- uint8_t dest_type);
-extern void nfc_ncif_report_conn_close_evt(uint8_t conn_id, tNFC_STATUS status);
-extern void nfc_ncif_proc_t3t_polling_rsp(uint8_t status);
-extern void nfc_ncif_proc_t3t_polling_ntf(uint8_t* p, uint16_t plen);
-extern void nfc_ncif_proc_reset_rsp(uint8_t* p, bool is_ntf);
-extern void nfc_ncif_proc_init_rsp(NFC_HDR* p_msg);
-extern void nfc_ncif_proc_get_config_rsp(NFC_HDR* p_msg);
-extern void nfc_ncif_proc_data(NFC_HDR* p_msg);
-extern bool nfc_ncif_proc_proprietary_rsp(uint8_t mt, uint8_t gid, uint8_t oid);
-extern void nfc_ncif_proc_isodep_nak_presence_check_status(uint8_t status,
- bool is_ntf);
-extern void nfc_ncif_proc_removal_status(uint8_t* p);
-extern void nfc_ncif_proc_charging_status(uint8_t* p, uint8_t len);
-
-extern void nfc_ncif_update_window(void);
-#if (NFC_RW_ONLY == FALSE)
-extern void nfc_ncif_proc_rf_field_ntf(uint8_t rf_status);
-#else
-#define nfc_ncif_proc_rf_field_ntf(rf_status)
-#endif
-
-/* From nfc_task.c */
-extern uint32_t nfc_task(uint32_t);
-void nfc_task_shutdown_nfcc(void);
-
-/* From nfc_main.c */
-void nfc_enabled(tNFC_STATUS nfc_status, NFC_HDR* p_init_rsp_msg);
-void nfc_set_state(tNFC_STATE nfc_state);
-void nfc_main_flush_cmd_queue(void);
-void nfc_gen_cleanup(void);
-void nfc_main_handle_hal_evt(tNFC_HAL_EVT_MSG* p_msg);
-
-/* Timer functions */
-void nfc_start_timer(TIMER_LIST_ENT* p_tle, uint16_t type, uint32_t timeout);
-uint32_t nfc_remaining_time(TIMER_LIST_ENT* p_tle);
-void nfc_stop_timer(TIMER_LIST_ENT* p_tle);
-
-void nfc_start_quick_timer(TIMER_LIST_ENT* p_tle, uint16_t type,
- uint32_t timeout);
-void nfc_stop_quick_timer(TIMER_LIST_ENT* p_tle);
-void nfc_process_quick_timer_evt(void);
-#endif /* NFC_INT_H_ */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc/include/nfc_vs.h b/libstpropnci/libstnfc-nci-headers/src/nfc/include/nfc_vs.h
deleted file mode 100755
index 8cedbdd..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc/include/nfc_vs.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/******************************************************************************
- * Copyright (C) 2017 NXP Semiconductors
- *
- * 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 the Near Field Communication (NFC) VS related internal
- * function / definitions.
- *
- ******************************************************************************/
-
-#ifndef NFC_VS_H_
-#define NFC_VS_H_
-
-#endif /* NFC_VS_H_ */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc/include/rw_api.h b/libstpropnci/libstnfc-nci-headers/src/nfc/include/rw_api.h
deleted file mode 100755
index 723d271..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc/include/rw_api.h
+++ /dev/null
@@ -1,1652 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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 the Near Field Communication (NFC) Reader/Writer mode
- * related API function external definitions.
- *
- ******************************************************************************/
-
-#ifndef RW_API_H
-#define RW_API_H
-#include "nfc_api.h"
-#include "tags_defs.h"
-
-#define RW_T1T_BLD_ADD(a, k, y) (a) = (((k) & 0xF) << 3) | ((y) & 0x7);
-#define RW_T1T_BLD_ADDS(a, s) (a) = (((s) & 0xF) << 4);
-
-#define RW_T1T_FIRST_EVT 0x20
-#define RW_T2T_FIRST_EVT 0x40
-#define RW_T3T_FIRST_EVT 0x60
-#define RW_T4T_FIRST_EVT 0x80
-#define RW_I93_FIRST_EVT 0xA0
-#define RW_MFC_FIRST_EVT 0xC0
-#define RW_CI_FIRST_EVT 0xD0
-
-enum {
- /* Note: the order of these events can not be changed */
- /* Type 1 tag events for tRW_CBACK */
- RW_T1T_RID_EVT = RW_T1T_FIRST_EVT, /* Read ID command completd */
- RW_T1T_RALL_CPLT_EVT, /* Read All command completed */
- RW_T1T_READ_CPLT_EVT, /* Read byte completed */
- RW_T1T_WRITE_E_CPLT_EVT, /* Write byte after erase completed */
- RW_T1T_WRITE_NE_CPLT_EVT, /* Write byte with no erase completed */
- RW_T1T_RSEG_CPLT_EVT, /* Read segment completed */
- RW_T1T_READ8_CPLT_EVT, /* Read block completed */
- RW_T1T_WRITE_E8_CPLT_EVT, /* Write block after erase completed */
- RW_T1T_WRITE_NE8_CPLT_EVT, /* Write block with no erase completed */
- RW_T1T_TLV_DETECT_EVT, /* Lock/Mem/Prop tlv detection complete */
- RW_T1T_NDEF_DETECT_EVT, /* NDEF detection complete */
- RW_T1T_NDEF_READ_EVT, /* NDEF read completed */
- RW_T1T_NDEF_WRITE_EVT, /* NDEF write complete */
- RW_T1T_SET_TAG_RO_EVT, /* Tag is set as read only */
- RW_T1T_RAW_FRAME_EVT, /* Response of raw frame sent */
- RW_T1T_PRESENCE_CHECK_EVT, /* Response to RW_T1tPresenceCheck */
- RW_T1T_FORMAT_CPLT_EVT, /* Tag Formatted */
- RW_T1T_INTF_ERROR_EVT, /* RF Interface error event */
- RW_T1T_MAX_EVT,
-
- /* Type 2 tag events */
- RW_T2T_READ_CPLT_EVT = RW_T2T_FIRST_EVT, /* Read completed */
- RW_T2T_WRITE_CPLT_EVT, /* Write completed */
- RW_T2T_SELECT_CPLT_EVT, /* Sector select completed */
- RW_T2T_NDEF_DETECT_EVT, /* NDEF detection complete */
- RW_T2T_TLV_DETECT_EVT, /* Lock/Mem/Prop tlv detection complete */
- RW_T2T_NDEF_READ_EVT, /* NDEF read completed */
- RW_T2T_NDEF_WRITE_EVT, /* NDEF write complete */
- RW_T2T_SET_TAG_RO_EVT, /* Tag is set as read only */
- RW_T2T_RAW_FRAME_EVT, /* Response of raw frame sent */
- RW_T2T_PRESENCE_CHECK_EVT, /* Response to RW_T2tPresenceCheck */
- RW_T2T_FORMAT_CPLT_EVT, /* Tag Formatted */
- RW_T2T_INTF_ERROR_EVT, /* RF Interface error event */
- RW_T2T_MAX_EVT,
-
- /* Type 3 tag events for tRW_CBACK */
- RW_T3T_CHECK_CPLT_EVT = RW_T3T_FIRST_EVT, /* Read completed */
- RW_T3T_UPDATE_CPLT_EVT, /* Write completed */
- RW_T3T_CHECK_EVT, /* Segment of data received from type 3 tag */
- RW_T3T_RAW_FRAME_EVT, /* SendRawFrame response */
- RW_T3T_NDEF_DETECT_EVT, /* NDEF detection complete */
- RW_T3T_PRESENCE_CHECK_EVT, /* Response to RW_T3tPresenceCheck */
- RW_T3T_POLL_EVT, /* Response to RW_T3tPoll */
- RW_T3T_GET_SYSTEM_CODES_EVT, /* Response to RW_T3tGetSystemCodes */
- RW_T3T_FORMAT_CPLT_EVT, /* Tag Formatted (Felica-Lite only) */
- RW_T3T_SET_READ_ONLY_CPLT_EVT, /* Tag is set as Read only */
- RW_T3T_INTF_ERROR_EVT, /* RF Interface error event */
- RW_T3T_MAX_EVT,
-
- /* Type 4 tag events for tRW_CBACK */
- RW_T4T_NDEF_DETECT_EVT =
- RW_T4T_FIRST_EVT, /* Result of NDEF detection procedure */
- /* Mandatory NDEF file is selected */
- RW_T4T_NDEF_READ_EVT, /* Segment of data received from type 4 tag */
- RW_T4T_NDEF_READ_CPLT_EVT, /* Read operation completed */
- RW_T4T_NDEF_READ_FAIL_EVT, /* Read operation failed */
- RW_T4T_NDEF_UPDATE_CPLT_EVT, /* Update operation completed */
- RW_T4T_NDEF_UPDATE_FAIL_EVT, /* Update operation failed */
- RW_T4T_SET_TO_RO_EVT, /* Tag is set as read only */
- RW_T4T_PRESENCE_CHECK_EVT, /* Response to RW_T4tPresenceCheck */
- RW_T4T_RAW_FRAME_EVT, /* Response of raw frame sent */
- RW_T4T_INTF_ERROR_EVT, /* RF Interface error event */
- RW_T4T_NDEF_FORMAT_CPLT_EVT, /* Format operation completed */
- RW_T4T_MAX_EVT,
-
- /* ISO 15693 tag events for tRW_CBACK */
- RW_I93_NDEF_DETECT_EVT =
- RW_I93_FIRST_EVT, /* Result of NDEF detection procedure */
- RW_I93_NDEF_READ_EVT, /* Segment of data received from tag */
- RW_I93_NDEF_READ_CPLT_EVT, /* Read operation completed */
- RW_I93_NDEF_READ_FAIL_EVT, /* Read operation failed */
- RW_I93_NDEF_UPDATE_CPLT_EVT, /* Update operation completed */
- RW_I93_NDEF_UPDATE_FAIL_EVT, /* Update operation failed */
- RW_I93_FORMAT_CPLT_EVT, /* Format procedure complete */
- RW_I93_SET_TAG_RO_EVT, /* Set read-only procedure complete */
- RW_I93_INVENTORY_EVT, /* Response of Inventory */
- RW_I93_DATA_EVT, /* Response of Read, Get Multi Security */
- RW_I93_SYS_INFO_EVT, /* Response of System Information */
- RW_I93_CMD_CMPL_EVT, /* Command complete */
- RW_I93_PRESENCE_CHECK_EVT, /* Response to RW_I93PresenceCheck */
- RW_I93_RAW_FRAME_EVT, /* Response of raw frame sent */
- RW_I93_INTF_ERROR_EVT, /* RF Interface error event */
- RW_I93_MAX_EVT,
-
- /* Mifare Classic tag events for tRW_CBACK */
- RW_MFC_NDEF_DETECT_EVT =
- RW_MFC_FIRST_EVT, /* Result of NDEF detection procedure */
- /* Mandatory NDEF file is selected */
- RW_MFC_NDEF_READ_EVT, /* Segment of data received from mifare tag */
- RW_MFC_NDEF_READ_CPLT_EVT, /* Read operation completed */
- RW_MFC_NDEF_READ_FAIL_EVT, /* Read operation failed */
-
- RW_MFC_NDEF_WRITE_CPLT_EVT, /* Write operation completed */
- RW_MFC_NDEF_WRITE_FAIL_EVT, /* Write operation failed */
- RW_MFC_NDEF_FORMAT_CPLT_EVT, /* Format operation completed */
-
- RW_MFC_RAW_FRAME_EVT, /* Response of raw frame sent */
- RW_MFC_INTF_ERROR_EVT, /* RF Interface error event */
-#ifdef ST21NFC
- RW_MFC_PRES_CHECK_EVT, /* Response for MIFARE pres check alternative */
-#endif
- RW_MFC_MAX_EVT,
- RW_CI_PRESENCE_CHECK_EVT = RW_CI_FIRST_EVT,
- RW_CI_INTF_ERROR_EVT,
- RW_CI_RAW_FRAME_EVT,
- RW_CI_CPLT_EVT,
- RW_CI_MAX_EVT
-};
-
-#define RW_RAW_FRAME_EVT 0xFF
-
-typedef uint8_t tRW_EVENT;
-
-/* Tag is read only */
-#define RW_NDEF_FL_READ_ONLY 0x01
-/* Tag formatted for NDEF */
-#define RW_NDEF_FL_FORMATED 0x02
-/* NDEF supported by the tag */
-#define RW_NDEF_FL_SUPPORTED 0x04
-/* Unable to find if tag is ndef capable/formatted/read only */
-#define RW_NDEF_FL_UNKNOWN 0x08
-/* Tag supports format operation */
-#define RW_NDEF_FL_FORMATABLE 0x10
-/* Tag can be soft locked */
-#define RW_NDEF_FL_SOFT_LOCKABLE 0x20
-/* Tag can be hard locked */
-#define RW_NDEF_FL_HARD_LOCKABLE 0x40
-/* Tag is one time programmable */
-#define RW_NDEF_FL_OTP 0x80
-
-typedef uint8_t tRW_NDEF_FLAG;
-
-/* options for RW_T4tPresenceCheck */
-#define RW_T4T_CHK_EMPTY_I_BLOCK 1
-#define RW_T4T_CHK_ISO_DEP_NAK_PRES_CHK 5
-
-#define RW_I93_MODE_ADDRESSED 0
-#define RW_I93_MODE_NON_ADDRESSED 1
-
-typedef struct {
- tNFC_STATUS status;
- uint16_t msg_len; /* Length of the NDEF message */
-} tRW_T2T_DETECT;
-
-typedef struct {
- tNFC_STATUS status; /* Status of the POLL request */
- uint8_t rc; /* RC (request code) used in the POLL request */
- uint8_t response_num; /* Number of SENSF_RES responses */
- uint8_t response_bufsize; /* Size of SENSF_RES responses */
- uint8_t* response_buf; /* Buffer of responses (length + SENSF_RES) see
- $8.1.2.2 of NCI specs */
-} tRW_T3T_POLL;
-
-typedef struct {
- tNFC_STATUS status; /* Status of the Get System Codes request */
- uint8_t num_system_codes; /* Number of system codes */
- uint16_t* p_system_codes; /* Table of system codes */
-} tRW_T3T_SYSTEM_CODES;
-
-typedef struct {
- tNFC_STATUS status; /* status of NDEF detection */
- tNFC_PROTOCOL protocol; /* protocol used to detect NDEF */
- uint32_t max_size; /* max number of bytes available for NDEF data */
- uint32_t cur_size; /* current size of stored NDEF data (in bytes) */
- tRW_NDEF_FLAG flags; /* Flags to indicate NDEF capability,formatted,formatable
- and read only */
-} tRW_DETECT_NDEF_DATA;
-
-typedef struct {
- tNFC_STATUS status; /* status of NDEF detection */
- tNFC_PROTOCOL protocol; /* protocol used to detect TLV */
- uint8_t
- num_bytes; /* number of reserved/lock bytes based on the type of tlv */
-} tRW_DETECT_TLV_DATA;
-
-typedef struct {
- tNFC_STATUS status;
- NFC_HDR* p_data;
-} tRW_READ_DATA;
-
-typedef struct {
- tNFC_STATUS status;
- uint8_t sw1;
- uint8_t sw2;
-} tRW_T4T_SW;
-
-typedef struct /* RW_I93_INVENTORY_EVT */
-{
- tNFC_STATUS status; /* status of Inventory command */
- uint8_t dsfid; /* DSFID */
- uint8_t uid[I93_UID_BYTE_LEN]; /* UID[0]:MSB, ... UID[7]:LSB */
-} tRW_I93_INVENTORY;
-
-typedef struct /* RW_I93_DATA_EVT */
-{
- tNFC_STATUS status; /* status of Read/Get security status command */
- uint8_t command; /* sent command */
- NFC_HDR* p_data; /* block data of security status */
-} tRW_I93_DATA;
-
-typedef struct /* RW_I93_SYS_INFO_EVT */
-{
- tNFC_STATUS status; /* status of Get Sys Info command */
- uint8_t info_flags; /* information flags */
- uint8_t uid[I93_UID_BYTE_LEN]; /* UID[0]:MSB, ... UID[7]:LSB */
- uint8_t dsfid; /* DSFID if I93_INFO_FLAG_DSFID */
- uint8_t afi; /* AFI if I93_INFO_FLAG_AFI */
- uint16_t num_block; /* number of blocks if I93_INFO_FLAG_MEM_SIZE */
- uint8_t block_size; /* block size in byte if I93_INFO_FLAG_MEM_SIZE */
- uint8_t IC_reference; /* IC Reference if I93_INFO_FLAG_IC_REF */
-} tRW_I93_SYS_INFO;
-
-typedef struct /* RW_I93_CMD_CMPL_EVT */
-{
- tNFC_STATUS status; /* status of sent command */
- uint8_t command; /* sent command */
- uint8_t error_code; /* error code; I93_ERROR_CODE_XXX */
-} tRW_I93_CMD_CMPL;
-
-typedef struct {
- tNFC_STATUS status;
- NFC_HDR* p_data;
-} tRW_RAW_FRAME;
-
-typedef struct {
- uint8_t mbi;
- uint8_t uid[8];
-} t_RW_CI_INFO;
-
-typedef union {
- tNFC_STATUS status;
- tRW_T3T_POLL t3t_poll; /* Response to t3t poll command */
- tRW_T3T_SYSTEM_CODES t3t_sc; /* Received system codes from t3 tag */
- tRW_DETECT_TLV_DATA tlv; /* The information of detected TLV data */
- tRW_DETECT_NDEF_DATA ndef; /* The information of detected NDEF data */
- tRW_READ_DATA data; /* The received data from a tag */
- tRW_RAW_FRAME raw_frame; /* Response of raw frame sent */
- tRW_T4T_SW t4t_sw; /* Received status words from a tag */
- tRW_I93_INVENTORY i93_inventory; /* ISO 15693 Inventory response */
- tRW_I93_DATA i93_data; /* ISO 15693 Data response */
- tRW_I93_SYS_INFO i93_sys_info; /* ISO 15693 System Information */
- tRW_I93_CMD_CMPL i93_cmd_cmpl; /* ISO 15693 Command complete */
- t_RW_CI_INFO ci_info;
-} tRW_DATA;
-
-typedef void(tRW_CBACK)(tRW_EVENT event, tRW_DATA* p_data);
-
-/*******************************************************************************
-**
-** Function RW_T1tRid
-**
-** Description This function send a RID command for Reader/Writer mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tRid(void);
-
-/*******************************************************************************
-**
-** Function RW_T1tReadAll
-**
-** Description This function send a RALL command for Reader/Writer mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tReadAll(void);
-
-/*******************************************************************************
-**
-** Function RW_T1tRead
-**
-** Description This function send a READ command for Reader/Writer mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tRead(uint8_t block, uint8_t byte);
-
-/*******************************************************************************
-**
-** Function RW_T1tWriteErase
-**
-** Description This function send a WRITE-E command for Reader/Writer mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tWriteErase(uint8_t block, uint8_t byte,
- uint8_t new_byte);
-
-/*******************************************************************************
-**
-** Function RW_T1tWriteNoErase
-**
-** Description This function send a WRITE-NE command for Reader/Writer
-** mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tWriteNoErase(uint8_t block, uint8_t byte,
- uint8_t new_byte);
-
-/*******************************************************************************
-**
-** Function RW_T1tReadSeg
-**
-** Description This function send a RSEG command for Reader/Writer mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tReadSeg(uint8_t segment);
-
-/*******************************************************************************
-**
-** Function RW_T1tRead8
-**
-** Description This function send a READ8 command for Reader/Writer mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tRead8(uint8_t block);
-
-/*******************************************************************************
-**
-** Function RW_T1tWriteErase8
-**
-** Description This function send a WRITE-E8 command for Reader/Writer
-** mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tWriteErase8(uint8_t block, uint8_t* p_new_dat);
-
-/*******************************************************************************
-**
-** Function RW_T1tWriteNoErase8
-**
-** Description This function send a WRITE-NE8 command for Reader/Writer
-** mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tWriteNoErase8(uint8_t block, uint8_t* p_new_dat);
-
-/*******************************************************************************
-**
-** Function RW_T1tLocateTlv
-**
-** Description This function is called to find the start of the given TLV
-**
-** Parameters: void
-**
-** Returns NCI_STATUS_OK, if detection was started. Otherwise, error
-** status.
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tLocateTlv(uint8_t tlv_type);
-
-/*******************************************************************************
-**
-** Function RW_T1tDetectNDef
-**
-** Description This function can be called to detect if there is an NDEF
-** message on the tag.
-**
-** Parameters: void
-**
-** Returns NCI_STATUS_OK, if detection was started. Otherwise, error
-** status.
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tDetectNDef(void);
-
-/*******************************************************************************
-**
-** Function RW_T1tReadNDef
-**
-** Description This function can be called to read the NDEF message on the
-** tag.
-**
-** Parameters: p_buffer: The buffer into which to read the NDEF message
-** buf_len: The length of the buffer
-**
-** Returns NCI_STATUS_OK, if read was started. Otherwise, error status.
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tReadNDef(uint8_t* p_buffer, uint16_t buf_len);
-
-/*******************************************************************************
-**
-** Function RW_T1tWriteNDef
-**
-** Description This function can be called to write an NDEF message to the
-** tag.
-**
-** Parameters: msg_len: The length of the buffer
-** p_msg: The NDEF message to write
-**
-** Returns NCI_STATUS_OK, if write was started. Otherwise, error
-** status.
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tWriteNDef(uint16_t msg_len, uint8_t* p_msg);
-
-/*******************************************************************************
-**
-** Function RW_T1tSetTagReadOnly
-**
-** Description This function can be called to set the tag in to read only
-** state
-**
-** Parameters: b_hard_lock: To hard lock or just soft lock the tag
-**
-** Returns NCI_STATUS_OK, if set readonly operation started.
-** Otherwise, error status.
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T1tSetTagReadOnly(bool b_hard_lock);
-
-/*****************************************************************************
-**
-** Function RW_T1tPresenceCheck
-**
-** Description
-** Check if the tag is still in the field.
-**
-** The RW_T1T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
-** or non-presence.
-**
-** Returns
-** NFC_STATUS_OK, if raw data frame sent
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T1tPresenceCheck(void);
-
-/*****************************************************************************
-**
-** Function RW_T1tFormatNDef
-**
-** Description
-** Format Tag content
-**
-** Returns
-** NFC_STATUS_OK, Command sent to format Tag
-** NFC_STATUS_REJECTED: Invalid HR0 and cannot format the tag
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-tNFC_STATUS RW_T1tFormatNDef(void);
-
-/*******************************************************************************
-**
-** Function RW_T2tLocateTlv
-**
-** Description This function is called to find the start of the given TLV
-**
-** Returns Pointer to the TLV, if successful. Otherwise, NULL.
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T2tLocateTlv(uint8_t tlv_type);
-
-/*******************************************************************************
-**
-** Function RW_T2tRead
-**
-** Description This function issues the Type 2 Tag READ command. When the
-** operation is complete the callback function will be called
-** with a RW_T2T_READ_EVT.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T2tRead(uint16_t block);
-
-/*******************************************************************************
-**
-** Function RW_T2tWrite
-**
-** Description This function issues the Type 2 Tag WRITE command. When the
-** operation is complete the callback function will be called
-** with a RW_T2T_WRITE_EVT.
-**
-** p_write_data points to the array of 4 bytes to be written
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T2tWrite(uint16_t block, uint8_t* p_write_data);
-
-/*******************************************************************************
-**
-** Function RW_T2tSectorSelect
-**
-** Description This function issues the Type 2 Tag SECTOR-SELECT command
-** packet 1. If a NACK is received as the response, the
-** callback function will be called with a
-** RW_T2T_SECTOR_SELECT_EVT. If an ACK is received as the
-** response, the command packet 2 with the given sector number
-** is sent to the peer device. When the response for packet 2
-** is received, the callback function will be called with a
-** RW_T2T_SECTOR_SELECT_EVT.
-**
-** A sector is 256 contiguous blocks (1024 bytes).
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T2tSectorSelect(uint8_t sector);
-
-/*******************************************************************************
-**
-** Function RW_T2tDetectNDef
-**
-** Description This function will find NDEF message if any in the Tag
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T2tDetectNDef(bool skip_dyn_locks);
-
-/*******************************************************************************
-**
-** Function RW_T2tReadNDef
-**
-** Description This function can be called to read the NDEF message on the
-** tag.
-**
-** Parameters: p_buffer: The buffer into which to read the NDEF message
-** buf_len: The length of the buffer
-**
-** Returns NCI_STATUS_OK, if read was started. Otherwise, error status.
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T2tReadNDef(uint8_t* p_buffer, uint16_t buf_len);
-
-/*******************************************************************************
-**
-** Function RW_T2tWriteNDef
-**
-** Description This function can be called to write an NDEF message to the
-** tag.
-**
-** Parameters: msg_len: The length of the buffer
-** p_msg: The NDEF message to write
-**
-** Returns NCI_STATUS_OK, if write was started. Otherwise, error
-** status.
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T2tWriteNDef(uint16_t msg_len, uint8_t* p_msg);
-
-/*******************************************************************************
-**
-** Function RW_T2tSetTagReadOnly
-**
-** Description This function can be called to set the tag in to read only
-** state
-**
-** Parameters: b_hard_lock: To indicate hard lock the tag or not
-**
-** Returns NCI_STATUS_OK, if set readonly operation started.
-** Otherwise, error status.
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T2tSetTagReadOnly(bool b_hard_lock);
-
-/*****************************************************************************
-**
-** Function RW_T2tPresenceCheck
-**
-** Description
-** Check if the tag is still in the field.
-**
-** The RW_T2T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
-** or non-presence.
-**
-** Returns
-** NFC_STATUS_OK, if raw data frame sent
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T2tPresenceCheck(void);
-
-/*****************************************************************************
-**
-** Function RW_T2tFormatNDef
-**
-** Description
-** Format Tag content
-**
-** Returns
-** NFC_STATUS_OK, Command sent to format Tag
-** NFC_STATUS_FAILED: otherwise
-**
-*****************************************************************************/
-tNFC_STATUS RW_T2tFormatNDef(void);
-
-/*****************************************************************************
-**
-** Function RW_T3tDetectNDef
-**
-** Description
-** This function is used to perform NDEF detection on a Type 3 tag, and
-** retrieve the tag's NDEF attribute information (block 0).
-**
-** Before using this API, the application must call RW_SelectTagType to
-** indicate that a Type 3 tag has been activated, and to provide the
-** tag's Manufacture ID (IDm) .
-**
-** Returns
-** NFC_STATUS_OK: ndef detection procedure started
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T3tDetectNDef(void);
-
-/*****************************************************************************
-**
-** Function RW_T3tFormatNDef
-**
-** Description
-** Format a type-3 tag for NDEF.
-**
-** Only Felica-Lite tags are supported by this API. The
-** RW_T3T_FORMAT_CPLT_EVT is used to notify the status of the operation.
-**
-** Returns
-** NFC_STATUS_OK: ndef detection procedure started
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T3tFormatNDef(void);
-
-/*****************************************************************************
-**
-** Function RW_T3tSetReadOnly
-**
-** Description
-** Set a type-3 tag to Read Only
-**
-** Only Felica-Lite tags are supported by this API.
-** RW_T3tDetectNDef() must be called before using this
-** The RW_T3T_SET_READ_ONLY_CPLT_EVT event will be returned.
-**
-** Returns
-** NFC_STATUS_OK if success
-** NFC_STATUS_FAILED if T3T is busy or other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T3tSetReadOnly(bool b_hard_lock);
-
-/*****************************************************************************
-**
-** Function RW_T3tCheckNDef
-**
-** Description
-** Retrieve NDEF contents from a Type3 tag.
-**
-** The RW_T3T_CHECK_EVT event is used to notify the application for each
-** segment of NDEF data received. The RW_T3T_CHECK_CPLT_EVT event is used
-** to notify the application all segments have been received.
-**
-** Before using this API, the RW_T3tDetectNDef function must be called to
-** verify that the tag contains NDEF data, and to retrieve the NDEF
-** attributes.
-**
-** Internally, this command will be separated into multiple Tag 3 Check
-** commands (if necessary) - depending on the tag's Nbr (max number of
-** blocks per read) attribute.
-**
-** Returns
-** NFC_STATUS_OK: check command started
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T3tCheckNDef(void);
-
-/*****************************************************************************
-**
-** Function RW_T3tUpdateNDef
-**
-** Description
-** Write NDEF contents to a Type3 tag.
-**
-** The RW_T3T_UPDATE_CPLT_EVT callback event will be used to notify the
-** application of the response.
-**
-** Before using this API, the RW_T3tDetectNDef function must be called to
-** verify that the tag contains NDEF data, and to retrieve the NDEF
-** attributes.
-**
-** Internally, this command will be separated into multiple Tag 3 Update
-** commands (if necessary) - depending on the tag's Nbw (max number of
-** blocks per write) attribute.
-**
-** Returns
-** NFC_STATUS_OK: check command started
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_REFUSED: tag is read-only
-** NFC_STATUS_BUFFER_FULL: len exceeds tag's maximum size
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T3tUpdateNDef(uint32_t len, uint8_t* p_data);
-
-/*****************************************************************************
-**
-** Function RW_T3tCheck
-**
-** Description
-** Read (non-NDEF) contents from a Type3 tag.
-**
-** The RW_READ_EVT event is used to notify the application for each
-** segment of NDEF data received. The RW_READ_CPLT_EVT event is used to
-** notify the application all segments have been received.
-**
-** Before using this API, the application must call RW_SelectTagType to
-** indicate that a Type 3 tag has been activated, and to provide the
-** tag's Manufacture ID (IDm) .
-**
-** Returns
-** NFC_STATUS_OK: check command started
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T3tCheck(uint8_t num_blocks, tT3T_BLOCK_DESC* t3t_blocks);
-
-/*****************************************************************************
-**
-** Function RW_T3tUpdate
-**
-** Description
-** Write (non-NDEF) contents to a Type3 tag.
-**
-** The RW_WRITE_CPLT_EVT event is used to notify the application all
-** segments have been received.
-**
-** Before using this API, the application must call RW_SelectTagType to
-** indicate that a Type 3 tag has been activated, and to provide the tag's
-** Manufacture ID (IDm) .
-**
-** Returns
-** NFC_STATUS_OK: check command started
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T3tUpdate(uint8_t num_blocks, tT3T_BLOCK_DESC* t3t_blocks,
- uint8_t* p_data);
-
-/*****************************************************************************
-**
-** Function RW_T3tSendRawFrame
-**
-** Description
-** This function is called to send a raw data frame to the peer device.
-** When type 3 tag receives response from peer, the callback function
-** will be called with a RW_T3T_RAW_FRAME_EVT [Table 6].
-**
-** Before using this API, the application must call RW_SelectTagType to
-** indicate that a Type 3 tag has been activated.
-**
-** The raw frame should be a properly formatted Type 3 tag message.
-**
-** Returns
-** NFC_STATUS_OK, if raw data frame sent
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T3tSendRawFrame(uint16_t len, uint8_t* p_data);
-
-/*****************************************************************************
-**
-** Function RW_T3tPoll
-**
-** Description
-** Send POLL command
-**
-** Returns
-** NFC_STATUS_OK, if raw data frame sent
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T3tPoll(uint16_t system_code, tT3T_POLL_RC rc,
- uint8_t tsn);
-
-/*****************************************************************************
-**
-** Function RW_T3tPresenceCheck
-**
-** Description
-** Check if the tag is still in the field.
-**
-** The RW_T3T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
-** or non-presence.
-**
-** Returns
-** NFC_STATUS_OK, if raw data frame sent
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T3tPresenceCheck(void);
-
-/*****************************************************************************
-**
-** Function RW_T3tGetSystemCodes
-**
-** Description
-** Get systems codes supported by the activated tag:
-** Poll for wildcard (FFFF):
-** - If felica-lite code then poll for ndef (12fc)
-** - Otherwise send RequestSystmCode command to get
-** system codes.
-**
-** Before using this API, the application must call RW_SelectTagType to
-** indicate that a Type 3 tag has been activated.
-**
-** Returns
-** NFC_STATUS_OK, if raw data frame sent
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T3tGetSystemCodes(void);
-
-/*****************************************************************************
-**
-** Function RW_T4tFormatNDef
-**
-** Description
-** Format a type-4 tag for NDEF.
-**
-** Only Desifire tags are supported by this API. The
-** RW_T4T_FORMAT_CPLT_EVT is used to notify the status of the operation.
-**
-** Returns
-** NFC_STATUS_OK: if success
-** NFC_STATUS_FAILED: other error
-*****************************************************************************/
-extern tNFC_STATUS RW_T4tFormatNDef(void);
-
-/*******************************************************************************
-**
-** Function RW_T4tDetectNDef
-**
-** Description This function performs NDEF detection procedure
-**
-** RW_T4T_NDEF_DETECT_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_FAILED if T4T is busy or other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T4tDetectNDef(void);
-
-/*******************************************************************************
-**
-** Function RW_T4tReadNDef
-**
-** Description This function performs NDEF read procedure
-** Note: RW_T4tDetectNDef() must be called before using this
-**
-** The following event will be returned
-** RW_T4T_NDEF_READ_EVT for each segmented NDEF message
-** RW_T4T_NDEF_READ_CPLT_EVT for the last segment or
-** complete NDEF
-** RW_T4T_NDEF_READ_FAIL_EVT for failure
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_FAILED if T4T is busy or other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T4tReadNDef(void);
-
-/*******************************************************************************
-**
-** Function RW_T4tUpdateNDef
-**
-** Description This function performs NDEF update procedure
-** Note: RW_T4tDetectNDef() must be called before using this
-** Updating data must not be removed until returning
-** event
-**
-** The following event will be returned
-** RW_T4T_NDEF_UPDATE_CPLT_EVT for complete
-** RW_T4T_NDEF_UPDATE_FAIL_EVT for failure
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_FAILED if T4T is busy or other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T4tUpdateNDef(uint32_t length, uint8_t* p_data);
-
-/*****************************************************************************
-**
-** Function RW_T4tPresenceCheck
-**
-** Description
-** Check if the tag is still in the field.
-**
-** The RW_T4T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
-** or non-presence.
-**
-** option is RW_T4T_CHK_EMPTY_I_BLOCK, use empty I block for presence
-** check.
-**
-** Returns
-** NFC_STATUS_OK, if raw data frame sent
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T4tPresenceCheck(uint8_t option);
-
-/*****************************************************************************
-**
-** Function RW_T4tSetNDefReadOnly
-**
-** Description This function performs NDEF read-only procedure
-** Note: RW_T4tDetectNDef() must be called before using this
-**
-** The RW_T4T_SET_TO_RO_EVT event will be returned.
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_FAILED if T4T is busy or other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_T4tSetNDefReadOnly(void);
-
-/*******************************************************************************
-**
-** Function RW_I93Inventory
-**
-** Description This function send Inventory command with/without AFI
-** If UID is provided then set UID[0]:MSB, ... UID[7]:LSB
-**
-** RW_I93_RESPONSE_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_FAILED if T4T is busy or other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93Inventory(bool including_afi, uint8_t afi,
- uint8_t* p_uid);
-
-/*******************************************************************************
-**
-** Function RW_I93StayQuiet
-**
-** Description This function send Inventory command
-**
-** RW_I93_CMD_CMPL_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93StayQuiet(uint8_t* p_uid);
-
-/*******************************************************************************
-**
-** Function RW_I93ReadSingleBlock
-**
-** Description This function send Read Single Block command
-**
-** RW_I93_RESPONSE_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93ReadSingleBlock(uint16_t block_number);
-
-/*******************************************************************************
-**
-** Function RW_I93WriteSingleBlock
-**
-** Description This function send Write Single Block command
-** Application must get block size first by calling
-** RW_I93GetSysInfo().
-**
-** RW_I93_CMD_CMPL_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93WriteSingleBlock(uint16_t block_number,
- uint8_t* p_data);
-
-/*******************************************************************************
-**
-** Function RW_I93LockBlock
-**
-** Description This function send Lock Block command
-**
-** RW_I93_CMD_CMPL_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93LockBlock(uint8_t block_number);
-
-/*******************************************************************************
-**
-** Function RW_I93ReadMultipleBlocks
-**
-** Description This function send Read Multiple Blocks command
-**
-** RW_I93_RESPONSE_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93ReadMultipleBlocks(uint16_t first_block_number,
- uint16_t number_blocks);
-
-/*******************************************************************************
-**
-** Function RW_I93WriteMultipleBlocks
-**
-** Description This function send Write Multiple Blocks command
-**
-** RW_I93_CMD_CMPL_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93WriteMultipleBlocks(uint16_t first_block_number,
- uint16_t number_blocks,
- uint8_t* p_data);
-
-/*******************************************************************************
-**
-** Function RW_I93Select
-**
-** Description This function send Select command
-**
-** UID[0]: 0xE0, MSB
-** UID[1]: IC Mfg Code
-** ...
-** UID[7]: LSB
-**
-** RW_I93_CMD_CMPL_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93Select(uint8_t* p_uid);
-
-/*******************************************************************************
-**
-** Function RW_I93ResetToReady
-**
-** Description This function send Reset To Ready command
-**
-** RW_I93_CMD_CMPL_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93ResetToReady(void);
-
-/*******************************************************************************
-**
-** Function RW_I93WriteAFI
-**
-** Description This function send Write AFI command
-**
-** RW_I93_CMD_CMPL_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93WriteAFI(uint8_t afi);
-
-/*******************************************************************************
-**
-** Function RW_I93LockAFI
-**
-** Description This function send Lock AFI command
-**
-** RW_I93_CMD_CMPL_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93LockAFI(void);
-
-/*******************************************************************************
-**
-** Function RW_I93WriteDSFID
-**
-** Description This function send Write DSFID command
-**
-** RW_I93_CMD_CMPL_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93WriteDSFID(uint8_t dsfid);
-
-/*******************************************************************************
-**
-** Function RW_I93LockDSFID
-**
-** Description This function send Lock DSFID command
-**
-** RW_I93_CMD_CMPL_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93LockDSFID(void);
-
-/*******************************************************************************
-**
-** Function RW_I93GetSysInfo
-**
-** Description This function send Get System Information command
-** If UID is provided then set UID[0]:MSB, ... UID[7]:LSB
-**
-** RW_I93_RESPONSE_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93GetSysInfo(uint8_t* p_uid);
-
-/*******************************************************************************
-**
-** Function RW_I93GetMultiBlockSecurityStatus
-**
-** Description This function send Get Multiple Block Security Status
-** command
-**
-** RW_I93_RESPONSE_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_NO_BUFFERS if out of buffer
-** NFC_STATUS_BUSY if busy
-** NFC_STATUS_FAILED if other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93GetMultiBlockSecurityStatus(
- uint16_t first_block_number, uint16_t number_blocks);
-
-/*******************************************************************************
-**
-** Function RW_I93DetectNDef
-**
-** Description This function performs NDEF detection procedure
-**
-** RW_I93_NDEF_DETECT_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_FAILED if busy or other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93DetectNDef(void);
-
-/*******************************************************************************
-**
-** Function RW_I93ReadNDef
-**
-** Description This function performs NDEF read procedure
-** Note: RW_I93DetectNDef() must be called before using this
-**
-** The following event will be returned
-** RW_I93_NDEF_READ_EVT for each segmented NDEF message
-** RW_I93_NDEF_READ_CPLT_EVT for the last segment or
-** complete NDEF
-** RW_I93_NDEF_READ_FAIL_EVT for failure
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_FAILED if I93 is busy or other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93ReadNDef(void);
-
-/*******************************************************************************
-**
-** Function RW_I93UpdateNDef
-**
-** Description This function performs NDEF update procedure
-** Note: RW_I93DetectNDef() must be called before using this
-** Updating data must not be removed until returning
-** event
-**
-** The following event will be returned
-** RW_I93_NDEF_UPDATE_CPLT_EVT for complete
-** RW_I93_NDEF_UPDATE_FAIL_EVT for failure
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_FAILED if I93 is busy or other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93UpdateNDef(uint32_t length, uint8_t* p_data);
-
-/*******************************************************************************
-**
-** Function RW_I93FormatNDef
-**
-** Description This function performs formatting procedure
-**
-** RW_I93_FORMAT_CPLT_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_FAILED if busy or other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93FormatNDef(void);
-
-/*******************************************************************************
-**
-** Function RW_I93SetTagReadOnly
-**
-** Description This function performs NDEF read-only procedure
-** Note: RW_I93DetectNDef() must be called before using this
-** Updating data must not be removed until returning
-** event
-**
-** The RW_I93_SET_TAG_RO_EVT event will be returned.
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_FAILED if I93 is busy or other error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_I93SetTagReadOnly(void);
-
-/*****************************************************************************
-**
-** Function RW_I93PresenceCheck
-**
-** Description Check if the tag is still in the field.
-**
-** The RW_I93_PRESENCE_CHECK_EVT w/ status is used to indicate
-** presence or non-presence.
-**
-** Returns NFC_STATUS_OK, if raw data frame sent
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this
-** operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_I93PresenceCheck(void);
-
-/*****************************************************************************
-**
-** Function RW_I93CheckLegacyProduct
-**
-** Description Returns if the product is part of the legacy product list,
-** requiring (Extended)GetSystemInfo ISO commands to provide
-** memory information (number and size of blocks).
-**
-** Returns true, if product is a legacy one
-** false, if full NFC forum T5T compliant
-**
-*****************************************************************************/
-extern bool RW_I93CheckLegacyProduct(uint8_t ic_manuf, uint8_t pdt_code);
-
-/*****************************************************************************
-**
-** Function RW_I93SetAddressingMode
-**
-** Description Set if the tag must be addressed with UID or not.
-**
-** The addressing mode (addressed or non-addressed) must be
-** done at the module initialization prior to the Tag
-** activation.
-**
-** Returns NFC_STATUS_OK, if mode is stored
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_I93SetAddressingMode(bool mode);
-
-/*******************************************************************************
-**
-** Function RW_SendRawFrame
-**
-** Description This function sends a raw frame to the peer device.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_SendRawFrame(uint8_t* p_raw_data, uint16_t data_len);
-
-/*******************************************************************************
-**
-** Function RW_SetActivatedTagType
-**
-** Description This function sets tag type for Reader/Writer mode.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_SetActivatedTagType(tNFC_ACTIVATE_DEVT* p_activate_params,
- tRW_CBACK* p_cback);
-/*******************************************************************************
-**
-** Function RW_MfcDetectNDef
-**
-** Description This function performs NDEF detection procedure
-**
-** RW_MFC_NDEF_DETECT_EVT will be returned
-**
-** Returns NFC_STATUS_OK if success
-** NFC_STATUS_FAILED if Mifare classic tag is busy or other
-*error
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_MfcDetectNDef(void);
-
-/*******************************************************************************
-**
-** Function RW_MfcReadNDef
-**
-** Description This function can be called to read the NDEF message on the
-*tag.
-**
-** Parameters: p_buffer: The buffer into which to read the NDEF message
-** buf_len: The length of the buffer
-**
-** Returns NCI_STATUS_OK, if read was started. Otherwise, error status.
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_MfcReadNDef(uint8_t* p_buffer, uint16_t buf_len);
-
-/*******************************************************************************
-**
-** Function RW_T4tNfceeSelectApplication
-**
-** Description Selects T4T application using T4T AID
-**
-** Returns NFC_STATUS_OK if success else NFC_STATUS_FAILED
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T4tNfceeSelectApplication(void);
-
-/*******************************************************************************
-**
-** Function RW_T4tNfceeUpdateCC
-**
-** Description Updates the T4T data structures with CC info
-**
-** Returns None
-**
-*******************************************************************************/
-void RW_T4tNfceeUpdateCC(uint8_t* ccInfo);
-
-/*******************************************************************************
-**
-** Function rw_ci_select
-**
-** Description This function send Select command for Chinese Id card.
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern tNFC_STATUS rw_ci_select(void);
-
-/*****************************************************************************
-**
-** Function RW_CiPresenceCheck
-**
-** Description
-** Check if the tag is still in the field.
-**
-** The RW_CI_PRESENCE_CHECK_EVT w/ status is used to indicate presence
-** or non-presence.
-**
-** Returns
-** NFC_STATUS_OK, if raw data frame sent
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_CiPresenceCheck(void);
-
-/*****************************************************************************
-**
-** Function RW_CiSendAttrib
-**
-** Description
-** Send the Attrib to the Endpoint.
-**
-** Returns
-** NFC_STATUS_OK, if raw data frame sent
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_CiSendAttrib(uint8_t* nfcid0);
-
-#ifdef ST21NFC
-/*****************************************************************************
-**
-** Function RW_MfcPresenceCheck
-**
-** Description
-** Performs alternative MIFARE presence check
-**
-** Returns
-** NFC_STATUS_OK, if raw data frame sent
-** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_MfcPresenceCheck(uint8_t* p_auth_cmd);
-#endif
-
-/*******************************************************************************
-**
-** Function RW_T4tNfceeSelectFile
-**
-** Description Selects T4T Nfcee File
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T4tNfceeSelectFile(uint16_t fileId);
-
-/*******************************************************************************
-**
-** Function RW_T4tNfceeReadDataLen
-**
-** Description Reads proprietary data Len
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T4tNfceeReadDataLen();
-
-/*******************************************************************************
-**
-** Function RW_T4tNfceeStartUpdateFile
-**
-** Description starts writing data to the currently selected file
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T4tNfceeStartUpdateFile(uint16_t length, uint8_t* p_data);
-
-/*******************************************************************************
-**
-** Function RW_T4tNfceeUpdateFile
-**
-** Description writes requested data to the currently selected file
-**
-** Returns NFC_STATUS_OK if success else NFC_STATUS_FAILED
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T4tNfceeUpdateFile();
-
-/*******************************************************************************
-**
-** Function RW_T4tIsUpdateComplete
-**
-** Description Return true if no more data to write
-**
-** Returns true/false
-**
-*******************************************************************************/
-extern bool RW_T4tIsUpdateComplete(void);
-
-/*******************************************************************************
-**
-** Function RW_T4tIsReadComplete
-**
-** Description Return true if no more data to be read
-**
-** Returns true/false
-**
-*******************************************************************************/
-extern bool RW_T4tIsReadComplete(void);
-
-/*******************************************************************************
-**
-** Function RW_T4tNfceeReadFile
-**
-** Description Reads T4T Nfcee File
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T4tNfceeReadFile(uint16_t offset, uint16_t Readlen);
-
-/*******************************************************************************
-**
-** Function RW_T4tNfceeReadPendingData
-**
-** Description Reads pending data from T4T Nfcee File
-**
-** Returns NFC_STATUS_OK if success else NFC_STATUS_FAILED
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T4tNfceeReadPendingData();
-
-/*******************************************************************************
-**
-** Function RW_T4tNfceeUpdateNlen
-**
-** Description writes requested length to the file
-**
-** Returns NFC_STATUS_OK if success
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_T4tNfceeUpdateNlen(uint16_t len);
-
-/*******************************************************************************
-**
-** Function RW_SetT4tNfceeInfo
-**
-** Description This function sets callbacks for T4t operations.
-**
-** Returns tNFC_STATUS
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_SetT4tNfceeInfo(tRW_CBACK* p_cback, uint8_t conn_id);
-
-/*****************************************************************************
-**
-** Function RW_MfcFormatNDef
-**
-** Description
-** Format Tag content
-**
-** Returns
-** NFC_STATUS_OK, Command sent to format Tag
-** NFC_STATUS_REJECTED: cannot format the tag
-** NFC_STATUS_FAILED: other error
-**
-*****************************************************************************/
-extern tNFC_STATUS RW_MfcFormatNDef(void);
-
-/*******************************************************************************
-**
-** Function RW_MfcWriteNDef
-**
-** Description This function can be called to write an NDEF message to the
-** tag.
-**
-** Parameters: buf_len: The length of the buffer
-** p_buffer: The NDEF message to write
-**
-** Returns NCI_STATUS_OK, if write was started. Otherwise, error
-** status.
-**
-*******************************************************************************/
-extern tNFC_STATUS RW_MfcWriteNDef(uint16_t buf_len, uint8_t* p_buffer);
-
-#endif /* RW_API_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc/include/rw_int.h b/libstpropnci/libstnfc-nci-headers/src/nfc/include/rw_int.h
deleted file mode 100755
index 54ff04c..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc/include/rw_int.h
+++ /dev/null
@@ -1,948 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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 the Near Field Communication (NFC) Reader/Writer mode
- * related internal function / definitions.
- *
- ******************************************************************************/
-
-#ifndef RW_INT_H_
-#define RW_INT_H_
-
-#include "rw_api.h"
-#include "tags_defs.h"
-#include "tags_int.h"
-
-/* Proprietary definitions for HR0 and HR1 */
-/* TOPAZ96 Tag */
-#define RW_T1T_IS_TOPAZ96 0x11
-/* TOPAZ512 Tag */
-#define RW_T1T_IS_TOPAZ512 0x12
-/* Supports dynamic commands on static tag if HR1 > 0x49 */
-#define RW_T1T_HR1_MIN 0x49
-
-/* Maximum supported Memory control TLVS in the tag */
-#define RW_T1T_MAX_MEM_TLVS 0x05
-/* Maximum supported Lock control TLVS in the tag */
-#define RW_T1T_MAX_LOCK_TLVS 0x05
-/* Maximum supported dynamic lock bytes */
-#define RW_T1T_MAX_LOCK_BYTES 0x1E
-
-/* State of the Tag as interpreted by RW */
-/* TAG State is unknown to RW */
-#define RW_T1_TAG_ATTRB_UNKNOWN 0x00
-/* TAG is in INITIALIZED state */
-#define RW_T1_TAG_ATTRB_INITIALIZED 0x01
-/* TAG is in INITIALIZED state and has NDEF tlv with len=0 */
-#define RW_T1_TAG_ATTRB_INITIALIZED_NDEF 0x02
-/* TAG is in READ ONLY state */
-#define RW_T1_TAG_ATTRB_READ_ONLY 0x03
-/* TAG is in READ WRITE state */
-#define RW_T1_TAG_ATTRB_READ_WRITE 0x04
-
-/* Lock not yet set as part of SET TAG RO op */
-#define RW_T1T_LOCK_NOT_UPDATED 0x00
-/* Sent command to set the Lock bytes */
-#define RW_T1T_LOCK_UPDATE_INITIATED 0x01
-/* Lock bytes are set */
-#define RW_T1T_LOCK_UPDATED 0x02
-typedef uint8_t tRW_T1T_LOCK_STATUS;
-
-/* States */
-/* Tag not activated and or response not received for RID */
-#define RW_T1T_STATE_NOT_ACTIVATED 0x00
-/* T1 Tag activated and ready to perform rw operation on Tag*/
-#define RW_T1T_STATE_IDLE 0x01
-/* waiting rsp for read command sent to tag */
-#define RW_T1T_STATE_READ 0x02
-/* waiting rsp for write command sent to tag */
-#define RW_T1T_STATE_WRITE 0x03
-/* performing TLV detection procedure */
-#define RW_T1T_STATE_TLV_DETECT 0x04
-/* performing read NDEF procedure */
-#define RW_T1T_STATE_READ_NDEF 0x05
-/* performing update NDEF procedure */
-#define RW_T1T_STATE_WRITE_NDEF 0x06
-/* Setting Tag as read only tag */
-#define RW_T1T_STATE_SET_TAG_RO 0x07
-/* Check if Tag is still present */
-#define RW_T1T_STATE_CHECK_PRESENCE 0x08
-/* Format T1 Tag */
-#define RW_T1T_STATE_FORMAT_TAG 0x09
-
-/* Sub states */
-/* Default substate */
-#define RW_T1T_SUBSTATE_NONE 0x00
-
-/* Sub states in RW_T1T_STATE_TLV_DETECT state */
-/* waiting for the detection of a tlv in a tag */
-#define RW_T1T_SUBSTATE_WAIT_TLV_DETECT 0x01
-/* waiting for finding the len field is 1 or 3 bytes long */
-#define RW_T1T_SUBSTATE_WAIT_FIND_LEN_FIELD_LEN 0x02
-/* waiting for extracting len field value */
-#define RW_T1T_SUBSTATE_WAIT_READ_TLV_LEN0 0x03
-/* waiting for extracting len field value */
-#define RW_T1T_SUBSTATE_WAIT_READ_TLV_LEN1 0x04
-/* waiting for extracting value field in the TLV */
-#define RW_T1T_SUBSTATE_WAIT_READ_TLV_VALUE 0x05
-/* waiting for reading dynamic locks in the TLV */
-#define RW_T1T_SUBSTATE_WAIT_READ_LOCKS 0x06
-
-/* Sub states in RW_T1T_STATE_WRITE_NDEF state */
-/* waiting for response of reading a block that will be partially updated */
-#define RW_T1T_SUBSTATE_WAIT_READ_NDEF_BLOCK 0x07
-/* waiting for response of invalidating NDEF Msg */
-#define RW_T1T_SUBSTATE_WAIT_INVALIDATE_NDEF 0x08
-/* waiting for response of writing a part of NDEF Msg */
-#define RW_T1T_SUBSTATE_WAIT_NDEF_WRITE 0x09
-/* waiting for response of writing last part of NDEF Msg */
-#define RW_T1T_SUBSTATE_WAIT_NDEF_UPDATED 0x0A
-/* waiting for response of validating NDEF Msg */
-#define RW_T1T_SUBSTATE_WAIT_VALIDATE_NDEF 0x0B
-
-/* Sub states in RW_T1T_STATE_SET_TAG_RO state */
-/* waiting for response of setting CC-RWA to read only */
-#define RW_T1T_SUBSTATE_WAIT_SET_CC_RWA_RO 0x0C
-/* waiting for response of setting all static lock bits */
-#define RW_T1T_SUBSTATE_WAIT_SET_ST_LOCK_BITS 0x0D
-/* waiting for response of setting all dynamic lock bits */
-#define RW_T1T_SUBSTATE_WAIT_SET_DYN_LOCK_BITS 0x0E
-
-/* Sub states in RW_T1T_STATE_FORMAT_TAG state */
-/* waiting for response to format/set capability container */
-#define RW_T1T_SUBSTATE_WAIT_SET_CC 0x0F
-/* waiting for response to format/set NULL NDEF */
-#define RW_T1T_SUBSTATE_WAIT_SET_NULL_NDEF 0x10
-
-typedef struct {
- uint16_t offset; /* Offset of the lock byte in the Tag */
- uint8_t num_bits; /* Number of lock bits in the lock byte */
- uint8_t bytes_locked_per_bit; /* No. of tag bytes gets locked by a bit in this
- byte */
-} tRW_T1T_LOCK_INFO;
-
-typedef struct {
- uint16_t offset; /* Reserved bytes offset taken from Memory control TLV */
- uint8_t num_bytes; /* Number of reserved bytes as per the TLV */
-} tRW_T1T_RES_INFO;
-
-typedef struct {
- uint8_t tlv_index; /* Index of Lock control tlv that points to this address*/
- uint8_t byte_index; /* Index of Lock byte pointed by the TLV */
- uint8_t lock_byte; /* Value in the lock byte */
- tRW_T1T_LOCK_STATUS
- lock_status; /* Indicates if it is modified to set tag as Read only */
- bool b_lock_read; /* Is the lock byte is already read from tag */
-} tRW_T1T_LOCK;
-
-typedef struct {
- uint8_t addr; /* ADD/ADD8/ADDS field value */
- uint8_t op_code; /* Command sent */
- uint8_t rsp_len; /* expected length of the response */
- uint8_t
- pend_retx_rsp; /* Number of pending rsps to retransmission on prev cmd */
-} tRW_T1T_PREV_CMD_RSP_INFO;
-
-#if (RW_NDEF_INCLUDED == TRUE)
-/* Buffer 0-E block, for easier tlv operation */
-#define T1T_BUFFER_SIZE T1T_STATIC_SIZE
-#else
-/* Buffer UID */
-#define T1T_BUFFER_SIZE T1T_UID_LEN
-#endif
-
-/* RW Type 1 Tag control blocks */
-typedef struct {
- uint8_t
- hr[T1T_HR_LEN]; /* Header ROM byte 0 - 0x1y,Header ROM byte 1 - 0x00 */
- uint8_t mem[T1T_SEGMENT_SIZE]; /* Tag contents of block 0 or from block 0-E */
- tT1T_CMD_RSP_INFO*
- p_cmd_rsp_info; /* Pointer to Command rsp info of last sent command */
- uint8_t state; /* Current state of RW module */
- uint8_t tag_attribute; /* Present state of the Tag as interpreted by RW */
- NFC_HDR*
- p_cur_cmd_buf; /* Buffer to hold cur sent command for retransmission */
- uint8_t addr; /* ADD/ADD8/ADDS value */
- tRW_T1T_PREV_CMD_RSP_INFO
- prev_cmd_rsp_info; /* Information about previous sent command if retx */
- TIMER_LIST_ENT timer; /* timer to set timelimit for the response to command */
- bool b_update; /* Tag header updated */
- bool b_rseg; /* Segment 0 read from tag */
- bool b_hard_lock; /* Hard lock the tag as part of config tag to Read only */
-#if (RW_NDEF_INCLUDED == TRUE)
- uint8_t segment; /* Current Tag segment */
- uint8_t substate; /* Current substate of RW module */
- uint16_t work_offset; /* Working byte offset */
- uint8_t ndef_first_block[T1T_BLOCK_SIZE]; /* Buffer for ndef first block */
- uint8_t ndef_final_block[T1T_BLOCK_SIZE]; /* Buffer for ndef last block */
- uint8_t* p_ndef_buffer; /* Buffer to store ndef message */
- uint16_t new_ndef_msg_len; /* Length of new updating NDEF Message */
- uint8_t block_read; /* Last read Block */
- uint8_t write_byte; /* Index of last written byte */
- uint8_t tlv_detect; /* TLV type under detection */
- uint16_t ndef_msg_offset; /* The offset on Tag where first NDEF message is
- present*/
- uint16_t ndef_msg_len; /* Length of NDEF Message */
- uint16_t
- max_ndef_msg_len; /* Maximum size of NDEF that can be written on the tag
- */
- uint16_t ndef_header_offset; /* The offset on Tag where first NDEF tlv is
- present */
- uint8_t ndef_block_written; /* Last block where NDEF bytes are written */
- uint8_t num_ndef_finalblock; /* Block number where NDEF's last byte will be
- present */
- uint8_t num_lock_tlvs; /* Number of lcok tlvs detected in the tag */
- tRW_T1T_LOCK_INFO lock_tlv[RW_T1T_MAX_LOCK_TLVS]; /* Information retrieved
- from lock control tlv */
- uint8_t num_lockbytes; /* Number of dynamic lock bytes present in the tag */
- tRW_T1T_LOCK
- lockbyte[RW_T1T_MAX_LOCK_BYTES]; /* Dynamic Lock byte information */
- uint8_t num_mem_tlvs; /* Number of memory tlvs detected in the tag */
- tRW_T1T_RES_INFO
- mem_tlv[RW_T1T_MAX_MEM_TLVS]; /* Information retrieved from mem tlv */
- uint8_t attr_seg; /* Tag segment for which attributes are prepared */
- uint8_t
- lock_attr_seg; /* Tag segment for which lock attributes are prepared */
- uint8_t attr[T1T_BLOCKS_PER_SEGMENT]; /* byte information - Reserved/lock/otp
- or data */
- uint8_t lock_attr[T1T_BLOCKS_PER_SEGMENT]; /* byte information - read only or
- read write */
-#endif
-} tRW_T1T_CB;
-
-/* Mifare Ultalight/ Ultralight Family blank tag version block settings */
-/* Block where version number of the tag is stored */
-#define T2T_MIFARE_VERSION_BLOCK 0x04
-/* Blank Ultralight tag - Block 4 (byte 0, byte 1) */
-#define T2T_MIFARE_ULTRALIGHT_VER_NO 0xFFFF
-/* Blank Ultralight family tag - Block 4 (byte 0, byte 1) */
-#define T2T_MIFARE_ULTRALIGHT_FAMILY_VER_NO 0x0200
-
-/* Infineon my-d move / my-d blank tag uid block settings */
-#define T2T_INFINEON_VERSION_BLOCK 0x00
-#define T2T_INFINEON_MYD_MOVE_LEAN 0x0570
-#define T2T_INFINEON_MYD_MOVE 0x0530
-
-#define T2T_BRCM_VERSION_BLOCK 0x00
-#define T2T_BRCM_STATIC_MEM 0x2E01
-#define T2T_BRCM_DYNAMIC_MEM 0x2E02
-
-#define T2T_NDEF_NOT_DETECTED 0x00
-#define T2T_NDEF_DETECTED 0x01
-#define T2T_NDEF_READ 0x02
-
-/* Maximum supported Memory control TLVS in the tag */
-#define RW_T2T_MAX_MEM_TLVS 0x05
-/* Maximum supported Lock control TLVS in the tag */
-#define RW_T2T_MAX_LOCK_TLVS 0x05
-/* Maximum supported dynamic lock bytes */
-#define RW_T2T_MAX_LOCK_BYTES 0x20
-#define RW_T2T_SEGMENT_BYTES 128
-#define RW_T2T_SEGMENT_SIZE 16
-
-/* Lock not yet set as part of SET TAG RO op */
-#define RW_T2T_LOCK_NOT_UPDATED 0x00
-/* Sent command to set the Lock bytes */
-#define RW_T2T_LOCK_UPDATE_INITIATED 0x01
-/* Lock bytes are set */
-#define RW_T2T_LOCK_UPDATED 0x02
-typedef uint8_t tRW_T2T_LOCK_STATUS;
-
-/* States */
-/* Tag not activated */
-#define RW_T2T_STATE_NOT_ACTIVATED 0x00
-/* T1 Tag activated and ready to perform rw operation on Tag*/
-#define RW_T2T_STATE_IDLE 0x01
-/* waiting response for read command sent to tag */
-#define RW_T2T_STATE_READ 0x02
-/* waiting response for write command sent to tag */
-#define RW_T2T_STATE_WRITE 0x03
-/* Waiting response for sector select command */
-#define RW_T2T_STATE_SELECT_SECTOR 0x04
-/* Detecting Lock/Memory/NDEF/Proprietary TLV in the Tag */
-#define RW_T2T_STATE_DETECT_TLV 0x05
-/* Performing NDEF Read procedure */
-#define RW_T2T_STATE_READ_NDEF 0x06
-/* Performing NDEF Write procedure */
-#define RW_T2T_STATE_WRITE_NDEF 0x07
-/* Setting Tag as Read only tag */
-#define RW_T2T_STATE_SET_TAG_RO 0x08
-/* Check if Tag is still present */
-#define RW_T2T_STATE_CHECK_PRESENCE 0x09
-/* Format the tag */
-#define RW_T2T_STATE_FORMAT_TAG 0x0A
-/* Tag is in HALT State */
-#define RW_T2T_STATE_HALT 0x0B
-
-/* rw_t2t_read/rw_t2t_write takes care of sector change if the block to
- * read/write is in a different sector
- * Next Substate should be assigned to control variable 'substate' before
- * calling these function for State Machine to
- * move back to the particular substate after Sector change is completed and
- * read/write command is sent on new sector */
-
-/* Sub states */
-#define RW_T2T_SUBSTATE_NONE 0x00
-
-/* Sub states in RW_T2T_STATE_SELECT_SECTOR state */
-/* waiting for response of sector select CMD 1 */
-#define RW_T2T_SUBSTATE_WAIT_SELECT_SECTOR_SUPPORT 0x01
-/* waiting for response of sector select CMD 2 */
-#define RW_T2T_SUBSTATE_WAIT_SELECT_SECTOR 0x02
-
-/* Sub states in RW_T1T_STATE_DETECT_XXX state */
-/* waiting for the detection of a tlv in a tag */
-#define RW_T2T_SUBSTATE_WAIT_READ_CC 0x03
-/* waiting for the detection of a tlv in a tag */
-#define RW_T2T_SUBSTATE_WAIT_TLV_DETECT 0x04
-/* waiting for finding the len field is 1 or 3 bytes long */
-#define RW_T2T_SUBSTATE_WAIT_FIND_LEN_FIELD_LEN 0x05
-/* waiting for extracting len field value */
-#define RW_T2T_SUBSTATE_WAIT_READ_TLV_LEN0 0x06
-/* waiting for extracting len field value */
-#define RW_T2T_SUBSTATE_WAIT_READ_TLV_LEN1 0x07
-/* waiting for extracting value field in the TLV */
-#define RW_T2T_SUBSTATE_WAIT_READ_TLV_VALUE 0x08
-/* waiting for reading dynamic locks in the TLV */
-#define RW_T2T_SUBSTATE_WAIT_READ_LOCKS 0x09
-
-/* Sub states in RW_T2T_STATE_WRITE_NDEF state */
-/* waiting for rsp to reading the block where NDEF starts */
-#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_FIRST_BLOCK 0x0A
-/* waiting for rsp to reading block where new NDEF Msg ends */
-#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_LAST_BLOCK 0x0B
-/* waiting for rsp to reading block where Trm tlv gets added*/
-#define RW_T2T_SUBSTATE_WAIT_READ_TERM_TLV_BLOCK 0x0C
-/* waiting for rsp to reading block where nxt NDEF write */
-#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_NEXT_BLOCK 0x0D
-/* waiting for rsp to write NDEF block */
-#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_NEXT_BLOCK 0x0E
-/* waiting for rsp to last NDEF block write cmd */
-#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_LAST_BLOCK 0x0F
-/* waiting for rsp to reading NDEF len field block */
-#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_LEN_BLOCK 0x10
-/* waiting for rsp of updating first NDEF len field block */
-#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_LEN_BLOCK 0x11
-/* waiting for rsp of updating next NDEF len field block */
-#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_LEN_NEXT_BLOCK 0x12
-/* waiting for rsp to writing to Terminator tlv */
-#define RW_T2T_SUBSTATE_WAIT_WRITE_TERM_TLV_CMPLT 0x13
-
-/* Sub states in RW_T2T_STATE_FORMAT_TAG state */
-#define RW_T2T_SUBSTATE_WAIT_READ_VERSION_INFO 0x14
-/* waiting for response to format/set capability container */
-#define RW_T2T_SUBSTATE_WAIT_SET_CC 0x15
-#define RW_T2T_SUBSTATE_WAIT_SET_LOCK_TLV 0x16
-/* waiting for response to format/set NULL NDEF */
-#define RW_T2T_SUBSTATE_WAIT_SET_NULL_NDEF 0x17
-
-/* Sub states in RW_T2T_STATE_SET_TAG_RO state */
-/* waiting for response to set CC3 to RO */
-#define RW_T2T_SUBSTATE_WAIT_SET_CC_RO 0x19
-/* waiting for response to read dynamic lock bytes block */
-#define RW_T2T_SUBSTATE_WAIT_READ_DYN_LOCK_BYTE_BLOCK 0x1A
-/* waiting for response to set dynamic lock bits */
-#define RW_T2T_SUBSTATE_WAIT_SET_DYN_LOCK_BITS 0x1B
-
-typedef struct {
- uint16_t offset; /* Offset of the lock byte in the Tag */
- uint16_t num_bits; /* Number of lock bits in the lock byte */
- uint16_t bytes_locked_per_bit; /* No. of tag bytes gets locked by a bit
- in this byte */
-} tRW_T2T_LOCK_INFO;
-
-typedef struct {
- uint16_t offset; /* Reserved bytes offset taken from Memory control TLV */
- uint16_t num_bytes; /* Number of reserved bytes as per the TLV */
-} tRW_T2T_RES_INFO;
-
-typedef struct {
- uint8_t tlv_index; /* Index of Lock control tlv that points to this address */
- uint8_t byte_index; /* Index of Lock byte pointed by the TLV */
- uint8_t lock_byte; /* Value in the lock byte */
- tRW_T2T_LOCK_STATUS
- lock_status; /* Indicates if it is modified to set tag as Read only */
- bool b_lock_read; /* Is the lock byte is already read from tag */
-} tRW_T2T_LOCK;
-
-/* RW Type 2 Tag control block */
-typedef struct {
- uint8_t state; /* Reader/writer state */
- uint8_t substate; /* Reader/write substate in NDEF write state */
- uint8_t
- prev_substate; /* Substate of the tag before moving to different sector */
- uint8_t sector; /* Sector number that is selected */
- uint8_t select_sector; /* Sector number that is expected to get selected */
- uint8_t tag_hdr[T2T_READ_DATA_LEN]; /* T2T Header blocks */
- uint8_t tag_data[T2T_READ_DATA_LEN]; /* T2T Block 4 - 7 data */
- uint8_t ndef_status; /* The current status of NDEF Write operation */
- uint16_t block_read; /* Read block */
- uint16_t block_written; /* Written block */
- tT2T_CMD_RSP_INFO*
- p_cmd_rsp_info; /* Pointer to Command rsp info of last sent command */
- NFC_HDR* p_cur_cmd_buf; /* Copy of current command, for retx/send after sector
- change */
- NFC_HDR* p_sec_cmd_buf; /* Copy of command, to send after sector change */
- TIMER_LIST_ENT t2_timer; /* timeout for each API call */
- bool b_read_hdr; /* Tag header read from tag */
- bool b_read_data; /* Tag data block read from tag */
- bool b_hard_lock; /* Hard lock the tag as part of config tag to Read only */
- bool check_tag_halt; /* Resent command after NACK rsp to find tag is in HALT
- State */
-#if (RW_NDEF_INCLUDED == TRUE)
- bool skip_dyn_locks; /* Skip reading dynamic lock bytes from the tag */
- uint8_t found_tlv; /* The Tlv found while searching a particular TLV */
- uint8_t tlv_detect; /* TLV type under detection */
- uint8_t num_lock_tlvs; /* Number of lcok tlvs detected in the tag */
- uint8_t attr_seg; /* Tag segment for which attributes are prepared */
- uint8_t
- lock_attr_seg; /* Tag segment for which lock attributes are prepared */
- uint8_t segment; /* Current operating segment */
- uint8_t ndef_final_block[T2T_BLOCK_SIZE]; /* Buffer for ndef last block */
- uint8_t num_mem_tlvs; /* Number of memory tlvs detected in the tag */
- uint8_t num_lockbytes; /* Number of dynamic lock bytes present in the tag */
- uint8_t attr[RW_T2T_SEGMENT_SIZE]; /* byte information - Reserved/lock/otp or
- data */
- uint8_t lock_attr[RW_T2T_SEGMENT_SIZE]; /* byte information - read only or
- read write */
- uint8_t tlv_value[3]; /* Read value field of TLV */
- uint8_t ndef_first_block[T2T_BLOCK_LEN]; /* NDEF TLV Header block */
- uint8_t ndef_read_block[T2T_BLOCK_LEN]; /* Buffer to hold read before write
- block */
- uint8_t ndef_last_block[T2T_BLOCK_LEN]; /* Terminator TLV block after NDEF
- Write operation */
- uint8_t terminator_tlv_block[T2T_BLOCK_LEN]; /* Terminator TLV Block */
- uint16_t ndef_last_block_num; /* Block where last byte of updating ndef
- message will exist */
- uint16_t ndef_read_block_num; /* Block read during NDEF Write to avoid
- overwritting res bytes */
- uint16_t
- bytes_count; /* No. of bytes remaining to collect during tlv detect */
- uint16_t terminator_byte_index; /* The offset of the tag where terminator tlv
- may be added */
- uint16_t work_offset; /* Working byte offset */
- uint16_t ndef_header_offset;
- uint16_t
- ndef_msg_offset; /* Offset on Tag where first NDEF message is present */
- uint16_t ndef_msg_len; /* Length of NDEF Message */
- uint16_t
- max_ndef_msg_len; /* Maximum size of NDEF that can be written on the tag
- */
- uint16_t new_ndef_msg_len; /* Length of new updating NDEF Message */
- uint16_t ndef_write_block;
- uint16_t prop_msg_len; /* Proprietary tlv length */
- uint8_t* p_new_ndef_buffer; /* Pointer to updating NDEF Message */
- uint8_t* p_ndef_buffer; /* Pointer to NDEF Message */
- tRW_T2T_LOCK_INFO lock_tlv[RW_T2T_MAX_LOCK_TLVS]; /* Information retrieved
- from lock control tlv */
- tRW_T2T_LOCK
- lockbyte[RW_T2T_MAX_LOCK_BYTES]; /* Dynamic Lock byte information */
- tRW_T2T_RES_INFO
- mem_tlv[RW_T2T_MAX_MEM_TLVS]; /* Information retrieved from mem tlv */
-#endif
-} tRW_T2T_CB;
-
-/* Type 3 Tag control block */
-typedef uint8_t tRW_T3T_RW_STATE;
-
-typedef struct {
- tNFC_STATUS status;
- uint8_t version; /* Ver: peer version */
- uint8_t
- nbr; /* NBr: number of blocks that can be read using one Check command */
- uint8_t nbw; /* Nbw: number of blocks that can be written using one Update
- command */
- uint16_t nmaxb; /* Nmaxb: maximum number of blocks available for NDEF data */
- uint8_t writef; /* WriteFlag: 00h if writing data finished; 0Fh if writing
- data in progress */
- uint8_t
- rwflag; /* RWFlag: 00h NDEF is read-only; 01h if read/write available */
- uint32_t ln; /* Ln: actual size of stored NDEF data (in bytes) */
-} tRW_T3T_DETECT;
-
-/* RW_T3T control block flags */
-/* The final command for completing the NDEF read/write */
-#define RW_T3T_FL_IS_FINAL_NDEF_SEGMENT 0x01
-/* Waiting for POLL response for presence check */
-#define RW_T3T_FL_W4_PRESENCE_CHECK_POLL_RSP 0x02
-/* Waiting for POLL response for RW_T3tGetSystemCodes */
-#define RW_T3T_FL_W4_GET_SC_POLL_RSP 0x04
-/* Waiting for POLL response for RW_T3tDetectNDef */
-#define RW_T3T_FL_W4_NDEF_DETECT_POLL_RSP 0x08
-/* Waiting for POLL response for RW_T3tFormat */
-#define RW_T3T_FL_W4_FMT_FELICA_LITE_POLL_RSP 0x10
-/* Waiting for POLL response for RW_T3tSetReadOnly */
-#define RW_T3T_FL_W4_SRO_FELICA_LITE_POLL_RSP 0x20
-/* Waiting for POLL response for RW_T3tPoll */
-#define RW_T3T_FL_W4_USER_POLL_RSP 0x40
-
-typedef struct {
- uint32_t cur_tout; /* Current command timeout */
- /* check timeout is check_tout_a + n * check_tout_b; X is T/t3t * 4^E */
- uint32_t check_tout_a; /* Check command timeout (A+1)*X */
- uint32_t check_tout_b; /* Check command timeout (B+1)*X */
- /* update timeout is update_tout_a + n * update_tout_b; X is T/t3t * 4^E */
- uint32_t update_tout_a; /* Update command timeout (A+1)*X */
- uint32_t update_tout_b; /* Update command timeout (B+1)*X */
- tRW_T3T_RW_STATE rw_state; /* Reader/writer state */
- uint8_t rw_substate;
- uint8_t cur_cmd; /* Current command being executed */
- NFC_HDR* p_cur_cmd_buf; /* Copy of current command, for retransmission */
- TIMER_LIST_ENT timer; /* timeout for waiting for response */
- TIMER_LIST_ENT poll_timer; /* timeout for waiting for response */
-
- tRW_T3T_DETECT ndef_attrib; /* T3T NDEF attribute information */
-
- uint32_t ndef_msg_len; /* Length of ndef message to send */
- uint32_t ndef_msg_bytes_sent; /* Length of ndef message sent so far */
- uint8_t* ndef_msg; /* Buffer for outgoing NDEF message */
- uint32_t ndef_rx_readlen; /* Number of bytes read in current CHECK command */
- uint32_t ndef_rx_offset; /* Length of ndef message read so far */
-
- uint8_t num_system_codes; /* System codes detected */
- uint16_t system_codes[T3T_MAX_SYSTEM_CODES];
-
- uint8_t peer_nfcid2[NCI_NFCID2_LEN];
- uint8_t cur_poll_rc; /* RC used in current POLL command */
-
- uint8_t flags; /* Flags see RW_T3T_FL_* */
- /* Recall System Code used in last T3T polling command */
- int32_t cur_active_sc;
-} tRW_T3T_CB;
-
-/*
-** Type 4 Tag
-*/
-
-/* Max data size using a single ReadBinary. 2 bytes are for status bytes */
-#define RW_T4T_MAX_DATA_PER_READ \
- (NFC_RW_POOL_BUF_SIZE - NFC_HDR_SIZE - NCI_DATA_HDR_SIZE - \
- T4T_RSP_STATUS_WORDS_SIZE)
-
-/* Max data size using a single UpdateBinary. 6 bytes are for CLA, INS, P1, P2,
- * Lc */
-/* Use worst case where Extended Field Coding and ODO format are used */
-#define RW_T4T_MAX_DATA_PER_WRITE \
- (NFC_RW_POOL_BUF_SIZE - NFC_HDR_SIZE - NCI_MSG_OFFSET_SIZE - \
- NCI_DATA_HDR_SIZE - T4T_CMD_MAX_EXT_HDR_SIZE)
-
-#define RW_T4T_EXT_FIELD_CODING 0x01
-#define RW_T4T_DDO_LC_FIELD_CODING 0x02
-
-#define RW_T4T_BER_TLV_LENGTH_1_BYTE 0x01
-#define RW_T4T_BER_TLV_LENGTH_2_BYTES 0x02
-#define RW_T4T_BER_TLV_LENGTH_3_BYTES 0x03
-
-/* Minimum data header in command APDU data:
- * ODO: 54 00 xxyyzz: tag '54' with 3-byte offset xxyyzz
- * DDO: 53 Ld {data to be written to the ENDEF File}
- * Ld (data length) can be 1, 2 or 3 bytes
- */
-#define RW_T4T_ODO_DDO_HEADER_MIN_LENGTH 0x06 /* ODO + tag '53' */
-/* Ld encoded on two bytes with '81' tag and N=0 to 255
- * for data field length coded on one byte */
-#define RW_T4T_ODO_DDO_HEADER_2BYTES_LENGTH 8 /* ODO + tag '53' + '81' + N */
-/* Mandatory NDEF file control */
-typedef struct {
- uint16_t file_id; /* File Identifier */
- uint32_t max_file_size; /* Max NDEF file size */
- uint8_t read_access; /* read access condition */
- uint8_t write_access; /* write access condition */
- uint8_t nlen_size; /* (E)NLEN size (2 or 4 bytes) */
-} tRW_T4T_NDEF_FC;
-
-/* Capability Container */
-typedef struct {
- uint16_t cclen; /* the size of this capability container */
- uint8_t version; /* the mapping specification version */
- uint16_t max_le; /* the max data size by a single ReadBinary */
- uint16_t max_lc; /* the max data size by a single UpdateBinary */
- tRW_T4T_NDEF_FC ndef_fc; /* Mandatory NDEF file control */
-} tRW_T4T_CC;
-
-typedef uint8_t tRW_T4T_RW_STATE;
-typedef uint8_t tRW_T4T_RW_SUBSTATE;
-
-/* Type 4 Tag Control Block */
-typedef struct {
- tRW_T4T_RW_STATE state; /* main state */
- tRW_T4T_RW_SUBSTATE sub_state; /* sub state */
- uint8_t version; /* currently effective version */
- TIMER_LIST_ENT timer; /* timeout for each API call */
-
- uint32_t ndef_length; /* length of NDEF data */
- uint8_t* p_update_data; /* pointer of data to update */
- uint32_t rw_length; /* remaining bytes to read/write */
- uint32_t rw_offset; /* remaining offset to read/write */
-
- NFC_HDR* p_data_to_free; /* GKI buffet to delete after done */
- NFC_HDR* p_retry_cmd; /* buffer to store cmd sent last */
-
- tRW_T4T_CC cc_file; /* Capability Container File */
-
-/* NDEF has been detected */
-#define RW_T4T_NDEF_STATUS_NDEF_DETECTED 0x01
-/* NDEF file is read-only */
-#define RW_T4T_NDEF_STATUS_NDEF_READ_ONLY 0x02
-
- uint8_t ndef_status; /* bitmap for NDEF status */
- uint8_t channel; /* channel id: used for read-binary */
-
- uint16_t max_read_size; /* max reading size per a command */
- uint16_t max_update_size; /* max updating size per a command */
- uint16_t card_size;
- uint8_t card_type;
- uint8_t intl_flags; /* flags for internal information */
-} tRW_T4T_CB;
-
-/* RW retransmission statistics */
-#if (RW_STATS_INCLUDED == TRUE)
-typedef struct {
- uint32_t start_tick; /* System tick count at activation */
- uint32_t bytes_sent; /* Total bytes sent since activation */
- uint32_t bytes_received; /* Total bytes received since activation */
- uint32_t num_ops; /* Number of operations since activation */
- uint32_t num_retries; /* Number of retranmissions since activation */
- uint32_t num_crc; /* Number of crc failures */
- uint32_t num_trans_err; /* Number of transmission error notifications */
- uint32_t num_fail; /* Number of aborts (failures after retries) */
-} tRW_STATS;
-#endif /* RW_STATS_INCLUDED */
-
-/* Mifare Classic RW Control Block */
-
-typedef struct {
- uint16_t block;
- bool auth;
-} tRW_MFC_BLOCK;
-
-#define MFC_NDEF_NOT_DETECTED 0x00
-#define MFC_NDEF_DETECTED 0x01
-#define MFC_NDEF_READ 0x02
-
-#define MFC_MAX_SECTOR_NUMBER 40
-#define MFC_LAST_4BLOCK_SECTOR 32
-typedef uint8_t tRW_MFC_RW_STATE;
-typedef uint8_t tRW_MFC_RW_SUBSTATE;
-typedef struct {
- tRW_MFC_RW_STATE state; /* main state */
- tRW_MFC_RW_SUBSTATE substate; /* Reader/write substate in NDEF write state*/
- tRW_MFC_RW_SUBSTATE
- prev_substate; /* Reader/write substate in NDEF write state*/
- TIMER_LIST_ENT timer; /* timeout for each API call */
- uint8_t uid[4];
- uint8_t selres;
- uint8_t tlv_detect; /* TLV type under detection */
- uint16_t ndef_length; /* length of NDEF data */
- uint16_t ndef_start_pos; /* NDEF start position */
- uint16_t ndef_first_block; /* Frst block containing the NDEF */
- uint8_t* p_update_data; /* pointer of data to update */
- uint16_t rw_length; /* remaining bytes to read/write */
- uint16_t rw_offset; /* remaining offset to read/write */
- NFC_HDR* p_data_to_free; /* GKI buffer to delete after done */
- tRW_MFC_BLOCK last_block_accessed;
- tRW_MFC_BLOCK next_block;
- uint8_t sector_authentified;
- TIMER_LIST_ENT mfc_timer; /* timeout for each API call */
- uint16_t work_offset; /* Working byte offset */
- uint8_t* p_ndef_buffer; /* Buffer to store ndef message */
- uint16_t current_block;
- NFC_HDR* p_cur_cmd_buf; /* Copy of current command, for retx/send after sector
- change */
-
- bool mifare_ndefsector[MFC_MAX_SECTOR_NUMBER]; /* buffer to check ndef
- compatible sector */
- uint8_t ndef_status; /* bitmap for NDEF status */
-} tRW_MFC_CB;
-
-/* ISO 15693 RW Control Block */
-typedef uint8_t tRW_I93_RW_STATE;
-typedef uint8_t tRW_I93_RW_SUBSTATE;
-
-/* tag is read-only */
-#define RW_I93_FLAG_READ_ONLY 0x01
-/* tag supports read multi block */
-#define RW_I93_FLAG_READ_MULTI_BLOCK 0x02
-/* need to reset DSFID for formatting */
-#define RW_I93_FLAG_RESET_DSFID 0x04
-/* need to reset AFI for formatting */
-#define RW_I93_FLAG_RESET_AFI 0x08
-/* use 2 bytes for number of blocks */
-#define RW_I93_FLAG_16BIT_NUM_BLOCK 0x10
-/* use extended commands */
-#define RW_I93_FLAG_EXT_COMMANDS 0x20
-/* use Special Frame in Write-Alike commands */
-#define RW_I93_FLAG_SPECIAL_FRAME 0x40
-/* use SMS bit in Selected state */
-#define RW_I93_FLAG_SELECTED_STATE 0x80
-
-/* searching for type */
-#define RW_I93_TLV_DETECT_STATE_TYPE 0x01
-/* searching for the first byte of length */
-#define RW_I93_TLV_DETECT_STATE_LENGTH_1 0x02
-/* searching for the second byte of length */
-#define RW_I93_TLV_DETECT_STATE_LENGTH_2 0x03
-/* searching for the third byte of length */
-#define RW_I93_TLV_DETECT_STATE_LENGTH_3 0x04
-/* reading value field */
-#define RW_I93_TLV_DETECT_STATE_VALUE 0x05
-#define RW_I93_GET_SYS_INFO_MEM_INFO 1
-#define RW_T5T_CC_READ_MEM_INFO 0
-
-/* capability Container CC Size */
-#define RW_I93_CC_SIZE 4
-
-/* main state */
-enum {
- RW_I93_STATE_NOT_ACTIVATED, /* ISO15693 is not activated */
- RW_I93_STATE_IDLE, /* waiting for upper layer API */
- RW_I93_STATE_BUSY, /* waiting for response from tag */
-
- RW_I93_STATE_DETECT_NDEF, /* performing NDEF detection precedure */
- RW_I93_STATE_READ_NDEF, /* performing read NDEF procedure */
- RW_I93_STATE_UPDATE_NDEF, /* performing update NDEF procedure */
- RW_I93_STATE_FORMAT, /* performing format procedure */
- RW_I93_STATE_SET_READ_ONLY, /* performing set read-only procedure */
-
- RW_I93_STATE_PRESENCE_CHECK /* checking presence of tag */
-};
-
-/* sub state */
-enum {
- RW_I93_SUBSTATE_WAIT_UID, /* waiting for response of inventory */
- RW_I93_SUBSTATE_WAIT_SYS_INFO, /* waiting for response of get sys info */
- RW_I93_SUBSTATE_WAIT_CC, /* waiting for reading CC */
- RW_I93_SUBSTATE_WAIT_CC_EXT, /* waiting for reading CC second byte */
- RW_I93_SUBSTATE_SEARCH_NDEF_TLV, /* searching NDEF TLV */
- RW_I93_SUBSTATE_CHECK_LOCK_STATUS, /* check if any NDEF TLV is locked */
-
- RW_I93_SUBSTATE_RESET_LEN, /* set length to 0 to update NDEF TLV */
- RW_I93_SUBSTATE_WRITE_NDEF, /* writing NDEF and Terminator TLV */
- RW_I93_SUBSTATE_UPDATE_LEN, /* set length into NDEF TLV */
-
- RW_I93_SUBSTATE_WAIT_RESET_DSFID_AFI, /* reset DSFID and AFI */
- RW_I93_SUBSTATE_CHECK_READ_ONLY, /* check if any block is locked */
- RW_I93_SUBSTATE_WRITE_CC_NDEF_TLV, /* write CC and empty NDEF/Terminator TLV
- */
-
- RW_I93_SUBSTATE_WAIT_UPDATE_CC, /* updating CC as read-only */
- RW_I93_SUBSTATE_LOCK_NDEF_TLV, /* lock blocks of NDEF TLV */
- RW_I93_SUBSTATE_WAIT_LOCK_CC, /* lock block of CC */
- RW_I93_SUBSTATE_LOCK_T5T_AREA /* lock blocks of T5T_Area */
-};
-
-enum {
- RW_I93_ICODE_SLI, /* ICODE SLI, SLIX */
- RW_I93_ICODE_SLI_S, /* ICODE SLI-S, SLIX-S */
- RW_I93_ICODE_SLI_L, /* ICODE SLI-L, SLIX-L */
- RW_I93_TAG_IT_HF_I_PLUS_INLAY, /* Tag-it HF-I Plus Inlay */
- RW_I93_TAG_IT_HF_I_PLUS_CHIP, /* Tag-it HF-I Plus Chip */
- RW_I93_TAG_IT_HF_I_STD_CHIP_INLAY, /* Tag-it HF-I Standard Chip/Inlyas */
- RW_I93_TAG_IT_HF_I_PRO_CHIP_INLAY, /* Tag-it HF-I Pro Chip/Inlyas */
- RW_I93_STM_LRI1K, /* STM LRI1K */
- RW_I93_STM_LRI2K, /* STM LRI2K */
- RW_I93_STM_LRIS2K, /* STM LRIS2K */
- RW_I93_STM_LRIS64K, /* STM LRIS64K */
- RW_I93_STM_M24LR64_R, /* STM M24LR64-R */
- RW_I93_STM_M24LR04E_R, /* STM M24LR04E-R */
- RW_I93_STM_M24LR16E_R, /* STM M24LR16E-R */
- RW_I93_STM_M24LR16D_W, /* STM M24LR16D-W */
- RW_I93_STM_M24LR64E_R, /* STM M24LR64E-R */
- RW_I93_STM_ST25DV04K, /* STM ST25DV04K */
- RW_I93_STM_ST25DVHIK, /* STM ST25DV 16K OR 64K */
- RW_I93_ONS_N36RW02, /* ONS N36RW02 */
- RW_I93_ONS_N24RF04, /* ONS N24RF04 */
- RW_I93_ONS_N24RF04E, /* ONS N24RF04E */
- RW_I93_ONS_N24RF16, /* ONS N24RF16 */
- RW_I93_ONS_N24RF16E, /* ONS N24RF16E */
- RW_I93_ONS_N24RF64, /* ONS N24RF64 */
- RW_I93_ONS_N24RF64E, /* ONS N24RF64E */
- RW_I93_UNKNOWN_PRODUCT /* Unknown product version */
-};
-
-typedef struct {
- tRW_I93_RW_STATE state; /* main state */
- tRW_I93_RW_SUBSTATE sub_state; /* sub state */
- TIMER_LIST_ENT timer; /* timeout for each sent command */
- uint8_t sent_cmd; /* last sent command */
- uint8_t retry_count; /* number of retry */
- NFC_HDR* p_retry_cmd; /* buffer to store cmd sent last */
-
- uint8_t info_flags; /* information flags */
- uint8_t uid[I93_UID_BYTE_LEN]; /* UID of currently activated */
- uint8_t dsfid; /* DSFID if I93_INFO_FLAG_DSFID */
- uint8_t afi; /* AFI if I93_INFO_FLAG_AFI */
- uint8_t block_size; /* block size of tag, in bytes */
- uint32_t num_block; /* number of blocks in tag */
- uint8_t ic_reference; /* IC Reference of tag */
- uint8_t product_version; /* tag product version */
-
- uint8_t intl_flags; /* flags for internal information */
-
- uint8_t tlv_detect_state; /* TLV detecting state */
- uint8_t tlv_type; /* currently detected type */
- uint8_t addr_mode;
- uint8_t i93_t5t_mode;
- uint8_t t5t_area_start_block; /* offset of first block of T5T_Area */
- uint32_t t5t_area_last_offset; /* offset of last byte of T5T_Area */
-
- /* Greedy collection with NDEF Detection data */
- uint8_t gre_validity;
- uint8_t gre_cc_content[8];
- uint32_t gre_ndef_tlv_pos;
- uint32_t gre_ndef_tlv_length;
- uint32_t tlv_length; /* currently detected length */
-
- uint32_t ndef_tlv_start_offset; /* offset of first byte of NDEF TLV */
- uint32_t ndef_tlv_last_offset; /* offset of last byte of NDEF TLV */
- uint32_t max_ndef_length; /* max NDEF length the tag contains */
- uint32_t ndef_length; /* length of NDEF data */
-
- uint8_t* p_update_data; /* pointer of data to update */
- uint32_t rw_length; /* bytes to read/write */
- uint32_t rw_offset; /* offset to read/write */
- bool in_pres_check;
-} tRW_I93_CB;
-
-typedef uint8_t tRW_CI_RW_STATE;
-typedef struct {
- tRW_CI_RW_STATE state; /* main state */
- TIMER_LIST_ENT timer; /* timeout for each sent command */
- uint8_t sent_cmd; /* last sent command */
- uint8_t attrib_res[2];
- uint8_t uid[8];
-} tRW_CI_CB;
-/* RW memory control blocks */
-#ifndef ST21NFC
-typedef union {
-#else
-typedef struct {
-#endif
- tRW_T1T_CB t1t;
- tRW_T2T_CB t2t;
- tRW_T3T_CB t3t;
- tRW_T4T_CB t4t;
- tRW_I93_CB i93;
- tRW_MFC_CB mfc;
- tRW_CI_CB ci;
-} tRW_TCB;
-
-/* RW callback type */
-#define RW_CB_TYPE_UNKNOWN 0
-#define RW_CB_TYPE_T1T 1
-#define RW_CB_TYPE_T2T 2
-#define RW_CB_TYPE_T3T 3
-#define RW_CB_TYPE_T4T 4
-#define RW_CB_TYPE_T5T 5
-#define RW_CB_TYPE_MIFARE 6
-typedef uint8_t tRW_CB_TYPE;
-
-/* RW control blocks */
-typedef struct {
- tRW_CB_TYPE tcb_type;
- tRW_TCB tcb;
- tRW_CBACK* p_cback;
- uint32_t cur_retry; /* Retry count for the current operation */
-#if (RW_STATS_INCLUDED == TRUE)
- tRW_STATS stats;
-#endif /* RW_STATS_INCLUDED */
-} tRW_CB;
-
-/*****************************************************************************
-** EXTERNAL FUNCTION DECLARATIONS
-*****************************************************************************/
-
-/* Global NFC data */
-extern tRW_CB rw_cb;
-
-/* from .c */
-
-#if (RW_NDEF_INCLUDED == TRUE)
-extern tRW_EVENT rw_t1t_handle_rsp(const tT1T_CMD_RSP_INFO* p_info,
- bool* p_notify, uint8_t* p_data,
- tNFC_STATUS* p_status);
-extern tRW_EVENT rw_t1t_info_to_event(const tT1T_CMD_RSP_INFO* p_info);
-#else
-#define rw_t1t_handle_rsp(p, a, b, c) t1t_info_to_evt(p)
-#define rw_t1t_info_to_event(p) t1t_info_to_evt(p)
-#endif
-
-extern void rw_init(void);
-extern tNFC_STATUS rw_t1t_select(uint8_t hr[T1T_HR_LEN],
- uint8_t uid[T1T_CMD_UID_LEN]);
-extern tNFC_STATUS rw_t1t_send_dyn_cmd(uint8_t opcode, uint8_t add,
- uint8_t* p_dat);
-extern tNFC_STATUS rw_t1t_send_static_cmd(uint8_t opcode, uint8_t add,
- uint8_t dat);
-extern void rw_t1t_process_timeout(TIMER_LIST_ENT* p_tle);
-extern void rw_t1t_handle_op_complete(void);
-extern tNFC_STATUS RW_T4tNfceeInitCb(void);
-
-#if (RW_NDEF_INCLUDED == TRUE)
-extern tRW_EVENT rw_t2t_info_to_event(const tT2T_CMD_RSP_INFO* p_info);
-extern void rw_t2t_handle_rsp(uint8_t* p_data);
-#else
-#define rw_t2t_info_to_event(p) t2t_info_to_evt(p)
-#define rw_t2t_handle_rsp(p)
-#endif
-
-extern tNFC_STATUS rw_t2t_sector_change(uint8_t sector);
-extern tNFC_STATUS rw_t2t_read(uint16_t block);
-extern tNFC_STATUS rw_t2t_write(uint16_t block, uint8_t* p_write_data);
-extern void rw_t2t_process_timeout();
-extern tNFC_STATUS rw_t2t_select(void);
-void rw_t2t_handle_op_complete(void);
-
-extern void rw_t3t_process_timeout(TIMER_LIST_ENT* p_tle);
-extern tNFC_STATUS rw_t3t_select(uint8_t peer_nfcid2[NCI_RF_F_UID_LEN],
- uint8_t mrti_check, uint8_t mrti_update);
-void rw_t3t_handle_nci_poll_rsp(uint8_t nci_status);
-void rw_t3t_handle_nci_poll_ntf(uint8_t nci_status, uint8_t num_responses,
- uint8_t sensf_res_buf_size,
- uint8_t* p_sensf_res_buf);
-
-extern tNFC_STATUS rw_t4t_select(void);
-extern void rw_t4t_process_timeout(TIMER_LIST_ENT* p_tle);
-
-extern tNFC_STATUS rw_i93_select(uint8_t* p_uid);
-extern void rw_i93_process_timeout(TIMER_LIST_ENT* p_tle);
-extern std::string rw_i93_get_state_name(uint8_t state);
-extern std::string rw_i93_get_sub_state_name(uint8_t sub_state);
-extern void rw_t5t_sm_detect_ndef(NFC_HDR*);
-extern void rw_t5t_sm_update_ndef(NFC_HDR*);
-extern void rw_t5t_sm_set_read_only(NFC_HDR*);
-
-extern void rw_t4t_handle_isodep_nak_rsp(uint8_t status, bool is_ntf);
-extern void rw_ci_process_timeout(TIMER_LIST_ENT* p_tle);
-
-extern tNFC_STATUS rw_mfc_select(uint8_t selres, uint8_t uid[T1T_CMD_UID_LEN]);
-extern void rw_mfc_process_timeout(TIMER_LIST_ENT* p_tle);
-#if (RW_STATS_INCLUDED == TRUE)
-/* Internal fcns for statistics (from rw_main.c) */
-void rw_main_reset_stats(void);
-void rw_main_update_tx_stats(uint32_t bytes_tx, bool is_retry);
-void rw_main_update_rx_stats(uint32_t bytes_rx);
-void rw_main_update_crc_error_stats(void);
-void rw_main_update_trans_error_stats(void);
-void rw_main_update_fail_stats(void);
-void rw_main_log_stats(void);
-#endif /* RW_STATS_INCLUDED */
-
-#endif /* RW_INT_H_ */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc/include/tags_defs.h b/libstpropnci/libstnfc-nci-headers/src/nfc/include/tags_defs.h
deleted file mode 100755
index 876c678..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc/include/tags_defs.h
+++ /dev/null
@@ -1,748 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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 the Near Field Communication (NFC) Tags related
- * definitions from the specification.
- *
- ******************************************************************************/
-
-#ifndef TAGS_DEFS_H
-#define TAGS_DEFS_H
-
-/* Manufacturer ID */
-/* BROADCOM CORPORATION */
-#define TAG_BRCM_MID 0x2E
-/* MIFARE */
-#define TAG_MIFARE_MID 0x04
-/* KOVIO */
-#define TAG_KOVIO_MID 0x37
-/* Infineon Technologies */
-#define TAG_INFINEON_MID 0x05
-
-/* TLV types present in Type1 and Type 2 Tags */
-/* May be used for padding. SHALL ignore this */
-#define TAG_NULL_TLV 0
-/* Defines details of the lock bytes */
-#define TAG_LOCK_CTRL_TLV 1
-/* Identifies reserved memory areas */
-#define TAG_MEM_CTRL_TLV 2
-/* Contains the NDEF message */
-#define TAG_NDEF_TLV 3
-/* Tag proprietary information */
-#define TAG_PROPRIETARY_TLV 0xFD
-/* Last TLV block in the data area */
-#define TAG_TERMINATOR_TLV 0xFE
-/* Number of bits in every tag byte */
-#define TAG_BITS_PER_BYTE 0x08
-/* Max UID Len of type 1 and type 2 tag */
-#define TAG_MAX_UID_LEN 0x0A
-
-/* Byte 0 Length field to indicate LNDEF */
-#define TAG_LONG_NDEF_LEN_FIELD_BYTE0 0xFF
-/* Tlv len for LOCK_CTRL/MEM TLV per spec */
-#define TAG_DEFAULT_TLV_LEN 3
-
-/* Type 1 Tag related definitions */
-
-/* block 0 to Block E */
-#define T1T_STATIC_BLOCKS 0x0F
-/* T1T Block size in bytes */
-#define T1T_BLOCK_SIZE 0x08
-
-#define T1T_STATIC_SIZE \
- T1T_STATIC_BLOCKS* T1T_BLOCK_SIZE /* Static Tag size */
-
-/* Size of Type 1 Tag segment in bytes */
-#define T1T_SEGMENT_SIZE 0x80
-/* Maximum segment supported by Type 1 Tag */
-#define T1T_MAX_SEGMENTS 0x10
-/* Number of blocks present in a segment */
-#define T1T_BLOCKS_PER_SEGMENT 0x10
-/* No.of default OTP,staticlocks,res bytes in tag */
-#define T1T_OTP_LOCK_RES_BYTES 0x10
-
-/* HRO value to indicate static Tag */
-#define T1T_STATIC_HR0 0x11
-/* 0x1y, as long as (y!=1) */
-/* HR0 value is 0x1y, indicates NDEF supported */
-#define T1T_NDEF_SUPPORTED 0x10
-/* UID block */
-#define T1T_UID_BLOCK 0x00
-/* Reserved block */
-#define T1T_RES_BLOCK 0x0D
-/* Static lock block */
-#define T1T_LOCK_BLOCK 0x0E
-/* Static lock offset */
-#define T1T_LOCK_0_OFFSET 0x70
-/* Block F - typically used for dynamic locks */
-#define T1T_DYNAMIC_LOCK_BYTES 0x08
-
-/* the len of reserved byte in T1T block 0 */
-#define T1T_RES_BYTE_LEN 1
-
-/* Capability Container definitions */
-/* Capability container block */
-#define T1T_CC_BLOCK 1
-/* the len of CC used in T1T tag */
-#define T1T_CC_LEN 4
-/* CC offset */
-/* Offset for NDEF magic number in CC */
-#define T1T_CC_NMN_OFFSET 0x00
-/* Offset for Read/Write access in CC */
-#define T1T_CC_RWA_OFFSET 0x03
-/* NDEF Magic Number byte number */
-#define T1T_CC_NMN_BYTE 0x08
-/* Version Number byte number */
-#define T1T_CC_VNO_BYTE 0x09
-/* Tag Memory Size byte number */
-#define T1T_CC_TMS_BYTE 0x0A
-/* Read Write Access byte number */
-#define T1T_CC_RWA_BYTE 0x0B
-/* NDEF Magic Number */
-#define T1T_CC_NMN 0xE1
-/* Supported Legacy Version */
-#define T1T_CC_LEGACY_VNO 0x10
-/* Version Number */
-#define T1T_CC_VNO 0x11
-/* RWA - Read/write allowed */
-#define T1T_CC_RWA_RW 0x00
-/* RWA - Read only */
-#define T1T_CC_RWA_RO 0x0F
-
-/* Tlv len for LOCK_CTRL/MEM TLV per spec */
-#define T1T_DEFAULT_TLV_LEN 3
-/* Tlv type identifier len */
-#define T1T_TLV_TYPE_LEN 1
-/* Length field size of lock/mem tlv */
-#define T1T_DEFAULT_TLV_LEN_FIELD_LEN 1
-
-/* the len of HR used in Type 1 Tag */
-#define T1T_HR_LEN 2
-/* the len of UID used in Type 1 Tag Commands */
-#define T1T_CMD_UID_LEN 4
-/* the len of UID used in Type 1 Tag */
-#define T1T_UID_LEN 7
-#define T1T_ADD_LEN 1
-
-/* Length Field size of short NDEF Message */
-#define T1T_SHORT_NDEF_LEN_FIELD_LEN 1
-/* Length Field size of Long NDEF Message */
-#define T1T_LONG_NDEF_LEN_FIELD_LEN 3
-/* Byte 0 in Length field to indicate LNDEF*/
-#define T1T_LONG_NDEF_LEN_FIELD_BYTE0 0xFF
-/* Min. len of NDEF to qualify as LNDEF */
-
-/* Type 1 Tag Commands (7 bits) */
-/* read id */
-#define T1T_CMD_RID 0x78
-/* read all bytes */
-#define T1T_CMD_RALL 0x00
-/* read (1 byte) */
-#define T1T_CMD_READ 0x01
-/* write with erase (1 byte) */
-#define T1T_CMD_WRITE_E 0x53
-/* write no erase (1 byte) */
-#define T1T_CMD_WRITE_NE 0x1A
-/* dynamic memory only */
-/* read segment */
-#define T1T_CMD_RSEG 0x10
-/* read (8 byte) */
-#define T1T_CMD_READ8 0x02
-/* write with erase (8 byte) */
-#define T1T_CMD_WRITE_E8 0x54
-/* write no erase (8 byte) */
-#define T1T_CMD_WRITE_NE8 0x1B
-
-/* Lock */
-/* Number of static lock bytes in tag */
-#define T1T_NUM_STATIC_LOCK_BYTES 2
-/* Bytes locked by one static lock bit */
-
-/* Type 2 Tag related definitions */
-#define T2T_STATIC_SIZE 64
-#define T2T_BLOCK_SIZE 4
-#define T2T_HEADER_SIZE 16
-#define T2T_SECTOR_SIZE 1024
-#define T2T_BLOCKS_PER_SECTOR 0x100
-
-#define T2T_UID_LEN 4 /* the len of UID used in T2T tag */
-/* the len of Serial number used in T2T tag */
-#define T2T_INTERNAL_BYTES_LEN 2 /* the len of internal used in T2T tag */
-/* Static Lock Bytes */
-#define T2T_STATIC_LOCK0 0x0A /* Static Lock 0 offset */
-#define T2T_STATIC_LOCK1 0x0B /* Static Lock 1 offset */
-
-/* Capability Container definitions */
-#define T2T_CC_BLOCK 0x03 /* Capability container block */
-#define T2T_CC0_NMN_BYTE 0x0C /* NDEF Magic Number byte number */
-#define T2T_CC1_VNO_BYTE 0x0D /* Version Number byte number*/
-#define T2T_CC2_TMS_BYTE 0x0E /* Tag Memory Size byte number */
-#define T2T_CC3_RWA_BYTE 0x0F /* Read Write Access byte number */
-
-#define T2T_CC0_NMN 0xE1 /* NDEF Magic Number */
-#define T2T_CC1_VNO 0x11 /* Version Number */
-#define T2T_CC1_LEGACY_VNO 0x10 /* Legacy Version Number */
-#define T2T_CC1_NEW_VNO 0x12 /* Another supported Version Number */
-#define T2T_CC2_TMS_STATIC 0x06 /* TMS static memory - (4 * (n+1)). */
-#define T2T_CC3_RWA_RW 0x00 /* RWA - Read/write allowed */
-#define T2T_CC3_RWA_RO 0x0F /* RWA - Read only */
-
-/* Factor to multiply to get tag data size from TMS */
-#define T2T_TMS_TAG_FACTOR 0x08
-/* Bytes locked per lock bit of default locks */
-#define T2T_DEFAULT_LOCK_BLPB 0x08
-
-/* Type 2 Tag Commands */
-#define T2T_CMD_READ 0x30 /* read 4 blocks (16 bytes) */
-#define T2T_CMD_WRITE 0xA2 /* write 1 block (4 bytes) */
-#define T2T_CMD_SEC_SEL 0xC2 /* Sector select */
-#define T2T_RSP_ACK 0xA
-
-#define T2T_STATUS_OK_1_BIT 0x11
-#define T2T_STATUS_OK_7_BIT 0x17
-
-#define T2T_FIRST_DATA_BLOCK 4
-#define T2T_READ_BLOCKS 4
-#define T2T_BLOCK_LEN 4
-#define T2T_READ_DATA_LEN (T2T_BLOCK_LEN * T2T_READ_BLOCKS)
-#define T2T_WRITE_DATA_LEN 4
-
-/* Type 2 TLV definitions */
-/* May be used for padding. SHALL ignore this */
-#define T2T_TLV_TYPE_LOCK_CTRL 1 /* Defines details of the lock bytes */
-
-/* Tag len for LOCK_CTRL TLV per spec */
-#define T2T_TLEN_LOCK_CTRL_TLV 3
-
-/* Maximum number of sectors supported */
-#if (APPL_DTA_MODE == TRUE)
-#define T2T_MAX_SECTOR 3
-#else
-#define T2T_MAX_SECTOR 2
-#endif
-/* Tlv type identifier len */
-#define T2T_TLV_TYPE_LEN 1
-
-/* Length Field size of short NDEF Message */
-#define T2T_SHORT_NDEF_LEN_FIELD_LEN 1
-/* Length Field size of Long NDEF Message */
-#define T2T_LONG_NDEF_LEN_FIELD_LEN 3
-/* Byte 0 in Length field to indicate LNDEF*/
-#define T2T_LONG_NDEF_LEN_FIELD_BYTE0 0xFF
-/* Min. len of NDEF to qualify as LNDEF */
-#define T2T_LONG_NDEF_MIN_LEN 0x00FF
-
-/* Lock */
-/* Number of static lock bytes in tag */
-#define T2T_NUM_STATIC_LOCK_BYTES 2
-
-/*
-**
-** Type 3 Tag Definitions
-**
-*/
-
-#define T3T_SYSTEM_CODE_NDEF 0x12FC /* System Code for NDEF tags */
-/* System Code for felica-lite tags */
-#define T3T_SYSTEM_CODE_FELICA_LITE 0x88B4
-#define T3T_MAX_SYSTEM_CODES 16
-/* Maximum number of blocks for NDEF message for Felica Lite tags */
-#define T3T_FELICALITE_NMAXB 13
-
-/* Block descriptor, used to describe a block to check/update */
-typedef struct {
- uint16_t service_code; /* Block service code. Set to T3T_SERVICE_CODE_NDEF
- (0x000B) for NDEF data */
- uint16_t block_number; /* Block number */
-} tT3T_BLOCK_DESC;
-
-/* Poll RC (request code) definitions */
-#define T3T_POLL_RC_SC 1 /* System code requested in SENSF_RES */
-typedef uint8_t tT3T_POLL_RC;
-
-/* Definitions for constructing t3t command messages */
-
-/* NFC Forum / Felica commands */
-#define T3T_MSG_OPC_CHECK_CMD 0x06
-#define T3T_MSG_OPC_CHECK_RSP 0x07
-#define T3T_MSG_OPC_UPDATE_CMD 0x08
-#define T3T_MSG_OPC_UPDATE_RSP 0x09
-
-/* Felica commands (not specified in NFC-Forum Type 3 tag specifications) */
-#define T3T_MSG_OPC_POLL_CMD 0x00
-#define T3T_MSG_OPC_POLL_RSP 0x01
-#define T3T_MSG_OPC_REQ_SERVICE_CMD 0x02
-#define T3T_MSG_OPC_REQ_RESPONSE_CMD 0x04
-#define T3T_MSG_OPC_REQ_RESPONSE_RSP 0x05
-#define T3T_MSG_OPC_REQ_SYSTEMCODE_CMD 0x0C
-#define T3T_MSG_OPC_REQ_SYSTEMCODE_RSP 0x0D
-
-/* Service code: read-only NDEF */
-#define T3T_MSG_NDEF_SC_RO 0x000B
-/* Service code: read/write NDEF */
-#define T3T_MSG_NDEF_SC_RW 0x0009
-#define T3T_MSG_NDEF_VERSION 0x10 /* NDEF Mapping Version 1.0 */
-#define T3T_MSG_NDEF_WRITEF_OFF 0x00
-#define T3T_MSG_NDEF_WRITEF_ON 0x0F
-#define T3T_MSG_NDEF_RWFLAG_RO 0x00
-#define T3T_MSG_NDEF_RWFLAG_RW 0x01
-/* Size of NDEF attribute info block (minus checksum) */
-#define T3T_MSG_NDEF_ATTR_INFO_SIZE 14
-
-/* len flag for Block List Element */
-#define T3T_MSG_MASK_TWO_BYTE_BLOCK_DESC_FORMAT 0x80
-/* service code list mask */
-#define T3T_MSG_SERVICE_LIST_MASK 0x0F
-#define T3T_MSG_SERVICE_LIST_MAX 16
-
-/* Max Number of Blocks per UPDATE command */
-#define T3T_MSG_NUM_BLOCKS_UPDATE_MAX 13
-/* Max Number of Blocks per CHECK command */
-#define T3T_MSG_NUM_BLOCKS_CHECK_MAX 15
-
-/* Data block size for UPDATE and CHECK commands */
-#define T3T_MSG_BLOCKSIZE 16
-
-/* Common header definitions for T3t commands */
-/* Common header: SoD + cmdcode + NFCID2 + num_services */
-#define T3T_MSG_CMD_COMMON_HDR_LEN 11
-
-/* Common header definition for T3t responses */
-/* Common header: rspcode + NFCID2 + StatusFlag1 + StatusFlag2 */
-#define T3T_MSG_RSP_COMMON_HDR_LEN 11
-/* Offset for Response code */
-#define T3T_MSG_RSP_OFFSET_RSPCODE 0
-/* Offset for Manufacturer ID */
-#define T3T_MSG_RSP_OFFSET_IDM 1
-/* Offset for Status Flag1 */
-#define T3T_MSG_RSP_OFFSET_STATUS1 9
-/* Offset for NumberOfBlocks (in CHECK response) */
-#define T3T_MSG_RSP_OFFSET_NUMBLOCKS 11
-/* Offset for Block Data (in CHECK response) */
-#define T3T_MSG_RSP_OFFSET_CHECK_DATA 12
-
-#define T3T_MSG_RSP_STATUS_OK 0x00
-#define T3T_MSG_RSP_STATUS_ERROR 0x01
-
-#define T3T_MSG_RSP_STATUS2_ERROR_MEMORY 0x70
-#define T3T_MSG_RSP_STATUS2_ERROR_PROCESSING 0xFF
-
-/* Felica Lite definitions */
-/* Block ID for MC (memory configuration) */
-#define T3T_MSG_FELICALITE_BLOCK_ID_MC 0x88
-
-/* Memory Configuration Block offset: MC_SP (Memory Configuration for scratch
- * pad) */
-#define T3T_MSG_FELICALITE_MC_OFFSET_MC_SP 0x00
-/* Memory Configuration Block offset: SYS_OP (System Option) */
-#define T3T_MSG_FELICALITE_MC_OFFSET_SYS_OP 0x03
-/* Memory Configuration Block offset: RF_PRM (Memory Configuration for RF
- * Parameter) */
-#define T3T_MSG_FELICALITE_MC_OFFSET_RF_PRM 0x04
-
-/*
-**
-** Type 4 Tag Definitions
-**
-*/
-#define T4T_CMD_MIN_HDR_SIZE 4 /* CLA, INS, P1, P2 */
-#define T4T_CMD_MAX_HDR_SIZE 5 /* CLA, INS, P1, P2, Lc */
-
-/* CLA, INS, P1, P2, Data ODO */
-#define T4T_CMD_MIN_EXT_HDR_SIZE 9
-/* CLA, INS, P1, P2, Lc, Data ODO, Le
- * with Lc and Le coded using Extended Field Coding */
-#define T4T_CMD_MAX_EXT_HDR_SIZE 15
-
-/* CLA, INS, P1, P2, Le on 3 bytes (Lc absent) using Extended Field Coding */
-#define T4T_CMD_MAX_EFC_NO_LC_HDR_SIZE 7
-#define T4T_VERSION_3_0 0x30 /* version 3.0 */
-#define T4T_VERSION_2_0 0x20 /* version 2.0 */
-#define T4T_VERSION_1_0 0x10 /* version 1.0 */
-#define T4T_MY_VERSION T4T_VERSION_3_0
-#define T4T_GET_MAJOR_VERSION(x) ((x) >> 4)
-
-#define T4T_CMD_CLASS 0x00
-#define T4T_CMD_INS_SELECT 0xA4
-#define T4T_CMD_INS_READ_BINARY 0xB0
-#define T4T_CMD_INS_UPDATE_BINARY 0xD6
-#define T4T_CMD_INS_READ_BINARY_ODO 0xB1
-#define T4T_CMD_INS_UPDATE_BINARY_ODO 0xD7
-#define T4T_CMD_DES_CLASS 0x90
-#define T4T_CMD_INS_GET_HW_VERSION 0x60
-#define T4T_CMD_CREATE_AID 0xCA
-#define T4T_CMD_SELECT_APP 0x5A
-#define T4T_CMD_CREATE_DATAFILE 0xCD
-#define T4T_CMD_DES_WRITE 0x3D
-#define T4T_CMD_P1_SELECT_BY_NAME 0x04
-#define T4T_CMD_P1_SELECT_BY_FILE_ID 0x00
-#define T4T_CMD_P2_FIRST_OR_ONLY_00H 0x00
-#define T4T_CMD_P2_FIRST_OR_ONLY_0CH 0x0C
-
-/* Max number of bytes to be read from file in ReadBinary Command */
-#define T4T_MAX_LENGTH_LE 0xFF
-/* Max number of bytes written to NDEF file in UpdateBinary Command */
-#define T4T_MAX_LENGTH_LC 0xFF
-
-#define T4T_RSP_STATUS_WORDS_SIZE 0x02
-
-#define T4T_RSP_CMD_CMPLTED 0x9000
-#define T4T_RSP_NOT_FOUND 0x6A82
-#define T4T_RSP_WRONG_PARAMS 0x6B00
-#define T4T_RSP_CLASS_NOT_SUPPORTED 0x6E00
-#define T4T_RSP_WRONG_LENGTH 0x6700
-#define T4T_RSP_INSTR_NOT_SUPPORTED 0x6D00
-#define T4T_RSP_CMD_NOT_ALLOWED 0x6986
-#define T4T_RSP_WARNING_PARAMS_CHECK(X) \
- ((X == 0x63 || X == 0x62 || X == 0x61) ? true : false)
-
-/* V1.0 Type 4 Tag Application ID length */
-#define T4T_V10_NDEF_TAG_AID_LEN 0x07
-/* V2.0 Type 4 Tag Application ID length */
-#define T4T_V20_NDEF_TAG_AID_LEN 0x07
-
-/* Min of Max R-APDU data size */
-#define T4T_MIN_MLE 0x000F
-
-#define T4T_FILE_ID_SIZE 0x02
-#define T4T_CC_FILE_ID 0xE103
-#define T4T_CC_FILE_MIN_LEN 0x000F
-
-#define T4T_VERSION_OFFSET_IN_CC 0x02
-#define T4T_FC_TLV_OFFSET_IN_CC 0x07
-/* size of T(1),L(1),V(8) for extended NDEF file control */
-#define T4T_ENDEF_FC_V_FIELD_OFFSET 0x09
-/* Offset of Write access byte from type field in CC */
-#define T4T_FC_WRITE_ACCESS_OFFSET_IN_TLV 0x07
-
-#define T4T_NDEF_FILE_CONTROL_TYPE 0x04 /* NDEF File Control Type */
-
-/* size of T(1),L(1),V(6) for file control */
-#define T4T_FILE_CONTROL_TLV_SIZE 0x08
-/* size of V(6) for file control */
-#define T4T_FILE_CONTROL_LENGTH 0x06
-
-#define T4T_ENDEF_FILE_CONTROL_TYPE 0x06 /* Extended NDEF File Control Type */
-/* size of T(1),L(1),V(8) for extended NDEF file control */
-#define T4T_ENDEF_FILE_CONTROL_TLV_SIZE 0x0A
-/* size of V(8) for extended NDEF file control */
-#define T4T_ENDEF_FILE_CONTROL_LENGTH 0x08
-
-/* read access granted without any security */
-#define T4T_FC_READ_ACCESS 0x00
-/* no read access granted at all */
-#define T4T_FC_NO_READ_ACCESS 0xFF
-/* proprietary read access range start */
-#define T4T_FC_READ_ACCESS_PROP_START 0x80
-/* write access granted without any security */
-#define T4T_FC_WRITE_ACCESS 0x00
-/* proprietary write access range start */
-#define T4T_FC_WRITE_ACCESS_PROP_START 0x80
-/* no write access granted at all (read-only) */
-#define T4T_FC_NO_WRITE_ACCESS 0xFF
-
-#define T4T_FILE_LENGTH_SIZE 0x02
-#define T4T_EFILE_LENGTH_SIZE 0x04
-#define T4T_ADDI_FRAME_RESP 0xAFU
-#define T4T_DES_GET_VERSION_LEN 0x09
-#define T4T_SIZE_IDENTIFIER_2K 0x16U
-#define T4T_SIZE_IDENTIFIER_4K 0x18U
-#define T4T_SIZE_IDENTIFIER_8K 0x1AU
-#define T4T_DESEV1_MAJOR_VERSION 0x01U
-#define T4T_TYPE_DESFIRE_EV1 0x01U
-#define T4T_DESEV0_MAJOR_VERSION 0x00U
-#define T4T_DESEV0_MINOR_VERSION 0x06U
-#define T4T_DES_EV1_NFC_APP_ID 0x010000
-#define T4T_DES_EV0_NFC_APP_ID 0x10EEEE
-
-/* Mifare Classic Tag Definitions */
-#define MFC_UID_LEN 4
-
-/*
-**
-** ISO 15693 Tag Definitions
-**
-*/
-
-#define I93_VERSION_1_x 0x40 /* major mapping version 1.x */
-
-/* A single sub-carrier frequency shall be used by VICC */
-#define I93_FLAG_SUB_CARRIER_SINGLE 0x00
-
-/* High data rate shall be used */
-#define I93_FLAG_DATA_RATE_HIGH 0x02
-
-/* Flags 5 to 8 meaning is according to table 5 */
-#define I93_FLAG_INVENTORY_SET 0x04
-
-/* No protocol format extension */
-#define I93_FLAG_PROT_EXT_NO 0x00
-/* Protocol format is extended. Reserved for future use */
-#define I93_FLAG_PROT_EXT_YES 0x08
-
-/* Request is addressed with AMS (Address Mode Selector). UID field is included.
- * It shall be executed only by VICC */
-#define I93_FLAG_ADDRESS_SET 0x20
-/* whose UID matches the UID specified in the request */
-/* Request is addressed with SMS (Select Mode Selector). UID field is included
- * or not. It shall be executed by the unique VICC to be in SELECTED state */
-#define I93_FLAG_SELECT_SET 0x10
-
-/* AFI field is present */
-#define I93_FLAG_AFI_PRESENT 0x10
-
-#define I93_FLAG_SLOT_ONE 0x20 /* 1 slot */
-
-/* It shall be set to 0 if not otherwise defined by command */
-/* Meaning is defined by the command description. */
-#define I93_FLAG_OPTION_SET 0x40
-
-/* Error detected, Error code is in the "Error" field */
-#define I93_FLAG_ERROR_DETECTED 0x01
-
-/* Response error code */
-/* The command option is not supported */
-#define I93_ERROR_CODE_OPTION_NOT_SUPPORTED 0x03
-/* The specific block is was not successfully programmed */
-#define I93_ERROR_CODE_BLOCK_FAIL_TO_WRITE 0x13
-/* The specific block is was not successfully locked */
-
-/* UID length in bytes */
-#define I93_UID_BYTE_LEN 8
-/* Data Storage Format is not supported */
-#define I93_DFS_UNSUPPORTED 0x00
-/* Block is locked */
-#define I93_BLOCK_LOCKED 0x01
-
-/* ISO 15693 Mandatory commands */
-#define I93_CMD_INVENTORY 0x01 /* Inventory */
-#define I93_CMD_STAY_QUIET 0x02 /* Stay Quiet */
-
-/* ISO 15693 Optional commands */
-#define I93_CMD_READ_SINGLE_BLOCK 0x20 /* Read single block */
-#define I93_CMD_EXT_READ_SINGLE_BLOCK 0x30 /* Extended Read single block */
-#define I93_CMD_WRITE_SINGLE_BLOCK 0x21 /* Write single block */
-#define I93_CMD_EXT_WRITE_SINGLE_BLOCK 0x31 /* Extended Write single block */
-#define I93_CMD_LOCK_BLOCK 0x22 /* Lock block */
-#define I93_CMD_EXT_LOCK_BLOCK 0x32 /* Extended Lock block */
-#define I93_CMD_READ_MULTI_BLOCK 0x23 /* Read multiple blocks */
-#define I93_CMD_EXT_READ_MULTI_BLOCK 0x33 /* Extended Read multiple blocks */
-#define I93_CMD_WRITE_MULTI_BLOCK 0x24 /* Write multiple blocks */
-#define I93_CMD_EXT_WRITE_MULTI_BLOCK 0x34 /* Write multiple blocks */
-#define I93_CMD_SELECT 0x25 /* Select */
-#define I93_CMD_RESET_TO_READY 0x26 /* Reset to ready */
-#define I93_CMD_WRITE_AFI 0x27 /* Wreite AFI */
-#define I93_CMD_LOCK_AFI 0x28 /* Lock AFI */
-#define I93_CMD_WRITE_DSFID 0x29 /* Write DSFID */
-#define I93_CMD_LOCK_DSFID 0x2A /* Lock DSFID */
-/* Get system information */
-#define I93_CMD_GET_SYS_INFO 0x2B
-/* Get extended system information */
-#define I93_CMD_EXT_GET_SYS_INFO 0x3B
-/* Get multiple block security status */
-#define I93_CMD_GET_MULTI_BLK_SEC 0x2C
-/* Get extended multiple block security status */
-#define I93_CMD_EXT_GET_MULTI_BLK_SEC 0x3C
-#define I93_CMD_SET_ADDR_MODE 0x3D /* Set address mode */
-
-/* Information flags definition */
-/* DSFID is supported and DSFID field is present */
-#define I93_INFO_FLAG_DSFID 0x01
-/* DSFID info length */
-#define I93_INFO_DSFID_LEN 0x01
-/* AFI is supported and AFI field is present */
-#define I93_INFO_FLAG_AFI 0x02
-/* AFI info length */
-#define I93_INFO_AFI_LEN 0x01
-/* VICC memory size field is present */
-#define I93_INFO_FLAG_MEM_SIZE 0x04
-/* block size info length */
-#define I93_INFO_BLOCK_SIZE_LEN 0x01
-/* 8bit num of blocks info length */
-#define I93_INFO_8BIT_NUM_BLOCK_LEN 0x01
-/* 16bit num of blocks info length */
-#define I93_INFO_16BIT_NUM_BLOCK_LEN 0x02
-/* IC reference field is present */
-#define I93_INFO_FLAG_IC_REF 0x08
-/* IC ref info length */
-#define I93_INFO_IC_REF_LEN 0x01
-/* Memory coded in 2 bytes address */
-#define I93_INFO_FLAG_MOI 0x10
-
-/* Max block size in bytes */
-#define I93_MAX_BLOCK_LENGH 32
-
-/* Block lengths */
-#define I93_BLEN_4BYTES 0x04
-#define I93_BLEN_8BYTES 0x08
-#define I93_BLEN_16BYTES 0x10
-#define I93_BLEN_32BYTES 0x20
-/* ICODE Capability Container(CC) definition */
-#define I93_ICODE_CC_MAGIC_NUMER_E1 0xE1 /* magic number in CC[0] */
-#define I93_ICODE_CC_MAGIC_NUMER_E2 0xE2 /* magic number in CC[0] */
-/* read access condition in CC[1] */
-#define I93_ICODE_CC_READ_ACCESS_MASK 0x0C
-/* read access granted without security */
-#define I93_ICODE_CC_READ_ACCESS_GRANTED 0x00
-/* write access condition in CC[1] */
-#define I93_ICODE_CC_WRITE_ACCESS_MASK 0x03
-/* write access granted without security */
-#define I93_ICODE_CC_WRITE_ACCESS_GRANTED 0x00
-/* write access not granted at all */
-#define I93_ICODE_CC_READ_ONLY 0x03
-/* read multi block supported in CC[3] */
-#define I93_ICODE_CC_MBREAD_MASK 0x01
-/* inventory page read supported in CC[3] */
-#define I93_ICODE_CC_IPREAD_MASK 0x02
-/* More than 2040 bytes are supported in CC[3] */
-#define I93_STM_CC_OVERFLOW_MASK 0x04
-#define I93_ONS_CC_OVERFLOW_MASK 0x04
-/* Special Frame are supported in CC[3] */
-#define I93_ICODE_CC_SPECIAL_FRAME_MASK 0x10
-
-/* ICODE TLV type */
-#define I93_ICODE_TLV_TYPE_NULL 0x00 /* NULL TLV */
-#define I93_ICODE_TLV_TYPE_NDEF 0x03 /* NDEF message TLV */
-#define I93_ICODE_TLV_TYPE_PROP 0xFD /* Proprietary TLV */
-#define I93_ICODE_TLV_TYPE_TERM 0xFE /* Terminator TLV */
-
-/* UID Coding (UID Bit 64-57), First byte of ISO 15693 UID */
-#define I93_UID_FIRST_BYTE 0xE0
-
-/* UID Coding (UID Bit 56-49), IC manufacturer code */
-#define I93_UID_IC_MFG_CODE_STM 0x02
-#define I93_UID_IC_MFG_CODE_NXP 0x04
-#define I93_UID_IC_MFG_CODE_TI 0x07
-#define I93_UID_IC_MFG_CODE_ONS 0x67
-
-/* NXP, UID Coding of ICODE type (UID Bit 48-41) */
-/* ICODE SLI, SLIX */
-#define I93_UID_ICODE_SLI 0x01
-/* ICODE SLI-S, SLIX-S */
-#define I93_UID_ICODE_SLI_S 0x02
-/* ICODE SLI-L, SLIX-L */
-#define I93_UID_ICODE_SLI_L 0x03
-
-/* IC Reference for ICODE SLI-L */
-#define I93_IC_REF_ICODE_SLI_L 0x03
-/* read multi block supported check bit */
-#define I93_ICODE_IC_REF_MBREAD_MASK 0x02
-
-/* TI, UID Coding of product version (UID Bit 48-42) */
-/* upper 7 bits */
-#define I93_UID_TAG_IT_HF_I_PRODUCT_ID_MASK 0xFE
-/* Tag-it HF-I Plus Inlay */
-#define I93_UID_TAG_IT_HF_I_PLUS_INLAY 0x00
-/* Tag-it HF-I Plus Chip */
-#define I93_UID_TAG_IT_HF_I_PLUS_CHIP 0x80
-/* Tag-it HF-I Standard Chip/Inlyas */
-#define I93_UID_TAG_IT_HF_I_STD_CHIP_INLAY 0xC0
-/* Tag-it HF-I Pro Chip/Inlyas */
-#define I93_UID_TAG_IT_HF_I_PRO_CHIP_INLAY 0xC4
-
-#define I93_TAG_IT_HF_I_STD_CHIP_INLAY_NUM_TOTAL_BLK 11
-#define I93_TAG_IT_HF_I_PRO_CHIP_INLAY_NUM_TOTAL_BLK 12
-
-#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_BLK_SIZE 4
-#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_NUM_USER_BLK 8
-/* LSB in Block 0x0A */
-#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_AFI_LOCATION 40
-
-/* STM, product version (IC manufacturer code) */
-/* IC Reference mask for STM */
-#define I93_IC_REF_STM_MASK 0xFC
-/* IC Reference for LRI1K: 010000xx(b), blockSize: 4, numberBlocks: 0x20 */
-#define I93_IC_REF_STM_LRI1K 0x40
-/* IC Reference for LRI2K: 001000xx(b), blockSize: 4, numberBlocks: 0x40 */
-#define I93_IC_REF_STM_LRI2K 0x20
-/* IC Reference for LRIS2K: 001010xx(b), blockSize: 4, numberBlocks: 0x40 */
-#define I93_IC_REF_STM_LRIS2K 0x28
-/* IC Reference for LRIS64K: 010001xx(b), blockSize: 4, numberBlocks: 0x800
- */
-#define I93_IC_REF_STM_LRIS64K 0x44
-/* IC Reference for M24LR64-R: 001011xx(b), blockSize: 4, numberBlocks: 0x800
- */
-#define I93_IC_REF_STM_M24LR64_R 0x2C
-/* IC Reference for M24LR04E-R: 01011010(b), blockSize: 4, numberBlocks: 0x80 */
-#define I93_IC_REF_STM_M24LR04E_R 0x5A
-/* IC Reference for M24LR16E-R: 01001110(b), blockSize: 4, numberBlocks: 0x200
- */
-#define I93_IC_REF_STM_M24LR16E_R 0x4E
-/* IC Reference for M24LR16D-W: 01001101(b), blockSize: 4, numberBlocks: 0x200
- */
-#define I93_IC_REF_STM_M24LR16D_W 0x4D
-/* IC Reference for M24LR64D-W: 01011110(b), blockSize: 4, numberBlocks: 0x800
- */
-#define I93_IC_REF_STM_M24LR64E_R 0x5E
-/* IC Reference for ST25DV04K: 00100100(b), blockSize: 4, numberBlocks: 0x80
- */
-#define I93_IC_REF_STM_ST25DV04K 0x24
-/* IC Reference for ST25DVHIK: 00100110(b), blockSize: 4, numberBlocks: 0x800
- * or 0x200
- */
-#define I93_IC_REF_STM_ST25DVHIK 0x26
-/* IC Reference for ST25TV04K: 00110101(b), blockSize: 4, numberBlocks: 0x0200
- */
-#define I93_IC_REF_STM_ST25TV04K_E 0x35
-/* IC Reference for ST25TV16K: 01001000(b), blockSize: 4, numberBlocks: 0x1000
- * IC Reference for ST25TV64K: 01001000(b), blockSize: 4, numberBlocks: 0x4000
- */
-#define I93_IC_REF_STM_ST25TV16K_64K 0x48
-
-/* Product code family for LRI2K */
-#define I93_PROD_CODE_STM_LRI2K_MASK I93_IC_REF_STM_LRI2K /* 0x20 */
-/* Product code family for LRIS2K */
-#define I93_PROD_CODE_STM_LRIS2K_MASK I93_IC_REF_STM_LRIS2K /* 0x28 */
-/* Product code family for LRIS64K */
-#define I93_PROD_CODE_STM_LRIS64K_MASK I93_IC_REF_STM_LRIS64K /* 0x44 */
-/* Product code family for M24LR04E_R */
-#define I93_PROD_CODE_STM_M24LR04E_R_MASK 0x58
-/* Product code family for M24LR64_R */
-#define I93_PROD_CODE_STM_M24LR64_R_MASK I93_IC_REF_STM_M24LR64_R /* 0x2C */
-/* Product code family for M24LR16E_R */
-#define I93_PROD_CODE_STM_M24LR16E_R_MASK 0x4C
-/* Product code family for M24LR64E_R */
-#define I93_PROD_CODE_STM_M24LR64E_R_MASK 0x5C
-/* Product code family for ST25DV04K/16K/64K */
-#define I93_PROD_CODE_STM_ST25DV_K_MASK I93_IC_REF_STM_ST25DV04K
-
-/* ONS, product version (IC manufacturer code) */
-/* IC Reference for N36RW02: 00011010(b), blockSize: 4, numberBlocks: 0x40 */
-#define I93_IC_REF_ONS_N36RW02 0x1A
-/* IC Reference for N24RF04: 00101010(b), blockSize: 4, numberBlocks: 0x80 */
-#define I93_IC_REF_ONS_N24RF04 0x2A
-/* IC Reference for N24RF04E: 00101110(b), blockSize: 4, numberBlocks: 0x80 */
-#define I93_IC_REF_ONS_N24RF04E 0x2E
-/* IC Reference for N24RF16: 01001010(b), blockSize: 4, numberBlocks: 0x200 */
-#define I93_IC_REF_ONS_N24RF16 0x4A
-/* IC Reference for N24RF16E: 01001110(b), blockSize: 4, numberBlocks: 0x200 */
-#define I93_IC_REF_ONS_N24RF16E 0x4E
-/* IC Reference for N24RF64: 01101010(b), blockSize: 4, numberBlocks: 0x800 */
-#define I93_IC_REF_ONS_N24RF64 0x6A
-/* IC Reference for N24RF64E: 01101110(b), blockSize: 4, numberBlocks: 0x800 */
-#define I93_IC_REF_ONS_N24RF64E 0x6E
-
-#define I93_STM_BLOCKS_PER_SECTOR 32
-#define I93_STM_MAX_BLOCKS_PER_READ 32
-
-#define I93_ONS_BLOCKS_PER_SECTOR 32
-#define I93_ONS_MAX_BLOCKS_PER_READ 32
-
-#endif /* TAGS_DEFS_H */
\ No newline at end of file
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc/include/tags_int.h b/libstpropnci/libstnfc-nci-headers/src/nfc/include/tags_int.h
deleted file mode 100755
index dbbb902..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc/include/tags_int.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2009-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 the common data types shared by Reader/Writer mode
- * and Card Emulation.
- *
- ******************************************************************************/
-
-#ifndef TAGS_INT_H
-#define TAGS_INT_H
-
-/******************************************************************************
-// T1T command and response definitions
-******************************************************************************/
-
-typedef struct {
- uint8_t opcode;
- uint8_t cmd_len;
- uint8_t uid_offset;
- uint8_t rsp_len;
-} tT1T_CMD_RSP_INFO;
-
-typedef struct {
- uint8_t tag_model;
- uint8_t tms;
- uint8_t b_dynamic;
- uint8_t lock_tlv[3];
- uint8_t mem_tlv[3];
-} tT1T_INIT_TAG;
-
-typedef struct {
- uint8_t manufacturer_id;
- bool b_multi_version;
- uint8_t version_block;
- uint16_t version_no;
- uint16_t version_bmask;
- uint8_t b_calc_cc;
- uint8_t tms;
- bool b_otp;
- uint8_t default_lock_blpb;
-} tT2T_INIT_TAG;
-
-typedef struct {
- uint8_t opcode;
- uint8_t cmd_len;
- uint8_t rsp_len;
- uint8_t nack_rsp_len;
-} tT2T_CMD_RSP_INFO;
-
-extern const uint8_t
- t4t_v10_ndef_tag_aid[]; /* V1.0 Type 4 Tag Application ID */
-extern const uint8_t
- t4t_v20_ndef_tag_aid[]; /* V2.0 Type 4 Tag Application ID */
-
-extern const tT1T_CMD_RSP_INFO t1t_cmd_rsp_infos[];
-extern const tT1T_INIT_TAG t1t_init_content[];
-extern const tT1T_CMD_RSP_INFO* t1t_cmd_to_rsp_info(uint8_t opcode);
-extern const tT1T_INIT_TAG* t1t_tag_init_data(uint8_t tag_model);
-extern uint8_t t1t_info_to_evt(const tT1T_CMD_RSP_INFO* p_info);
-
-extern const tT2T_INIT_TAG* t2t_tag_init_data(uint8_t manufacturer_id,
- bool b_valid_ver,
- uint16_t version_no);
-extern const tT2T_CMD_RSP_INFO t2t_cmd_rsp_infos[];
-extern const tT2T_CMD_RSP_INFO* t2t_cmd_to_rsp_info(uint8_t opcode);
-extern uint8_t t2t_info_to_evt(const tT2T_CMD_RSP_INFO* p_info);
-
-extern const char* t1t_info_to_str(const tT1T_CMD_RSP_INFO* p_info);
-extern const char* t2t_info_to_str(const tT2T_CMD_RSP_INFO* p_info);
-extern int tags_pow(int x, int y);
-extern unsigned int tags_log2(unsigned int x);
-
-#endif /* TAGS_INT_H */
diff --git a/libstpropnci/libstnfc-nci-headers/src/nfc_vendor_extn/include/NfcVendorExtn.h b/libstpropnci/libstnfc-nci-headers/src/nfc_vendor_extn/include/NfcVendorExtn.h
deleted file mode 100755
index 67deb69..0000000
--- a/libstpropnci/libstnfc-nci-headers/src/nfc_vendor_extn/include/NfcVendorExtn.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright 2024, 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.
- */
-#pragma once
-
-#include <aidl/android/hardware/nfc/INfc.h>
-#include <android/hardware/nfc/1.1/INfc.h>
-#include <android/hardware/nfc/1.2/INfc.h>
-
-#include "config.h"
-#include "nfc_api.h"
-#include "nfc_hal_api.h"
-
-using android::sp;
-using android::hardware::nfc::V1_0::INfc;
-using INfcAidl = ::aidl::android::hardware::nfc::INfc;
-
-#define NFCSTATUS_EXTN_FEATURE_SUCCESS (0x0050)
-
-// This is only intended for a limited time to handle non-AOSP vendor interface
-// implementations on existing upgrading devices and not as a new extension
-// point. This will be removed once all devices are upgraded to the latest NFC
-// HAL.
-/**
- * @brief Vendor extension control block holds below data's
- * hidlHal - reference to HIDL Hal instance
- * aidlHal - reference to AIDL Hal instance
- * pHalCback - reference to HAL events callback
- * pDataCallback - reference to NCI response and notification packets
- * configMap - holds the configs as keys and values
- *
- */
-struct VendorExtnCb {
- sp<INfc> hidlHal;
- std::shared_ptr<INfcAidl> aidlHal;
- tHAL_NFC_CBACK* pHalCback;
- tHAL_NFC_DATA_CBACK* pDataCback;
- std::map<std::string, ConfigValue> configMap;
-};
-
-/**
- * @brief Holds NCI packet data length and data buffer
- *
- */
-typedef struct {
- uint16_t data_len;
- uint8_t* p_data;
-} NciData_t;
-
-/**
- * @brief Holds functional event datas to support
- * extension features
- */
-typedef struct {
- NciData_t nci_msg;
- NciData_t nci_rsp_ntf;
- uint8_t write_status;
- uint8_t hal_state;
- uint8_t rf_state;
- uint8_t hal_event;
- uint8_t hal_event_status;
-} NfcExtEventData_t;
-
-/**
- * @brief Holds functional event codes to support
- * extension features.
- * Begin with 0x0B to avoid conflicts with standard and vendor specific HAL
- * events
- */
-typedef enum {
- HANDLE_VENDOR_NCI_MSG = 0x0B,
- HANDLE_VENDOR_NCI_RSP_NTF,
- HANDLE_WRITE_COMPLETE_STATUS,
- HANDLE_HAL_CONTROL_GRANTED,
- HANDLE_NFC_HAL_STATE_UPDATE,
- HANDLE_RF_HAL_STATE_UPDATE,
- HANDLE_HAL_EVENT,
- HANDLE_FW_DNLD_STATUS_UPDATE,
- HANDLE_DOWNLOAD_FIRMWARE_REQUEST,
- HANDLE_NFC_ADAPTATION_INIT,
- HANDLE_NFC_PRE_DISCOVER,
- HANDLE_NFC_HAL_CORE_INITIALIZE,
- HANDLE_NFC_HAL_POWER_CYCLE,
- HANDLE_NFC_GET_MAX_NFCEE,
- HANDLE_NFC_HAL_CLOSE,
-#ifdef ST21NFC
- HANDLE_NFC_DEVICE_SHUTDOWN,
-#endif // ST21NFC
-} NfcExtEvent_t;
-
-typedef enum {
- NFCC_HAL_TRANS_ERR_CODE = 6u,
- NFCC_HAL_FATAL_ERR_CODE = 8u,
-} NfcExtHal_NFCC_ERROR_CODE_t;
-
-class NfcVendorExtn {
- public:
- /**
- * @brief Get the singleton of this object.
- * @return Reference to this object.
- *
- */
- static NfcVendorExtn* getInstance();
-
- /**
- * @brief This function sets up and initialize the extension feature
- * @param hidlHal reference to HIDL Hal instance
- * @param aidlHal reference to AIDL Hal instance
- * @return true if init is success else false
- *
- */
- bool Initialize(sp<INfc> hidlHal, std::shared_ptr<INfcAidl> aidlHal);
-
- /**
- * @brief This function sets ups the NCI event and data callback pointers.
- * @param pHalCback reference to HAL events callback
- * @param pDataCback reference to NCI response and notification packets
- * @return None
- * \Note: This function pointers will be used to notify the
- * NCI event and data to upper layer.
- *
- */
- void setNciCallback(tHAL_NFC_CBACK* pHalCback,
- tHAL_NFC_DATA_CBACK* pDataCback);
-
- /**
- * @brief sends the NCI packet to handle extension feature
- * @param dataLen length of the NCI packet
- * @param pData data buffer pointer
- * @return returns true if it is vendor specific feature,
- * and handled only by extension library otherwise returns
- * false and it have to be handled by libnfc.
- *
- */
- bool processCmd(uint16_t dataLen, uint8_t* pData);
-
- /**
- * @brief sends the NCI packet to handle extension feature
- * @param dataLen length of the NCI packet
- * @param pData data buffer pointer
- * @return returns true if it is vendor specific feature,
- * and handled only by extension library otherwise returns
- * false and it have to be handled by libnfc.
- *
- */
- bool processRspNtf(uint16_t dataLen, uint8_t* pData);
-
- /**
- * @brief sends the NCI packet to handle extension feature
- * @param event
- * @param status
- * @return returns true if it is vendor specific feature,
- * and handled only by extension library otherwise returns
- * false and it have to be handled by libnfc.
- *
- */
- bool processEvent(uint8_t event, tHAL_NFC_STATUS status);
-
- /**
- * @brief Loads the Nfc Vendor Config
- * @param pConfigMap pointer to the config map
- * @return None
- * \Note @param pConfigMap is needed for future use
- * to add the vendor specific properties.
- *
- */
- void getVendorConfigs(std::map<std::string, ConfigValue>* pConfigMap);
-
- /**
- * @brief return the pointer of vendor extension control block.
- * @return A pointer to the VendorExtnCb structure or nullptr,
- * if the structure is not available or invalid.
- *
- */
- VendorExtnCb* getVendorExtnCb();
-
- /**
- * @brief This function de-initializes the extension feature
- * @return void
- *
- */
- bool finalize();
-
- private:
- VendorExtnCb mVendorExtnCb;
-
- NfcVendorExtn();
-
- ~NfcVendorExtn();
-};
diff --git a/libstpropnci/libstnfc-nci-headers/utils/include/config.h b/libstpropnci/libstnfc-nci-headers/utils/include/config.h
deleted file mode 100755
index 9dab8a2..0000000
--- a/libstpropnci/libstnfc-nci-headers/utils/include/config.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2017 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.
- */
-#pragma once
-
-#include <map>
-#include <string>
-#include <vector>
-
-class ConfigValue {
- public:
- enum Type { UNSIGNED, STRING, BYTES };
-
- ConfigValue();
- explicit ConfigValue(std::string);
- explicit ConfigValue(unsigned);
- explicit ConfigValue(std::vector<uint8_t>);
- explicit ConfigValue(std::vector<int8_t>);
- Type getType() const;
- std::string getString() const;
- unsigned getUnsigned() const;
- std::vector<uint8_t> getBytes() const;
-
- bool parseFromString(std::string in);
-
- private:
- Type type_;
- std::string value_string_;
- unsigned value_unsigned_;
- std::vector<uint8_t> value_bytes_;
-};
-
-class ConfigFile {
- public:
- void parseFromFile(const std::string& file_name);
- void parseFromString(const std::string& config);
- void addConfig(const std::string& config, ConfigValue& value);
-
- bool hasKey(const std::string& key);
- std::string getString(const std::string& key);
- unsigned getUnsigned(const std::string& key);
- std::vector<uint8_t> getBytes(const std::string& key);
-
- bool isEmpty();
- void clear();
-
- bool updateNciCfg = false;
-
- private:
- ConfigValue& getValue(const std::string& key);
-
- bool updateConfig(const std::string& config, ConfigValue& value);
- std::map<std::string, ConfigValue> values_;
-};
diff --git a/libstpropnci/libstnfc-nci-headers/utils/include/ringbuffer.h b/libstpropnci/libstnfc-nci-headers/utils/include/ringbuffer.h
deleted file mode 100755
index 35cc023..0000000
--- a/libstpropnci/libstnfc-nci-headers/utils/include/ringbuffer.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2017 Google Inc.
- *
- * 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.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include <stdint.h>
-#include <sys/types.h>
-
-typedef struct ringbuffer_t ringbuffer_t;
-
-// NOTE:
-// None of the functions below are thread safe when it comes to accessing the
-// *rb pointer. It is *NOT* possible to insert and pop/delete at the same time.
-// Callers must protect the *rb pointer separately.
-
-// Create a ringbuffer with the specified size
-// Returns NULL if memory allocation failed. Resulting pointer must be freed
-// using |ringbuffer_free|.
-ringbuffer_t* ringbuffer_init(const size_t size);
-
-// Frees the ringbuffer structure and buffer
-// Save to call with NULL.
-void ringbuffer_free(ringbuffer_t* rb);
-
-// Returns remaining buffer size
-size_t ringbuffer_available(const ringbuffer_t* rb);
-
-// Returns size of data in buffer
-size_t ringbuffer_size(const ringbuffer_t* rb);
-
-// Attempts to insert up to |length| bytes of data at |p| into the buffer
-// Return actual number of bytes added. Can be less than |length| if buffer
-// is full.
-size_t ringbuffer_insert(ringbuffer_t* rb, const uint8_t* p, size_t length);
-
-// Peek |length| number of bytes from the ringbuffer, starting at |offset|,
-// into the buffer |p|. Return the actual number of bytes peeked. Can be less
-// than |length| if there is less than |length| data available. |offset| must
-// be non-negative.
-size_t ringbuffer_peek(const ringbuffer_t* rb, off_t offset, uint8_t* p,
- size_t length);
-
-// Does the same as |ringbuffer_peek|, but also advances the ring buffer head
-size_t ringbuffer_pop(ringbuffer_t* rb, uint8_t* p, size_t length);
-
-// Deletes |length| bytes from the ringbuffer starting from the head
-// Return actual number of bytes deleted.
-size_t ringbuffer_delete(ringbuffer_t* rb, size_t length);
diff --git a/libstpropnci/src/stpropnci-internal.h b/libstpropnci/src/stpropnci-internal.h
deleted file mode 100755
index a4a0353..0000000
--- a/libstpropnci/src/stpropnci-internal.h
+++ /dev/null
@@ -1,371 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2025 STMicroelectronics
- *
- * 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.
- *
- ******************************************************************************/
-
-#ifndef STPROPNCI_INTERNAL_H
-#define STPROPNCI_INTERNAL_H
-
-#include <pthread.h>
-#include <nci_defs.h>
-#include <nfc_types.h>
-#include <stpropnci.h>
-
-#include <stpropnci_prop_st.h>
-
-/* Logging facility */
-#define LOG_TAG "StNfcPropNci"
-extern int stpropnci_loglvl;
-#ifndef STPROPNCI_VENDOR
-#include <log/log.h>
-#define LOG_D(fmt, ...) \
- { \
- if (stpropnci_loglvl > 1) \
- LOG_PRI(ANDROID_LOG_VERBOSE, LOG_TAG, "%s:%d: " fmt, __func__, __LINE__, \
- ##__VA_ARGS__); \
- }
-#define LOG_I(fmt, ...) \
- { \
- if (stpropnci_loglvl > 0) \
- LOG_PRI(ANDROID_LOG_DEBUG, LOG_TAG, "%s:%d: " fmt, __func__, __LINE__, \
- ##__VA_ARGS__); \
- }
-#define LOG_E(fmt, ...) \
- { \
- if (stpropnci_loglvl > 0) \
- LOG_PRI(ANDROID_LOG_ERROR, LOG_TAG, "%s:%d: " fmt, __func__, __LINE__, \
- ##__VA_ARGS__); \
- }
-#else // STPROPNCI_VENDOR
-#include <android/log.h>
-#define LOG_D(fmt, ...) \
- { \
- if (stpropnci_loglvl > 1) \
- __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "%s:%d: " fmt, __func__, \
- __LINE__, ##__VA_ARGS__); \
- }
-#define LOG_I(fmt, ...) \
- { \
- if (stpropnci_loglvl > 0) \
- __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "%s:%d: " fmt, __func__, \
- __LINE__, ##__VA_ARGS__); \
- }
-#define LOG_E(fmt, ...) \
- { \
- if (stpropnci_loglvl > 0) \
- __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "%s:%d: " fmt, __func__, \
- __LINE__, ##__VA_ARGS__); \
- }
-#endif // STPROPNCI_VENDOR
-
-// Submodules (different NCI proprietary processors) can register to intercept
-// messages before the normal handling.
-typedef bool (*module_cb_t)(bool dir_from_upper, const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt, uint8_t gid,
- uint8_t oid);
-
-typedef struct modcblist {
- module_cb_t cb;
- bool must_match_mt;
- uint8_t mt;
- bool must_match_gid;
- uint8_t gid;
- bool must_match_oid;
- uint8_t oid;
- bool must_match_suboid;
- uint8_t suboid;
- struct modcblist* next;
-} modcblist_t;
-
-// Structure to queue messages
-#define MAX_NCI_MESSAGE_LEN (NCI_MSG_HDR_SIZE + NCI_MAX_VSC_SIZE)
-#define MAX_HCI_RECEIVE_LEN 1024
-typedef struct msg {
- struct timespec ts;
- uint8_t payload[MAX_NCI_MESSAGE_LEN];
- uint16_t payloadlen;
- bool dir_to_nfcc;
- bool retried;
- module_cb_t rspcb;
- struct msg* next;
-} msg_t;
-
-// Structure to queue watchdog events to monitor
-typedef enum {
- WD_FIELD_ON_TOO_LONG = 1, // no NCI_MSG_RF_FIELD(off) received after
- // (duration) of NCI_MSG_RF_FIELD(on)
- WD_ACTIVE_RW_TOO_LONG, // no ST_NCI_MSG_PROP_PWR_MON_RW_OFF_NTF received
- // within 5s after ON
-} watchdog_event_t;
-typedef struct watchdog {
- struct timespec ts_expire;
- watchdog_event_t event;
- struct watchdog* next;
-} watchdog_t;
-
-#define NFC_PROTO_T2T_MASK 0x01
-#define NFC_PROTO_T3T_MASK 0x02
-#define NFC_PROTO_T4T_MASK 0x04
-
-typedef struct {
- uint8_t nfcee_id; /* NFCEE ID */
- uint8_t la; /* Listen A protocols */
- uint8_t lb; /*Listen B protocols */
- uint8_t lf; /*Listen B protocols */
-} ee_info_t;
-
-#define CUST_POLL_NO_RSP 0x00
-#define CUST_POLL_STD_RSP 0x01
-#define CUST_POLL_NOSTD_RSP 0x02
-
-#define NFC_A_FRAME 0x00
-#define NFC_B_FRAME 0x01
-
-#define NFC_CUST_PASSIVE_POLL_MODE 0x78
-#define PROP_A_POLL 0x80
-#define PROP_B_POLL 0x81
-#define PROP_F_POLL 0x82
-#define PROP_V_POLL 0x83
-#define PROP_B_NOEOFSOF_POLL 0x84
-#define PROP_B_NOSOF_POLL 0x85
-
-/* State machine */
-extern struct stpropnci_state {
- /*****************************
- NCI prop state machine
- *****************************/
- /* If a proprietary sequence is ongoing */
- enum {
- ST_INIT = 0,
-
- } cmd_state;
-
- // Passthrough mode; if true, no processing done in this lib.
- bool passthrough_mode;
-
- // Data from the last CORE_RESET_NTF (len=0 if not received)
- uint8_t manu_specific_info_len;
- uint8_t manu_specific_info[40];
- enum {
- CLF_MODE_UNKNOWN = 0,
- CLF_MODE_LOADER,
- CLF_MODE_ROUTER_DISABLED,
- CLF_MODE_ROUTER_ENABLED,
- CLF_MODE_ROUTER_USBCHARGING,
- } clf_mode;
-
- // Flag indicating if we use observe mode per tech or not.
- bool observe_per_tech;
- // Flag indicating observe mode is temporarily suspended.
- bool observe_mode_suspended;
-
- // flag for sending polling frame notif data
- bool pollingframe_inCE;
-
- // PROP_PWR_MON_RW stability related
- bool pwr_mon_isActiveRW;
- int pwr_mon_errorCount;
-
- // Storage for nfcee Ids of active NFCEE
- uint8_t active_nfcee_ids[5];
- uint8_t nb_active_nfcees;
- bool wait_nfcee_ntf;
- uint8_t waiting_nfcee_id;
-
- // APDU gate data
- bool apdu_gate_ready;
- uint8_t apdu_pipe_id;
- uint32_t tx_waiting_time;
-
- // HCI data handling
- bool (*hci_rsp_cb)(const uint8_t* payload, const uint16_t payloadlen);
- uint8_t hci_reassembly_buff[MAX_HCI_RECEIVE_LEN];
- uint8_t* hci_reassembly_p;
- uint8_t hci_cr_cnt;
-
- // To ensure enough time after sending RF data, before deactivation
- struct timespec ts_last_rf_tx;
-
- // Store RF_NFCEE_DISCOVERY_REQ_NTF data
- ee_info_t ee_info[5];
- uint8_t nb_ee_info;
-
- // Handle command NCI_ANDROID_SET_UID_AND_SAK
- enum { UID_N_SAK_GET_CONFIG = 0, UID_N_SAK_SET_CONFIG } uid_and_sak_state;
- uint8_t sak;
- uint8_t uid[10];
- uint8_t uid_length;
- bool is_card_a_on;
-
- //reporting of received empty I frames
- bool is_reader_activation;
- bool is_tx_empty_iframe;
-
- //Does eSE support felica applet?
- bool is_ese_felica_enabled;
-
- //Was RF custom passive poll frame set?
- bool is_cust_poll_frame_set;
- bool is_rf_intf_cust_tx;
-
- //Handle SWP repeat frames
- bool is_ese_stuck;
- int last_tx_cnt;
- int last_rx_param_len;
- bool last_rx_is_frag[4];
- int last_tx_len;
- uint8_t last_rx_param[30];
- uint8_t last_tx[5];
-
- /*****************************
- Internal lib configs
- *****************************/
- // A storage for building messages for sending out.
- uint8_t* tmpbuff;
- uint16_t* tmpbufflen;
-
- // Management of the thread sending messages out.
- struct {
- pthread_t pump_thr;
- pthread_mutex_t pump_mtx;
- pthread_cond_t pump_cnd;
- pthread_mutex_t pump_pool_mtx;
- msg_t msgPool;
- int msgPool_ctr;
- msg_t toSend;
- int toSend_ctr;
- msg_t toAck;
- int toAck_ctr;
- watchdog_t toWatch;
- watchdog_t wdPool;
- bool mustExit;
- } pumpstate;
-
- // Management of the submodules callbacks.
- struct {
- modcblist_t modcblist;
- modcblist_t modcbpool;
- pthread_mutex_t modcb_mtx;
- } modcbstate;
-
- // callback when sending messages out of the library
- outgoing_cb_t outCb;
-
- //lib conf values
- halconfig mHalConfig;
-
-} stpropnci_state;
-
-
-// Get the HW version from the structure
-#define HW_VERSION (stpropnci_state.manu_specific_info[0])
-#define HW_VERSION_ST21NFCL 0x07
-#define HW_VERSION_ST54L 0x06
-#define HW_VERSION_ST54J 0x05
-#define HW_VERSION_ST21NFCD 0x04
-
-// Get the FW version from the structure
-#define FW_VERSION_MAJOR (stpropnci_state.manu_specific_info[2])
-#define FW_VERSION_MINOR (stpropnci_state.manu_specific_info[3] & 0x7F)
-#define FW_VERSION_MINOR_BIS (stpropnci_state.manu_specific_info[3] & 0x80)
-#define FW_VERSION_REV \
- ((stpropnci_state.manu_specific_info[4] << 8) | \
- stpropnci_state.manu_specific_info[5])
-
-#define FW_VERSION \
- ((FW_VERSION_MAJOR << 24) | (FW_VERSION_MINOR << 16) | \
- (FW_VERSION_MINOR_BIS << 16) | FW_VERSION_REV)
-
-// Helper that we use often
-#define IS_HW_54L_FAMILY() \
- ((HW_VERSION == HW_VERSION_ST21NFCL) || (HW_VERSION == HW_VERSION_ST54L))
-
-// Generation 1 firmwares (old & no more updated): 1.x on ST21NFCD, 1.x or 2.x
-// on ST54J, 1.x on 54L/21L.
-#define IS_FW_GEN_1() \
- (((HW_VERSION == HW_VERSION_ST21NFCD) && (FW_VERSION_MAJOR == 0x01)) || \
- ((HW_VERSION == HW_VERSION_ST54J) && \
- ((FW_VERSION_MAJOR == 0x01) || (FW_VERSION_MAJOR == 0x02))) || \
- (IS_HW_54L_FAMILY() && (FW_VERSION_MAJOR == 0x01)))
-
-// Generation 2 firmwares: 13.x on ST21NFCJ or 3.x on ST54J
-#define IS_FW_GEN_2() \
- (((HW_VERSION == HW_VERSION_ST21NFCD) && (FW_VERSION_MAJOR == 0x13)) || \
- ((HW_VERSION == HW_VERSION_ST54J) && (FW_VERSION_MAJOR == 0x03)))
-
-// Generation 3 firmwares: 2.x on ST21NFCL/ST54L
-#define IS_FW_GEN_3() (IS_HW_54L_FAMILY() && (FW_VERSION_MAJOR == 0x02))
-
-// Returns the generation of the FW or 0 if unknown.
-#define GET_FW_GEN() \
- (IS_FW_GEN_3() ? 3 : (IS_FW_GEN_2() ? 2 : (IS_FW_GEN_1() ? 1 : (0))))
-
-/* Process standard NCI frames (GID 0-2 and data) */
-bool stpropnci_process_std(bool inform_only, bool dir_from_upper,
- const uint8_t* payload, const uint16_t payloadlen,
- uint8_t mt, uint8_t gid, uint8_t oid);
-
-/* Process proprietary NCI frames (GID F) */
-bool stpropnci_process_prop(bool inform_only, bool dir_from_upper,
- const uint8_t* payload, const uint16_t payloadlen,
- uint8_t mt, uint8_t oid);
-
-/* Manage the message pump related information */
-bool stpropnci_pump_post(bool dir_to_nfcc, const uint8_t* payload,
- uint16_t payloadlen, module_cb_t rspcb);
-void stpropnci_pump_got(const uint8_t* payload, uint16_t payloadlen,
- bool* handled);
-bool stpropnci_pump_watchdog_add(watchdog_event_t t, int ms);
-void stpropnci_pump_watchdog_remove(watchdog_event_t t);
-bool stpropnci_pump_init();
-void stpropnci_pump_fini();
-
-void stpropnci_tmpbuff_reset();
-
-void stpropnci_build_prop_status_rsp(uint8_t* buf, uint16_t* buflen,
- uint8_t oid, uint8_t suboid,
- uint8_t status);
-
-bool stpropnci_send_core_reset_ntf_recovery(uint8_t hint);
-
-bool stpropnci_cb_passthrough_rsp(bool dir_from_upper, const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t gid, uint8_t oid);
-
-bool stpropnci_cb_block_rsp(bool dir_from_upper, const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt, uint8_t gid,
- uint8_t oid);
-
-/* Sub modules callbacks management */
-bool stpropnci_modcb_init();
-void stpropnci_modcb_fini();
-bool stpropnci_modcb_register(module_cb_t cb, bool match_mt, uint8_t mt,
- bool match_gid, uint8_t gid, bool match_oid,
- uint8_t oid, bool match_suboid, uint8_t suboid);
-bool stpropnci_modcb_process(bool dir_from_upper, const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt, uint8_t gid,
- uint8_t oid);
-void stpropnci_modcb_unregister(module_cb_t cb);
-
-/**************************
- Android NCI management
- **************************/
-bool stpropnci_process_prop_android(bool inform_only, bool dir_from_upper,
- const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t oid);
-
-#endif // STPROPNCI_INTERNAL_H
diff --git a/libstpropnci/src/stpropnci.cc b/libstpropnci/src/stpropnci.cc
deleted file mode 100755
index a9dabc7..0000000
--- a/libstpropnci/src/stpropnci.cc
+++ /dev/null
@@ -1,303 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2025 STMicroelectronics
- *
- * 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.
- *
- ******************************************************************************/
-#include <pthread.h>
-#include <string.h>
-#include <stpropnci-internal.h>
-
-int stpropnci_loglvl = 0;
-struct stpropnci_state stpropnci_state;
-
-static pthread_mutex_t reentry_lock = PTHREAD_MUTEX_INITIALIZER;
-static bool isInitialized = false;
-
-/*******************************************************************************
-**
-** Function stpropnci_init
-**
-** Description Initialize the library and registers the outgoing_cb of the
-** caller.
-**
-** Params:
-** - loglvl : 0: nothing; 1: important data only; 2: everything
-** - cb : the callback that will be used for sending out messages from the
-** lib
-**
-** Returns true if the initialization is successful, false otherwise.
-**
-*******************************************************************************/
-bool stpropnci_init(int loglvl, outgoing_cb_t cb) {
- (void)pthread_mutex_lock(&reentry_lock);
- stpropnci_loglvl = loglvl;
-#ifndef STPROPNCI_VENDOR
-#define VARIANT "product"
-#else
-#define VARIANT "vendor"
-#endif
- LOG_I("(re)Initializing (version:DEV, variant:" VARIANT "), log:%d", loglvl);
-
- memset(&stpropnci_state, 0, sizeof(stpropnci_state));
- // We use the msgPool sentinel as temp storage.
- stpropnci_state.tmpbuff = stpropnci_state.pumpstate.msgPool.payload;
- stpropnci_state.tmpbufflen = &stpropnci_state.pumpstate.msgPool.payloadlen;
-
- isInitialized = true;
- stpropnci_state.outCb = cb;
-
- if (!stpropnci_pump_init()) {
- LOG_E("Failed to initialize pump");
- (void)pthread_mutex_unlock(&reentry_lock);
- return false;
- }
-
- if (!stpropnci_modcb_init()) {
- LOG_E("Failed to initialize modcb");
- (void)pthread_mutex_unlock(&reentry_lock);
- return false;
- }
-
- (void)pthread_mutex_unlock(&reentry_lock);
- return true;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_change_log_level
-**
-** Description Update current log level.
-**
-** Params:
-** - loglvl : 0: nothing; 1: important data only; 2: everything
-**
-** Returns -
-**
-*******************************************************************************/
-void stpropnci_change_log_level(int loglvl) {
- (void)pthread_mutex_lock(&reentry_lock);
- stpropnci_loglvl = loglvl;
- (void)pthread_mutex_unlock(&reentry_lock);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_config_settings
-**
-** Description Update configs from the conf file.
-**
-** Params:
-** - halconfig : struct containing different configs values.
-**
-** Returns -
-**
-*******************************************************************************/
-void stpropnci_config_settings(halconfig& halconfig) {
-
- stpropnci_state.mHalConfig.hal_field_timer = halconfig.hal_field_timer;
- stpropnci_state.mHalConfig.hal_activerw_timer = halconfig.hal_activerw_timer;
- stpropnci_state.mHalConfig.hal_trace_level = halconfig.hal_trace_level;
-}
-/*******************************************************************************
-**
-** Function stpropnci_tmpbuff_reset
-**
-** Description Simple helper function that clears the temporary storage of
-** messages.
-**
-** Returns none
-**
-*******************************************************************************/
-void stpropnci_tmpbuff_reset() {
- // We only reset the len value, no need to memset.
- *stpropnci_state.tmpbufflen = 0;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_deinit
-**
-** Description Caller can call this when NFC is disabled, so resources may
-** be freed.
-**
-** Returns none
-**
-*******************************************************************************/
-void stpropnci_deinit() {
- (void)pthread_mutex_lock(&reentry_lock);
- LOG_D("Deinitializing");
- isInitialized = false;
- stpropnci_modcb_fini();
- stpropnci_pump_fini();
- (void)pthread_mutex_unlock(&reentry_lock);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_process
-**
-** Description Process an NCI message.
-** This function is not reentrant; it will be blocking until a
-** previous call has
-** returned.
-**
-** Parameters
-** - dir_from_upper: if true, the payload is a CMD or DATA and coming from the
-** stack.
-** if false, it is RSP, NTF, or DATA and coming from NFCC.
-** - payload: a buffer in the caller memory space.
-** The memory can be freed after this function returns.
-** - payloadlen: the length of data inside payload buffer.
-**
-** Returns true if the message has been processed and caller can
-** discard it,
-** false if caller should forward it directly.
-**
-*******************************************************************************/
-bool stpropnci_process(bool dir_from_upper, const uint8_t* payload,
- const uint16_t payloadlen) {
- bool ret = false;
- uint8_t mt, pbf, gid, oid;
-
- (void)pthread_mutex_lock(&reentry_lock);
- if (!isInitialized) {
- LOG_E(
- "Cannot call stpropnci_process before stpropnci_init! No processing.");
- (void)pthread_mutex_unlock(&reentry_lock);
- return ret;
- }
- if (!stpropnci_state.passthrough_mode) {
- if (payloadlen > 3) {
- LOG_D("Processing (hdr:%02hhx%02hhx%02hhx%02hhx)", payload[0], payload[1],
- payload[2], payload[3]);
- } else {
- LOG_D("Processing (hdr:%02hhx%02hhx%02hhx)", payload[0], payload[1],
- payload[2]);
- }
- }
- if (dir_from_upper == MSG_DIR_FROM_NFCC) {
- // pass to pump first in case this acknowledges a sent message
- stpropnci_pump_got(payload, payloadlen, &ret);
- }
-
- // if no cb registered with the cmd already handled the response,
- // is there a generic module cb ?
- if (!ret) {
- const uint8_t* p = payload;
- NCI_MSG_PRS_HDR0(p, mt, pbf, gid);
- NCI_MSG_PRS_HDR1(p, oid);
-
- // passthrough mode ?
- if (stpropnci_state.passthrough_mode) {
- // Only accept a command to set passthrough, anything else is not
- // processed.
- if ((mt != NCI_MT_CMD) || (gid != NCI_GID_PROP) ||
- (oid != ST_PROP_NCI_OID) ||
- (payload[3] != ST_PROP_NCI_SET_LIB_PASSTHOUGH)) {
- // passthrough mode: do nothing.
- if (dir_from_upper == MSG_DIR_FROM_NFCC) {
- // post rsp & ntf to have proper logging in stpropnci_cb
- ret =
- stpropnci_pump_post(dir_from_upper, payload, payloadlen, nullptr);
- }
- (void)pthread_mutex_unlock(&reentry_lock);
- return ret;
- }
- }
-
- // if a submodule callback handles it, stop here
- ret = stpropnci_modcb_process(dir_from_upper, payload, payloadlen, mt, gid,
- oid);
- }
-
- // otherwise, pass it to the modules normally
- if (!ret) {
- if ((mt != NCI_MT_DATA) && (gid == NCI_GID_PROP)) {
- ret = stpropnci_process_prop(false, dir_from_upper, payload, payloadlen,
- mt, oid);
- } else {
- ret = stpropnci_process_std(false, dir_from_upper, payload, payloadlen,
- mt, gid, oid);
- }
- }
-
- // if no module consumed it, we still process it to have the timer management.
- if (!ret) {
- ret = stpropnci_pump_post(dir_from_upper, payload, payloadlen, nullptr);
- }
-
- (void)pthread_mutex_unlock(&reentry_lock);
- return ret;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_inform
-**
-** Description Just let the library know about a message but no handling
-** expected.
-** This is used by the HAL in its own wrapper processing.
-** This function is not reentrant; it will be blocking until
-** a previous call has returned.
-**
-** Parameters
-** - dir_from_upper: if true, the payload is a CMD or DATA and coming from the
-** stack.
-** if false, it is RSP, NTF, or DATA and coming from NFCC.
-** - payload: a buffer in the caller memory space.
-** The memory can be freed after this function returns.
-** - payloadlen: the length of data inside payload buffer.
-**
-** Returns none
-**
-*******************************************************************************/
-void stpropnci_inform(bool dir_from_upper, const uint8_t* payload,
- const uint16_t payloadlen) {
- uint8_t mt, pbf, gid, oid;
- const uint8_t* p;
-
- (void)pthread_mutex_lock(&reentry_lock);
- if (!isInitialized) {
- LOG_E("Cannot call stpropnci_inform before stpropnci_init! No processing.");
- (void)pthread_mutex_unlock(&reentry_lock);
- return;
- }
- if (stpropnci_state.passthrough_mode) {
- // just ignore
- (void)pthread_mutex_unlock(&reentry_lock);
- return;
- }
-
- if (payloadlen > 3) {
- LOG_D("Processing (hdr:%02hhx%02hhx%02hhx%02hhx)", payload[0], payload[1],
- payload[2], payload[3]);
- } else {
- LOG_D("Processing (hdr:%02hhx%02hhx%02hhx)", payload[0], payload[1],
- payload[2]);
- }
-
- p = payload;
- NCI_MSG_PRS_HDR0(p, mt, pbf, gid);
- NCI_MSG_PRS_HDR1(p, oid);
-
- if (gid == NCI_GID_PROP) {
- stpropnci_process_prop(true, dir_from_upper, payload, payloadlen, mt, oid);
- } else {
- stpropnci_process_std(true, dir_from_upper, payload, payloadlen, mt, gid,
- oid);
- }
-
- (void)pthread_mutex_unlock(&reentry_lock);
-}
diff --git a/libstpropnci/src/stpropnci_modcb.cc b/libstpropnci/src/stpropnci_modcb.cc
deleted file mode 100755
index e028a61..0000000
--- a/libstpropnci/src/stpropnci_modcb.cc
+++ /dev/null
@@ -1,292 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2025 STMicroelectronics
- *
- * 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.
- *
- ******************************************************************************/
-#include <pthread.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stpropnci-internal.h>
-
-/*******************************************************************************
-**
-** Function stpropnci_modcb_init
-**
-** Description Initialize the callback module
-**
-** Returns true if init is ok, false in case of error
-**
-*******************************************************************************/
-bool stpropnci_modcb_init() {
- (void)pthread_mutex_init(&stpropnci_state.modcbstate.modcb_mtx, nullptr);
- return true;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_modcb_fini
-**
-** Description Deinitialize the callback module, free all resources
-**
-** Returns none
-**
-*******************************************************************************/
-void stpropnci_modcb_fini() {
- void* tret = nullptr;
- int ret = 0;
- msg_t* m;
-
- // Empty the list
- (void)pthread_mutex_lock(&stpropnci_state.modcbstate.modcb_mtx);
- while (modcblist_t* m = stpropnci_state.modcbstate.modcblist.next) {
- // unlist
- stpropnci_state.modcbstate.modcblist.next = m->next;
- // free
- free(m);
- }
- while (modcblist_t* m = stpropnci_state.modcbstate.modcbpool.next) {
- // unlist
- stpropnci_state.modcbstate.modcbpool.next = m->next;
- // free
- free(m);
- }
- (void)pthread_mutex_unlock(&stpropnci_state.modcbstate.modcb_mtx);
-
- (void)pthread_mutex_destroy(&stpropnci_state.modcbstate.modcb_mtx);
-
- // We are done.
-}
-
-/*******************************************************************************
-**
-** Function modcblist_get
-**
-** Description provide a new modcblist_t item, either from pool or allocate
-** it
-**
-** Returns the new modcblist_t or nullptr in case of error
-**
-*******************************************************************************/
-static modcblist_t* modcblist_get() {
- modcblist_t* m = nullptr;
-
- /* get first from pool if any */
- (void)pthread_mutex_lock(&stpropnci_state.modcbstate.modcb_mtx);
- m = stpropnci_state.modcbstate.modcbpool.next;
- if (m != nullptr) {
- /* unlink in pool */
- stpropnci_state.modcbstate.modcbpool.next = m->next;
- }
- (void)pthread_mutex_unlock(&stpropnci_state.modcbstate.modcb_mtx);
-
- /* If the pool was empty, allocate an item */
- if (m == nullptr) {
- m = (modcblist_t*)malloc(sizeof(modcblist_t));
- }
- /* If we got an item, clean it */
- if (m != nullptr) {
- memset(m, 0, sizeof(modcblist_t));
- } else {
- LOG_E("Failed to allocate memory for registering a callback");
- }
- return m;
-}
-
-/*******************************************************************************
-**
-** Function modcblist_put
-**
-** Description return a modcblist_t item to the pool.
-**
-** Returns none
-**
-*******************************************************************************/
-static void modcblist_put(modcblist_t* m) {
- (void)pthread_mutex_lock(&stpropnci_state.modcbstate.modcb_mtx);
- m->next = stpropnci_state.modcbstate.modcbpool.next;
- stpropnci_state.modcbstate.modcbpool.next = m;
- (void)pthread_mutex_unlock(&stpropnci_state.modcbstate.modcb_mtx);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_modcb_register
-**
-** Description Register a callback function to be called on incoming
-** messages based on matching mt/gid/oid/suboid.
-**
-** Returns true if the registration succeeded.
-**
-*******************************************************************************/
-bool stpropnci_modcb_register(module_cb_t cb, bool match_mt, uint8_t mt,
- bool match_gid, uint8_t gid, bool match_oid,
- uint8_t oid, bool match_suboid, uint8_t suboid) {
- modcblist_t* li = modcblist_get();
-
- if (li == nullptr) {
- // registration failed
- return false;
- }
-
- li->cb = cb;
- li->must_match_mt = match_mt;
- li->mt = mt;
- li->must_match_gid = match_gid;
- li->gid = gid;
- li->must_match_oid = match_oid;
- li->oid = oid;
- li->must_match_suboid = match_suboid;
- li->suboid = suboid;
-
- /* add in the list. The list is not ordered, add in head for faster */
- (void)pthread_mutex_lock(&stpropnci_state.modcbstate.modcb_mtx);
- li->next = stpropnci_state.modcbstate.modcblist.next;
- stpropnci_state.modcbstate.modcblist.next = li;
- (void)pthread_mutex_unlock(&stpropnci_state.modcbstate.modcb_mtx);
-
- // done
- return true;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_modcb_unregister
-**
-** Description Unregister a callback previously registered.
-**
-** Returns none.
-**
-*******************************************************************************/
-void stpropnci_modcb_unregister(module_cb_t cb) {
- modcblist_t* li = &stpropnci_state.modcbstate.modcblist;
- modcblist_t* unlinked = nullptr;
-
- /* search and unlink if found */
- (void)pthread_mutex_lock(&stpropnci_state.modcbstate.modcb_mtx);
- while (li->next != nullptr) {
- // li->next may be the item we would unlink
- if (li->next->cb == cb) {
- unlinked = li->next;
- li->next = unlinked->next;
- unlinked->next = nullptr;
- break;
- }
- li = li->next;
- }
- (void)pthread_mutex_unlock(&stpropnci_state.modcbstate.modcb_mtx);
-
- /* if we unlinked an item, return it to the pool */
- if (unlinked != nullptr) {
- modcblist_put(unlinked);
- }
-
- // done
-}
-
-#define MAX_CBS 10
-
-/*******************************************************************************
-**
-** Function stpropnci_modcb_process
-**
-** Description Called upon incoming messages, calls matching registered
-** callbacks.
-**
-** Returns true if a callback handled the message and processing should
-** stop.
-**
-*******************************************************************************/
-bool stpropnci_modcb_process(bool dir_from_upper, const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt, uint8_t gid,
- uint8_t oid) {
- modcblist_t* li = &stpropnci_state.modcbstate.modcblist;
- modcblist_t* prev = nullptr;
- module_cb_t cbs[MAX_CBS];
- int nbcb = 0, i;
-
- bool handled = false;
- uint8_t suboid = 0;
-
- if (gid == NCI_GID_PROP) {
- switch (oid) {
- case ST_NCI_MSG_PROP:
- case ST_NCI_MSG_PROP_TEST:
- // ref ST54L datasheet
- switch (mt) {
- case NCI_MT_CMD:
- // cmd code is 1st byte of payload
- suboid = payload[3];
- break;
- case NCI_MT_NTF:
- // status followed by subcode
- suboid = payload[4];
- break;
- case NCI_MT_RSP:
- default:
- // no suboid
- suboid = 0x00;
- }
- break;
- case ST_NCI_MSG_PROP_LOADER:
- case ST_NCI_MSG_PROP_PWR_MON_RW_ON_NTF:
- case ST_NCI_MSG_PROP_PWR_MON_RW_OFF_NTF:
- // loader and monitoring has special format, there is no suboid
- suboid = 0x00;
- break;
-
- case NCI_MSG_PROP_ANDROID:
- suboid = payload[3];
- break;
- }
- }
-
- (void)pthread_mutex_lock(&stpropnci_state.modcbstate.modcb_mtx);
- while ((li->next != nullptr) && (handled == false)) {
- prev = li;
- li = li->next;
-
- /* Do we need to call this cb ? */
- if (li->must_match_mt && (li->mt != mt)) {
- continue;
- }
- if (li->must_match_gid && (li->gid != gid)) {
- continue;
- }
- if (li->must_match_oid && (li->oid != oid)) {
- continue;
- }
- if (li->must_match_suboid && (li->suboid != suboid)) {
- continue;
- }
-
- /* We'll need to call it; save the address and continue */
- cbs[nbcb++] = li->cb;
- if (nbcb == MAX_CBS) {
- LOG_E("Too many callbacks may match, discarding some");
- nbcb--;
- }
- }
- (void)pthread_mutex_unlock(&stpropnci_state.modcbstate.modcb_mtx);
-
- /* Now call each matching cb until one processes the message */
- for (i = 0; i < nbcb; i++) {
- handled = (*cbs[i])(dir_from_upper, payload, payloadlen, mt, gid, oid);
- if (handled) {
- break;
- }
- }
-
- return handled;
-}
diff --git a/libstpropnci/src/stpropnci_prop.cc b/libstpropnci/src/stpropnci_prop.cc
deleted file mode 100755
index b8a68cc..0000000
--- a/libstpropnci/src/stpropnci_prop.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2025 STMicroelectronics
- *
- * 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.
- *
- ******************************************************************************/
-#include <pthread.h>
-#include <string.h>
-#include <stpropnci-internal.h>
-
-/*******************************************************************************
-**
-** Function stpropnci_process_prop
-**
-** Description Called upon incoming messages with PROP GID,
-** dispatch to submodules based on OID
-**
-** Returns true if message was handled and processing should stop.
-**
-*******************************************************************************/
-bool stpropnci_process_prop(bool inform_only, bool dir_from_upper,
- const uint8_t *payload, const uint16_t payloadlen,
- uint8_t mt, uint8_t oid) {
- bool ret = false;
-
- switch (oid) {
- case NCI_MSG_PROP_ANDROID:
- return stpropnci_process_prop_android(inform_only, dir_from_upper,
- payload, payloadlen, mt, oid);
- break;
-
- case ST_PROP_NCI_OID:
- case ST_NCI_MSG_PROP:
- case ST_NCI_MSG_PROP_TEST:
- case ST_NCI_MSG_PROP_LOADER:
- case ST_NCI_MSG_PROP_PWR_MON_RW_ON_NTF:
- case ST_NCI_MSG_PROP_PWR_MON_RW_OFF_NTF:
- case ST_NCI_MSG_PROP_RF_OBSERVE_MODE_SUSPENDED:
- case ST_NCI_MSG_PROP_RF_OBSERVE_MODE_RESUMED:
- return stpropnci_process_prop_st(inform_only, dir_from_upper, payload,
- payloadlen, mt, oid);
- break;
- }
-
- return ret;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_build_prop_status_rsp
-**
-** Description Generic method to build a simple response with prop GID and
-** a subOID and status byte only.
-**
-** Returns none
-**
-*******************************************************************************/
-void stpropnci_build_prop_status_rsp(uint8_t *buf, uint16_t *buflen,
- uint8_t oid, uint8_t suboid,
- uint8_t status) {
- uint8_t *pp = buf, *paylen;
-
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, oid);
- paylen = pp++;
- UINT8_TO_STREAM(pp, suboid);
- UINT8_TO_STREAM(pp, status);
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-}
diff --git a/libstpropnci/src/stpropnci_prop_android.cc b/libstpropnci/src/stpropnci_prop_android.cc
deleted file mode 100755
index 2c56a1a..0000000
--- a/libstpropnci/src/stpropnci_prop_android.cc
+++ /dev/null
@@ -1,1487 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2025 STMicroelectronics
- *
- * 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.
- *
- ******************************************************************************/
-#include <pthread.h>
-#include <string.h>
-#include <stpropnci-internal.h>
-
-/* Declarations */
-static void stpropnci_build_get_caps_rsp(uint8_t *buf, uint16_t *buflen);
-
-static void stpropnci_build_get_observer_cmd(uint8_t *buf, uint16_t *buflen);
-static bool stpropnci_cb_get_observer_rsp(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t gid, uint8_t oid);
-
-static void stpropnci_build_set_config_observer_cmd(uint8_t *buf,
- uint16_t *buflen,
- uint8_t enable);
-static bool stpropnci_cb_set_config_observer_rsp(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid);
-
-static bool stpropnci_cb_generate_polling_loop_frame(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid);
-
-#define OBSERVE_ALL 0x7
-#define OBSERVE_NONE 0x0
-static void stpropnci_build_rf_set_listen_passive_observer_cmd(uint8_t *buf,
- uint16_t *buflen,
- uint8_t mode);
-static bool stpropnci_cb_rf_set_listen_passive_observer_rsp(
- bool dir_from_upper, const uint8_t *payload, const uint16_t payloadlen,
- uint8_t mt, uint8_t gid, uint8_t oid);
-
-static bool stpropnci_build_set_exit_frame_cmd(uint8_t *buf, uint16_t *buflen,
- const uint8_t *incoming,
- const uint16_t incominglen);
-static bool stpropnci_cb_set_exit_frame_rsp(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid);
-static bool stpropnci_build_set_custom_polling_cmd(uint8_t *buf,
- uint16_t *buflen,
- const uint8_t *incoming,
- const uint16_t incominglen);
-static bool stpropnci_cb_set_custom_polling_rsp(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid);
-static bool stpropnci_cb_observe_mode_suspend(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid);
-static void stpropnci_build_get_prop_config_cmd(uint8_t *buf, uint16_t *buflen);
-#ifdef NCI_ANDROID_SET_UID_AND_SAK
-static bool stpropnci_process_uid_and_sak_steps(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid);
-static void stpropnci_prop_uid_and_sak_send_rsp(uint8_t status);
-#endif // NCI_ANDROID_SET_UID_AND_SAK
-
-uint16_t iso14443_crc(const uint8_t *data, size_t szLen, int type);
-#define CRC_PRESET_A 0x6363
-#define CRC_PRESET_B 0xFFFF
-#define Type_A 0
-#define Type_B 1
-
-/*******************************************************************************
-**
-** Function stpropnci_process_prop_android
-**
-** Description This function is default handler for Android NCI
-**
-** Returns true if message was handled and does not need to be
-*forwarded
-**
-*******************************************************************************/
-bool stpropnci_process_prop_android(bool inform_only, bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t oid) {
- bool handled = false;
- stpropnci_tmpbuff_reset();
-
- switch (mt) {
- case NCI_MT_CMD:
- switch (payload[3]) {
- case NCI_ANDROID_GET_CAPS:
-
- // parse the FW information & generate a response
- stpropnci_build_get_caps_rsp(stpropnci_state.tmpbuff,
- stpropnci_state.tmpbufflen);
-
- // send this answer and don't forward the cmd to NFCC
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
-
- break;
-
- case NCI_QUERY_ANDROID_PASSIVE_OBSERVE:
-
- // Prepare the native message based on
- // stpropnci_state.observe_per_tech
- stpropnci_build_get_observer_cmd(stpropnci_state.tmpbuff,
- stpropnci_state.tmpbufflen);
-
- // send it to NFCC
- handled = stpropnci_pump_post(
- MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, stpropnci_cb_get_observer_rsp);
- break;
-
- case NCI_ANDROID_PASSIVE_OBSERVE:
- if (stpropnci_state.observe_per_tech) {
- // It can happen that the stack sends this command when
- // !useNewObserveModeCmd; In this situation, it does not disable the
- // discovery. If this happens we use the new command otherwise the
- // FW rejects. We default to mute A&B only in this scenario, as it
- // covers more real use-cases.
- stpropnci_build_rf_set_listen_passive_observer_cmd(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- (payload[4] == NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE)
- ? (NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_A |
- NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_B)
- : NCI_ANDROID_PASSIVE_OBSERVE_PARAM_DISABLE);
- } else {
- // Prepare the native message: CORE_SET_CONFIG
- stpropnci_build_set_config_observer_cmd(stpropnci_state.tmpbuff,
- stpropnci_state.tmpbufflen,
- payload[4]);
- }
-
- // send it to NFCC
- handled =
- stpropnci_pump_post(MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen,
- stpropnci_cb_set_config_observer_rsp);
- break;
-
- case NCI_ANDROID_SET_PASSIVE_OBSERVER_TECH:
-
- // Prepare the native message: RF_SET_LISTEN_OBSERVE_MODE_CMD
- stpropnci_build_rf_set_listen_passive_observer_cmd(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen, payload[4]);
-
- // send it to NFCC
- handled = stpropnci_pump_post(
- MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen,
- stpropnci_cb_rf_set_listen_passive_observer_rsp);
- break;
-
- case NCI_ANDROID_SET_PASSIVE_OBSERVER_EXIT_FRAME:
- // Prepare the native message:
- // ST_NCI_MSG_PROP_RF_SET_OBSERVE_MODE_EXIT_FRAME
- if (!stpropnci_build_set_exit_frame_cmd(stpropnci_state.tmpbuff,
- stpropnci_state.tmpbufflen,
- payload, payloadlen)) {
- // the frame was not valid.
- stpropnci_tmpbuff_reset();
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- NCI_MSG_PROP_ANDROID,
- NCI_ANDROID_SET_PASSIVE_OBSERVER_EXIT_FRAME,
- NCI_STATUS_MESSAGE_CORRUPTED);
-
- // send it back
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- } else {
- // send it to NFCC
- handled = stpropnci_pump_post(
- MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, stpropnci_cb_set_exit_frame_rsp);
- }
- break;
-
- case NCI_ANDROID_SET_TECH_A_POLLING_LOOP_ANNOTATION:
- if (!stpropnci_state.is_cust_poll_frame_set) {
- // Prepare the native message
- // ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME (add CRC)
- if (!stpropnci_build_set_custom_polling_cmd(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- payload, payloadlen)) {
- // the frame was not valid.
- stpropnci_tmpbuff_reset();
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- NCI_MSG_PROP_ANDROID,
- NCI_ANDROID_SET_TECH_A_POLLING_LOOP_ANNOTATION,
- NCI_STATUS_MESSAGE_CORRUPTED);
-
- // send it back
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- } else {
- // send it to NFCC
- handled =
- stpropnci_pump_post(MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen,
- stpropnci_cb_set_custom_polling_rsp);
- }
- } else {
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- NCI_MSG_PROP_ANDROID,
- NCI_ANDROID_SET_TECH_A_POLLING_LOOP_ANNOTATION, NCI_STATUS_OK);
-
- // send it back
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- }
- break;
-#ifdef NCI_ANDROID_SET_UID_AND_SAK
- // This command is not yet in AOSP 25Q2
- case NCI_ANDROID_SET_UID_AND_SAK:
- // Store parameters UID and SAK
- stpropnci_state.uid_length = payload[6];
- memcpy(stpropnci_state.uid, payload + 7, payload[6]);
- stpropnci_state.sak = payload[9 + payload[6]];
- LOG_D("SAK=0x%x, UID length=%d", stpropnci_state.sak,
- stpropnci_state.uid_length);
-
- stpropnci_build_get_prop_config_cmd(stpropnci_state.tmpbuff,
- stpropnci_state.tmpbufflen);
- stpropnci_state.uid_and_sak_state =
- stpropnci_state::UID_N_SAK_GET_CONFIG;
- // send it to NFCC
- handled = stpropnci_pump_post(
- MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, stpropnci_process_uid_and_sak_steps);
- break;
-#endif // NCI_ANDROID_SET_UID_AND_SAK
- case NCI_ANDROID_GET_PASSIVE_OBSERVER_EXIT_FRAME:
- // TODO ST_NCI_MSG_PROP_RF_GET_OBSERVE_MODE_EXIT_FRAME
- // don't support yet since not used by AOSP, wait for integration.
- case NCI_ANDROID_POWER_SAVING: // not used for ST
- case NCI_ANDROID_BLANK_NCI: // not supposed to reach HAL
- default:
- // ?
- LOG_E("Unsupported Android NCI subOID %02hhx", payload[3]);
-
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- NCI_MSG_PROP_ANDROID, payload[3], NCI_STATUS_NOT_SUPPORTED);
-
- // send this answer and don't forward the cmd to NFCC
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- break;
- }
- break;
- case NCI_MT_RSP:
- case NCI_MT_NTF:
- if (dir_from_upper == MSG_DIR_FROM_NFCC) {
- // If we have a legacy HAL that supported some ANDROID NCI, discard it
- // since we will generate our own here.
- LOG_D("Discard ANDROID_NCI received from LL");
- handled = true;
- break;
- }
- // This is unexpected !
- LOG_E("Unexpected RSP or NTF in NCI_ANDROID wrapper");
- break;
- }
-
- return handled;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_build_get_caps_rsp
-**
-** Description Prepare the response to GET_CAPS based on FW capabilities
-**
-** Returns none
-**
-*******************************************************************************/
-static void stpropnci_build_get_caps_rsp(uint8_t *buf, uint16_t *buflen) {
- uint8_t *pp = buf, *paylen, *nbtlv;
- uint16_t version = 0x0000;
- int fw_gen = GET_FW_GEN();
- uint8_t obsmode = 0;
- uint8_t exitframe = 0;
- uint8_t annotations = 0;
-
- if (stpropnci_state.manu_specific_info_len == 0) {
- LOG_E(
- "Android GET_CAPS received but no firmware information available yet");
- stpropnci_build_prop_status_rsp(buf, buflen, NCI_MSG_PROP_ANDROID,
- NCI_ANDROID_GET_CAPS,
- NCI_STATUS_NOT_INITIALIZED);
- return;
- }
-
- if (fw_gen < 2) {
- LOG_D("No support for Android NCI feats in this FW (gen %d)", fw_gen);
- stpropnci_build_prop_status_rsp(buf, buflen, NCI_MSG_PROP_ANDROID,
- NCI_ANDROID_GET_CAPS,
- NCI_STATUS_NOT_SUPPORTED);
- return;
- }
-
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_PROP_ANDROID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, NCI_ANDROID_GET_CAPS);
- UINT8_TO_STREAM(pp, NCI_STATUS_OK);
- UINT16_TO_STREAM(pp, version);
- nbtlv = pp++;
-
-// Passive Observe mode
-#define PASSIVE_OBSERVE_MODE 0x00
-#define PASSIVE_OBSERVE_MODE__NOT_SUPPORTED 0x00
-#define PASSIVE_OBSERVE_MODE__SUPPORT_WITH_RF_DEACTIVATION 0x01
-#define PASSIVE_OBSERVE_MODE__SUPPORT_WITHOUT_RF_DEACTIVATION 0x02
-
- UINT8_TO_STREAM(pp, PASSIVE_OBSERVE_MODE);
- UINT8_TO_STREAM(pp, 1);
- if (fw_gen == 2) {
- // Only with deactivation for gen2 firmwares
- obsmode = PASSIVE_OBSERVE_MODE__SUPPORT_WITH_RF_DEACTIVATION;
- } else if (fw_gen > 3) {
- // Next generations will support without RF deact directly
- obsmode = PASSIVE_OBSERVE_MODE__SUPPORT_WITHOUT_RF_DEACTIVATION;
- } else if (IS_HW_54L_FAMILY() && (FW_VERSION_MAJOR == 0x02)) {
- if (FW_VERSION_MINOR == 0x01) {
- // This version had a bug
- obsmode = PASSIVE_OBSERVE_MODE__NOT_SUPPORTED;
- } else if (FW_VERSION_MINOR <= 0x04) {
- // from 54L FW 2.5, observe mode per tech is supported.
- // AOSP uses per-tech if "support without rf deact" caps &&
- // "useNewObserveModeCmd" flag
- obsmode = PASSIVE_OBSERVE_MODE__SUPPORT_WITH_RF_DEACTIVATION;
- } else {
- // since 2.5, can support without deactivation
- obsmode = PASSIVE_OBSERVE_MODE__SUPPORT_WITHOUT_RF_DEACTIVATION;
- }
- } else {
- // gen 3 that is not 54L 2.x FW, assume full support.
- obsmode = PASSIVE_OBSERVE_MODE__SUPPORT_WITHOUT_RF_DEACTIVATION;
- }
- UINT8_TO_STREAM(pp, obsmode);
- *nbtlv += 1; // 1 TLV was stored.
-
- if (obsmode == PASSIVE_OBSERVE_MODE__SUPPORT_WITHOUT_RF_DEACTIVATION) {
- // Default on using new command in that case until stack sends the old one
- stpropnci_state.observe_per_tech = true;
- }
-
-// Polling frame ntf
-#define POLLING_FRAME_NTF 0x01
-#define POLLING_FRAME_NTF__NOT_SUPPORTED 0x00
-#define POLLING_FRAME_NTF__SUPPORTED 0x01
- // Register the callback to generate the polling frame ntf
- if (obsmode != PASSIVE_OBSERVE_MODE__NOT_SUPPORTED) {
- if (!stpropnci_modcb_register(stpropnci_cb_generate_polling_loop_frame,
- true, NCI_MT_NTF, true, NCI_GID_PROP, true,
- ST_NCI_MSG_PROP, true, ST_NCI_PROP_LOG)) {
- // update obsmode so we report PF not supported if we failed to register
- // cb
- obsmode = PASSIVE_OBSERVE_MODE__NOT_SUPPORTED;
- }
- }
- // Report PF support based on our observe mode support (seems not really
- // used).
- UINT8_TO_STREAM(pp, POLLING_FRAME_NTF);
- UINT8_TO_STREAM(pp, 1);
- UINT8_TO_STREAM(pp, obsmode == PASSIVE_OBSERVE_MODE__NOT_SUPPORTED
- ? POLLING_FRAME_NTF__NOT_SUPPORTED
- : POLLING_FRAME_NTF__SUPPORTED);
- *nbtlv += 1; // 1 TLV was stored.
-
-// Power saving mode
-#define POWER_SAVING_MODE 0x02
-#define POWER_SAVING_MODE__NOT_SUPPORTED 0x00
-#define POWER_SAVING_MODE__SUPPORTED 0x01
-
- // ST does not use this.
- UINT8_TO_STREAM(pp, POWER_SAVING_MODE);
- UINT8_TO_STREAM(pp, 1);
- UINT8_TO_STREAM(pp, POWER_SAVING_MODE__NOT_SUPPORTED);
- *nbtlv += 1; // 1 TLV was stored.
-
-// Autotransact polling loop filter
-#define AUTOTRANSACT_POLLING_LOOP_FILTER 0x03
-#define AUTOTRANSACT_POLLING_LOOP_FILTER__NOT_SUPPORTED 0x00
-#define AUTOTRANSACT_POLLING_LOOP_FILTER__SUPPORTED 0x01
-
- // supported from 54L 2.6 only at the moment
- if (fw_gen == 2) {
- exitframe = AUTOTRANSACT_POLLING_LOOP_FILTER__NOT_SUPPORTED;
- } else if (fw_gen > 3) {
- // Next generations will support it
- exitframe = AUTOTRANSACT_POLLING_LOOP_FILTER__SUPPORTED;
- } else if (IS_HW_54L_FAMILY() && (FW_VERSION_MAJOR == 0x02)) {
- if (FW_VERSION_MINOR <= 0x05) {
- // not yet
- exitframe = AUTOTRANSACT_POLLING_LOOP_FILTER__NOT_SUPPORTED;
- } else {
- // since 2.6, exit frame is supported
- exitframe = AUTOTRANSACT_POLLING_LOOP_FILTER__SUPPORTED;
- }
- } else {
- // gen 3 that is not 54L 2.x FW, assume full support.
- exitframe = AUTOTRANSACT_POLLING_LOOP_FILTER__SUPPORTED;
- }
-
- // Register the callbacks related to exit frame
- if (exitframe != AUTOTRANSACT_POLLING_LOOP_FILTER__NOT_SUPPORTED) {
- if (!stpropnci_modcb_register(stpropnci_cb_observe_mode_suspend, true,
- NCI_MT_NTF, true, NCI_GID_PROP, true,
- ST_NCI_MSG_PROP_RF_OBSERVE_MODE_SUSPENDED,
- false, 0)) {
- LOG_E(
- "Failed to register cb for observe mode suspend, change exit frame "
- "support to not supported.");
- exitframe = AUTOTRANSACT_POLLING_LOOP_FILTER__NOT_SUPPORTED;
- } else if (!stpropnci_modcb_register(
- stpropnci_cb_observe_mode_suspend, true, NCI_MT_NTF, true,
- NCI_GID_PROP, true, ST_NCI_MSG_PROP_RF_OBSERVE_MODE_RESUMED,
- false, 0)) {
- LOG_E(
- "Failed to register cb for observe mode resumed, change exit frame "
- "support to not supported.");
- stpropnci_modcb_unregister(stpropnci_cb_observe_mode_suspend);
- exitframe = AUTOTRANSACT_POLLING_LOOP_FILTER__NOT_SUPPORTED;
- }
- }
-
- UINT8_TO_STREAM(pp, AUTOTRANSACT_POLLING_LOOP_FILTER);
- UINT8_TO_STREAM(pp, 1);
- UINT8_TO_STREAM(pp, exitframe);
- *nbtlv += 1; // 1 TLV was stored.
-
-// Number of exit frames supported
-#define NUMBER_OF_EXIT_FRAMES_SUPPORTED 0x04
-
- UINT8_TO_STREAM(pp, NUMBER_OF_EXIT_FRAMES_SUPPORTED);
- UINT8_TO_STREAM(pp, 1);
- // stack seems don t use this yet, just align with observe mode.
- UINT8_TO_STREAM(pp,
- exitframe == AUTOTRANSACT_POLLING_LOOP_FILTER__NOT_SUPPORTED
- ? 0
- : 10); // Currently the table is limited to 10 entries
- *nbtlv += 1; // 1 TLV was stored.
-
-// Number of exit frames supported
-#define READER_MODE_ANNOTATIONS_SUPPORTED 0x05
-
- UINT8_TO_STREAM(pp, READER_MODE_ANNOTATIONS_SUPPORTED);
- UINT8_TO_STREAM(pp, 1);
- if (fw_gen == 2) {
- // Not supported
- annotations = 0x00;
- } else if (fw_gen > 3) {
- // Next generations will support
- annotations = 0x01;
- } else if (IS_HW_54L_FAMILY() && (FW_VERSION_MAJOR == 0x02)) {
- if (FW_VERSION_MINOR <= 0x05) {
- // Supported from version 2.6
- annotations = 0x00;
- } else {
- // since 2.6, can support without deactivation
- annotations = 0x01;
- }
- } else {
- // gen 3 that is not 54L 2.x FW, no support.
- annotations = 0x00;
- }
- UINT8_TO_STREAM(pp, annotations);
- *nbtlv += 1; // 1 TLV was stored.
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_build_get_observer_cmd
-**
-** Description Prepare command to read observe mode current state
-** It uses either CORE_GET_CONFIG (old) or
-*RF_GET_LISTEN_OBSERVE_MODE (new)
-** depending on the observe_per_tech flag in stpropnci_state
-**
-** Returns none
-**
-*******************************************************************************/
-static void stpropnci_build_get_observer_cmd(uint8_t *buf, uint16_t *buflen) {
- uint8_t *pp = buf, *paylen;
-
- if (stpropnci_state.observe_per_tech) {
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_RF_MANAGE);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_GET_LISTEN_OBSERVE_MODE_STATE);
- paylen = pp++;
- } else {
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_CORE);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_CORE_GET_CONFIG);
- paylen = pp++;
-
- UINT8_TO_STREAM(pp, 1 /* we set only 1 param */);
- UINT8_TO_STREAM(pp, ST_NCI_PARAM_ID_RF_DONT_ANSWER_PASSIVE_LISTEN);
- }
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_get_observer_rsp
-**
-** Description Process the response of stpropnci_build_get_observer_cmd
-**
-** Returns true if the response was handled and shall not be fwded.
-**
-*******************************************************************************/
-static bool stpropnci_cb_get_observer_rsp(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t gid, uint8_t oid) {
- uint8_t *buf = stpropnci_state.tmpbuff;
- uint16_t *buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
-
- // build the response to stack
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_PROP_ANDROID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, NCI_QUERY_ANDROID_PASSIVE_OBSERVE);
- UINT8_TO_STREAM(pp, payload[3]);
- if (payload[3] == NCI_STATUS_OK) {
- UINT8_TO_STREAM(pp, stpropnci_state.observe_per_tech
- ? (((payload[4] == OBSERVE_NONE) ||
- (stpropnci_state.observe_mode_suspended))
- ? NCI_ANDROID_PASSIVE_OBSERVE_PARAM_DISABLE
- : payload[4])
- : payload[7]);
- }
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- return stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_build_set_config_observer_cmd
-**
-** Description Prepare the CORE_SET_CONFIG for observe mode (old method)
-**
-** Returns none
-**
-*******************************************************************************/
-static void stpropnci_build_set_config_observer_cmd(uint8_t *buf,
- uint16_t *buflen,
- uint8_t enable) {
- uint8_t *pp = buf, *paylen;
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_CORE);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_CORE_SET_CONFIG);
- paylen = pp++;
-
- UINT8_TO_STREAM(pp, 1 /* we set only 1 param */);
- UINT8_TO_STREAM(pp, ST_NCI_PARAM_ID_RF_DONT_ANSWER_PASSIVE_LISTEN);
- UINT8_TO_STREAM(pp, 1 /* this param is 1 byte */);
- UINT8_TO_STREAM(pp, enable);
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_set_config_observer_rsp
-**
-** Description Process the response from CORE_SET_CONFIG (old method)
-**
-** Returns true if the response was handled and shall not be fwded.
-**
-*******************************************************************************/
-static bool stpropnci_cb_set_config_observer_rsp(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid) {
- uint8_t *buf = stpropnci_state.tmpbuff;
- uint16_t *buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
-
- // build the response to stack
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_PROP_ANDROID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, NCI_ANDROID_PASSIVE_OBSERVE);
- UINT8_TO_STREAM(pp, payload[3]);
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- return stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_generate_polling_loop_frame
-**
-** Description Generate PLF notifications when receiving FW logs.
-**
-** Returns false so the FW logs can reach additional modules as needed.
-**
-*******************************************************************************/
-#define TAG_FIELD_CHANGE 0
-#define TAG_NFC_A 1
-#define TAG_NFC_B 2
-#define TAG_NFC_F 3
-#define TAG_NFC_V 4
-#define TAG_NFC_UNKNOWN 7
-
-#define FORMAT_IS_ST21NFCD(f) (((f) & 0xF0) == 0x10)
-#define FORMAT_IS_ST54J(f) (((f) & 0xF0) == 0x20)
-#define FORMAT_IS_ST54L(f) (((f) & 0xF0) == 0x30)
-
-static bool stpropnci_cb_generate_polling_loop_frame(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid) {
- uint8_t *buf = stpropnci_state.tmpbuff;
- uint16_t *buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- uint8_t format = payload[3];
- int current_tlv_pos = 6; // position of first byte of the first TLV
- int current_tlv_length;
- int conv_tlv = 0;
- uint32_t ts = 0;
-
- stpropnci_tmpbuff_reset();
-
- // build the ntf to stack
- NCI_MSG_BLD_HDR0(pp, NCI_MT_NTF, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_PROP_ANDROID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, NCI_ANDROID_POLLING_FRAME_NTF);
-
- // Parse TLVs from the FW log notification.
- while (1) {
- uint8_t T;
- bool process = false;
-
- // Check there is a full TLV
- if (current_tlv_pos + 1 > payloadlen) break;
- current_tlv_length = payload[current_tlv_pos + 1] + 2;
- if (current_tlv_pos + current_tlv_length > payloadlen) break;
-
- // check the type
- T = payload[current_tlv_pos];
- switch (T) {
- case FWLOG_T_fieldOn:
- case FWLOG_T_fieldOff:
- stpropnci_state.pollingframe_inCE = false;
- process = true;
- break;
- case FWLOG_T_CERx:
- case FWLOG_T_CERxError:
- if (!stpropnci_state.pollingframe_inCE) {
- process = true;
- }
- break;
- case FWLOG_T_CETx:
- case FWLOG_T_Active_A:
- case FWLOG_T_Sleep_A:
- stpropnci_state.pollingframe_inCE = true;
- break;
- case FWLOG_T_fieldLevel:
- case FWLOG_T_Idle:
- stpropnci_state.pollingframe_inCE = false;
- break;
- default:
- // we are not interested in other TLVs
- break;
- }
-
- if (process) {
- uint8_t flag = 0, type = 0, gain = 0xFF, error = 0;
- int reallenidx = 0;
- uint16_t reallen = 0;
- int availlen = current_tlv_length;
-
- // Prepare the timestamp
- if ((format & 0x1) == 0 || current_tlv_length < 6) {
- ts = 0;
- } else {
- availlen -= 4;
- ts = (payload[current_tlv_pos + current_tlv_length - 4] << 24) |
- (payload[current_tlv_pos + current_tlv_length - 3] << 16) |
- (payload[current_tlv_pos + current_tlv_length - 2] << 8) |
- payload[current_tlv_pos + current_tlv_length - 1];
- if ((format & 0x30) == 0x30) {
- // ST54L: 3.95us unit
- ts = (uint32_t)(((double)((long long)ts * 1024) / 259) + 0.5);
- } else {
- // ST54J/K: 4.57us unit
- ts = (uint32_t)(((double)((long long)ts * 128) / 28) + 0.5);
- }
- }
-
- // Fill the TLV in PF based on FW log data
- switch (T) {
- case FWLOG_T_fieldOn:
- case FWLOG_T_fieldOff:
- // fill this TLV
- UINT8_TO_STREAM(pp, TAG_FIELD_CHANGE);
- UINT8_TO_STREAM(pp, flag);
- UINT8_TO_STREAM(pp, 6 /* fixed length */);
- UINT8_TO_STREAM(pp, (ts >> 24) & 0xFF);
- UINT8_TO_STREAM(pp, (ts >> 16) & 0xFF);
- UINT8_TO_STREAM(pp, (ts >> 8) & 0xFF);
- UINT8_TO_STREAM(pp, ts & 0xFF);
- UINT8_TO_STREAM(pp, gain);
- UINT8_TO_STREAM(pp, (T == FWLOG_T_fieldOn) ? 0x01 : 0x00);
- break;
-
- case FWLOG_T_CERxError:
- case FWLOG_T_CERx:
- // first byte is frame bitrate and type
- switch (payload[current_tlv_pos + 2] & 0x0F) {
- case 0x0: // unknown
- type = TAG_NFC_UNKNOWN;
- break;
- case 0x1: // A, short frame
- flag |= 0x01; // short frame
- type = TAG_NFC_A;
- break;
- case 0x2: // A, bit-oriented
- case 0x3: // A, standard
- case 0x4: // A, transparent
- case 0x5: // A, T1T
- case 0x6: // A, thinfilm
- type = TAG_NFC_A;
- break;
- case 0x7: // B, standard frame
- type = TAG_NFC_B;
- break;
- case 0x8: // F, standard frame
- case 0x9: // F, slot-aligned
- type = TAG_NFC_F;
- break;
- case 0xA: // V, standard.
- type = TAG_NFC_V;
- break;
- case 0xB: // A, enhanced frame
- type = TAG_NFC_A;
- break;
- case 0xC: // B, enhanced frame
- type = TAG_NFC_B;
- break;
- case 0xD: // A, unknown frame type
- type = TAG_NFC_A;
- break;
- default: // others are not defined
- type = TAG_NFC_UNKNOWN;
- break;
- }
-
- // 2nd byte is gain except for T=T_CERx for ST54L
- // following bytes depend on the chip and the type of TLV.
- // it always end with 2 bytes reallen then the payload
- if (FORMAT_IS_ST21NFCD(format)) {
- gain = payload[current_tlv_pos + 3];
- if (T == FWLOG_T_CERx) {
- error = 0;
- reallenidx = current_tlv_pos + 4;
- availlen -= 6;
- } else {
- error = payload[current_tlv_pos + 4];
- reallenidx = current_tlv_pos + 5;
- availlen -= 7;
- }
- } else { // 54J, 54L
- gain = (payload[current_tlv_pos + 3] & 0xF0) >> 4;
- if (T == FWLOG_T_CERx) {
- error = 0;
- if (FORMAT_IS_ST54L(format)) {
- gain = 0xFF;
- reallenidx = current_tlv_pos + 3;
- availlen -= 5;
- } else {
- reallenidx = current_tlv_pos + 5;
- availlen -= 7;
- }
- } else {
- error = payload[current_tlv_pos + 5];
- reallenidx = current_tlv_pos + 6;
- availlen -= 8;
- }
- }
- reallen = (payload[reallenidx] << 8) | payload[reallenidx + 1];
-
- if ((availlen > 2) && (reallen > availlen)) {
- // data is truncated, so our buffer 2 last bytes are the end of the
- // frame, remove them
- availlen -= 2;
- }
-
- // In case of error, consider the type is unknown.
- if (error != 0) {
- type = TAG_NFC_UNKNOWN;
- }
-
- // 54J bug on short frames
- if (FORMAT_IS_ST54J(format) && (flag & 1) && error == 0) {
- reallen = 1;
- }
-
- // Type A but not WUPA / REQA, change to unknown
- if ((type == TAG_NFC_A) && (reallen >= 1) &&
- ((payload[reallenidx + 2] != 0x26) &&
- (payload[reallenidx + 2] != 0x52))) {
- // received a type A frame that is not WUPA / REQA, change to
- // unknown.
- type = TAG_NFC_UNKNOWN;
- }
-
- // Type B but not REQB, change to unknown
- if ((type == TAG_NFC_B) && (reallen == 3) &&
- (payload[reallenidx + 2] != 0x05)) {
- type = TAG_NFC_UNKNOWN;
- }
-
- // Now prepare the TLV
- UINT8_TO_STREAM(pp, type);
- UINT8_TO_STREAM(pp, flag);
- UINT8_TO_STREAM(pp, 5 + availlen);
- UINT8_TO_STREAM(pp, (ts >> 24) & 0xFF);
- UINT8_TO_STREAM(pp, (ts >> 16) & 0xFF);
- UINT8_TO_STREAM(pp, (ts >> 8) & 0xFF);
- UINT8_TO_STREAM(pp, ts & 0xFF);
- UINT8_TO_STREAM(pp, gain);
- if (availlen > 0) {
- ARRAY_TO_STREAM(pp, payload + (reallenidx + 2), availlen);
- }
- break;
- }
-
- // Mark the TLV added in PF
- conv_tlv++;
- }
-
- // go to next TLV
- current_tlv_pos = current_tlv_pos + current_tlv_length;
- } // idx is now the number of TLVs
-
- if (conv_tlv) {
- // We have at least one PF TLV, send the message
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- if (!stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr))
- LOG_E("Failed to send one Polling Frame ntf");
- }
-
- // Always return false to let other modules process FW logs as well.
- return false;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_build_rf_set_listen_passive_observer_cmd
-**
-** Description Prepare the RF_SET_LISTEN_OBSERVE_MODE_CMD for observe mode
-*(new method)
-**
-** Returns none
-**
-*******************************************************************************/
-static void stpropnci_build_rf_set_listen_passive_observer_cmd(uint8_t *buf,
- uint16_t *buflen,
- uint8_t mode) {
- uint8_t *pp = buf, *paylen;
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_RF_MANAGE);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_SET_LISTEN_OBSERVE_MODE);
- paylen = pp++;
-
- // Mask with types we support only (e.g. remove type V)
- UINT8_TO_STREAM(pp, mode & OBSERVE_ALL);
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_rf_set_listen_passive_observer_rsp
-**
-** Description Process the response from RF_SET_LISTEN_OBSERVE_MODE_CMD
-**
-** Returns true if the response was handled and shall not be fwded.
-**
-*******************************************************************************/
-static bool stpropnci_cb_rf_set_listen_passive_observer_rsp(
- bool dir_from_upper, const uint8_t *payload, const uint16_t payloadlen,
- uint8_t mt, uint8_t gid, uint8_t oid) {
- uint8_t *buf = stpropnci_state.tmpbuff;
- uint16_t *buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
-
- // build the response to stack
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_PROP_ANDROID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, NCI_ANDROID_SET_PASSIVE_OBSERVER_TECH);
- UINT8_TO_STREAM(pp, payload[3]);
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- return stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_build_set_exit_frame_cmd
-**
-** Description Prepare the PROP_RF_SET_OBSERVE_MODE_EXIT_FRAME_CMD
-** based on Android NCI command, but some params need to be
-*remaped a bit.
-**
-** Returns none
-**
-*******************************************************************************/
-static bool stpropnci_build_set_exit_frame_cmd(uint8_t *buf, uint16_t *buflen,
- const uint8_t *incoming,
- const uint16_t incominglen) {
- const uint8_t *in;
- uint16_t crc;
- uint8_t remaining_frames;
- uint16_t remaining = incominglen;
- uint8_t *pp = buf, *paylen;
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_NCI_MSG_PROP_RF_SET_OBSERVE_MODE_EXIT_FRAME);
- paylen = pp++;
-
- // NCI_ANDROID_SET_PASSIVE_OBSERVER_EXIT_FRAME
- // subOID
- // more
- // timeout[2] // LSB, unit ms.
- // num frames
- // {
- // qualifier
- // value_len
- // power state
- // data[1~16]
- // mask[1~16]
- // }
- // ST_NCI_MSG_PROP_RF_SET_OBSERVE_MODE_EXIT_FRAME
- // more
- // timeout[2] // LSB, unit ms; values 0x64~0xFFFF
- // num frames
- // {
- // qualifier
- // value_len
- // power state
- // data[1~16] // including CRC...
- // mask[1~16]
- // }
-
- if (remaining < (3 + 4)) {
- LOG_E("NCI_ANDROID_SET_PASSIVE_OBSERVER_EXIT_FRAME too short");
- return false;
- } else if (remaining > MAX_NCI_MESSAGE_LEN) {
- // 1 entry in exit table is up to 35 bytes max in NFC FW.
- // we can support up to 10 entries ==> we may need to send in 2 messages.
- // As the length is exactly the same as Android NCI, at the moment we
- // don't support longer frames.
- LOG_E(
- "NCI_ANDROID_SET_PASSIVE_OBSERVER_EXIT_FRAME too long, not supported "
- "yet");
- return false;
- }
-
- in = incoming + 4;
- UINT8_TO_STREAM(pp, *in++); // "more"
- if (in[0] < 0x64 && in[1] == 0x00) {
- // NFC FW min timeout is 100ms
- UINT8_TO_STREAM(pp, 0x64); // "timeout[LSB]"
- UINT8_TO_STREAM(pp, 0x00); // "timeout[MSB]"
- in += 2;
- } else {
- UINT8_TO_STREAM(pp, *in++); // "timeout[LSB]"
- UINT8_TO_STREAM(pp, *in++); // "timeout[MSB]"
- }
- UINT8_TO_STREAM(pp, (remaining_frames = *in++)); // "num frames"
- remaining -= 7;
-
- while (remaining_frames) {
- uint8_t qual;
- uint8_t vallen, motiflen;
-
- if (remaining < 2) {
- LOG_E("NCI_ANDROID_SET_PASSIVE_OBSERVER_EXIT_FRAME too short");
- return false;
- }
-
- qual = *in++;
- vallen = *in++;
- motiflen = (vallen - 1) / 2;
- remaining -= 2;
- if (remaining < vallen) {
- LOG_E("NCI_ANDROID_SET_PASSIVE_OBSERVER_EXIT_FRAME too short");
- return false;
- }
-
- // Maybe add the CRC. To be discussed how to handle if there is not enough
- // space ? We will just fail at the moment. ref AOSP commit
- // ade96b0468011e6c08ce35e12dc4f6060544f84f
- crc = 0;
- if (motiflen > 15) {
- // no choice, we add "longer than" as there is not enough space to add
- // CRC.
- qual |= 0x10;
- }
-
- if ((qual & 0x10) == 0) {
- // There is no "longer than", we need to match the CRC, compute it
- switch (qual & 0x7) {
- case 0x00:
- crc = iso14443_crc(in + 1, motiflen, Type_A);
- break;
- case 0x01:
- crc = iso14443_crc(in + 1, motiflen, Type_B);
- break;
- default: // no CRC for other modes at the moment.
- break;
- }
- }
-
- // sanity check, do we have enough space to store this entry in target
- // message ?
- if ((MAX_NCI_MESSAGE_LEN - (pp - buf)) < (2 + vallen + (crc ? 4 : 0))) {
- LOG_E(
- "Failing to generate ST_NCI_MSG_PROP_RF_SET_OBSERVE_MODE_EXIT_FRAME "
- "due to CRC overheads, need to adapt the logic to split message");
- return false;
- }
-
- // if needed to remap the technologies, we could do it here
- UINT8_TO_STREAM(pp, qual); // qualifier
- UINT8_TO_STREAM(pp, vallen); // len
- if (crc == 0) {
- // we just copy the power state, data and mask as is.
- ARRAY_TO_STREAM(pp, in, vallen);
- in += vallen;
- } else {
- bool exact = true;
- UINT8_TO_STREAM(pp, *in++); // power state
- ARRAY_TO_STREAM(pp, in, motiflen); // data
- in += motiflen;
- UINT8_TO_STREAM(pp, (uint8_t)(crc & 0xFF));
- UINT8_TO_STREAM(pp, (uint8_t)(crc >> 8));
- while (motiflen--) {
- if (*in != 0xFF) {
- // At least one byte in the motif has a wildcard, so the CRC will not
- // match.
- exact = false;
- }
- UINT8_TO_STREAM(pp, *in++); // mask byte
- }
- // Add mask for the CRC bytes; it will be a match only if all bytes were
- // exact match
- UINT8_TO_STREAM(pp, exact ? 0xFF : 0x00);
- UINT8_TO_STREAM(pp, exact ? 0xFF : 0x00);
- }
-
- remaining_frames--;
- }
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- return true;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_set_exit_frame_rsp
-**
-** Description Process the response from
-*PROP_RF_SET_OBSERVE_MODE_EXIT_FRAME_CMD
-**
-** Returns true if the response was handled and shall not be fwded.
-**
-*******************************************************************************/
-static bool stpropnci_cb_set_exit_frame_rsp(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid) {
- uint8_t *buf = stpropnci_state.tmpbuff;
- uint16_t *buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
-
- // build the response to stack
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_PROP_ANDROID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, NCI_ANDROID_SET_PASSIVE_OBSERVER_EXIT_FRAME);
- UINT8_TO_STREAM(pp, payload[3]);
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- return stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_build_set_custom_polling_cmd
-**
-** Description Prepare the ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME
-** based on Android NCI command, but some params need to be
-*remaped a bit.
-**
-** Returns none
-**
-*******************************************************************************/
-static bool stpropnci_build_set_custom_polling_cmd(uint8_t *buf,
- uint16_t *buflen,
- const uint8_t *incoming,
- const uint16_t incominglen) {
- const uint8_t *in;
- uint16_t remaining = incominglen;
- uint8_t *pp = buf, *paylen;
- uint8_t nb_frames = 0, motiflen = 0;
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME);
- paylen = pp++;
-
- // Android NCI NCI_ANDROID_SET_TECH_A_POLLING_LOOP_ANNOTATION payload:
- // number of frames (0 or 1)
- // position and type, 0x21
- // len [N+3]
- // waiting time 0x0A
- // annotation_data[N bytes]
- // 0x00, 0x00 (?)
-
- // ST FW ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME
- // number of frames (0 or 1)
- // qual-type (position, response expected, tech)
- // len [N+1]
- // RFU [1B]
- // RF frame [N=1~16B]
-
- if (remaining < (3 + 2)) {
- LOG_E("NCI_ANDROID_SET_TECH_A_POLLING_LOOP_ANNOTATION too short");
- return false;
- }
-
- in = incoming + 4; // beginning of the payload
- nb_frames = *in;
- if (nb_frames > 1) {
- LOG_E(
- "NCI_ANDROID_SET_TECH_A_POLLING_LOOP_ANNOTATION unsupported number of "
- "frames");
- return false;
- }
-
- UINT8_TO_STREAM(pp, *in++); // nb_frames
- remaining -= 5;
-
- if (nb_frames) {
- uint16_t crc;
-
- if (remaining < 7) {
- LOG_E("NCI_ANDROID_SET_TECH_A_POLLING_LOOP_ANNOTATION too short");
- return false;
- }
-
- // Convert the frame content -- may need to revisit, JNI code seems not
- // aligned with definition.
-
- if (*in++ != 0x20) {
- LOG_E(
- "NCI_ANDROID_SET_TECH_A_POLLING_LOOP_ANNOTATION unsupported "
- "position/type value");
- return false;
- }
- UINT8_TO_STREAM(pp, 0x20); // position 1, no response, type A std
-
- motiflen = *in - 3;
- UINT8_TO_STREAM(
- pp,
- *in++); // length. JNI already added 3 to the payload. Spec to check...
- UINT8_TO_STREAM(pp, *in++); // RFU, (waiting time according to JNI)
-
- crc = iso14443_crc(in, motiflen, Type_A);
-
- ARRAY_TO_STREAM(pp, in, motiflen);
- in += motiflen;
-
- UINT8_TO_STREAM(pp, (uint8_t)(crc & 0xFF));
- UINT8_TO_STREAM(pp, (uint8_t)(crc >> 8));
- }
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- return true;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_set_custom_polling_rsp
-**
-** Description Process the response from
-*ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME
-**
-** Returns true if the response was handled and shall not be fwded.
-**
-*******************************************************************************/
-static bool stpropnci_cb_set_custom_polling_rsp(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid) {
- uint8_t *buf = stpropnci_state.tmpbuff;
- uint16_t *buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
-
- // build the response to stack
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_PROP_ANDROID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, NCI_ANDROID_SET_TECH_A_POLLING_LOOP_ANNOTATION);
- UINT8_TO_STREAM(pp, payload[3]);
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- return stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_observe_mode_suspend
-**
-** Description Process the ntfs related to observe mode when exit frame is
-*set
-**
-** Returns true if the response was handled and shall not be fwded.
-**
-*******************************************************************************/
-static bool stpropnci_cb_observe_mode_suspend(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid) {
- // Shall we report this to stack ?
- LOG_D("Exit frame: observe mode is %s",
- oid == ST_NCI_MSG_PROP_RF_OBSERVE_MODE_SUSPENDED ? "suspended"
- : "resumed");
-
- // This prop ntf never needs to be forwarded.
- return true;
-}
-
-/*******************************************************************************
-**
-** Function iso14443_crc
-**
-** Description Computes a CRC value needed for ST FW for exit frames
-**
-** Returns the CRC
-**
-*******************************************************************************/
-uint16_t iso14443_crc(const uint8_t *data, size_t szLen, int type) {
- uint16_t tempCrc;
- if (type == Type_A) {
- tempCrc = (unsigned short)CRC_PRESET_A;
- } else {
- tempCrc = (unsigned short)CRC_PRESET_B;
- }
- do {
- uint8_t bt;
- bt = *data++;
- bt = (bt ^ (uint8_t)(tempCrc & 0x00FF));
- bt = (bt ^ (bt << 4));
- tempCrc = (tempCrc >> 8) ^ ((uint32_t)bt << 8) ^ ((uint32_t)bt << 3) ^
- ((uint32_t)bt >> 4);
- } while (--szLen);
-
- return tempCrc;
-}
-/*******************************************************************************
-**
-** Function stpropnci_build_get_prop_config_cmd
-**
-** Description Prepare the RF_SET_LISTEN_OBSERVE_MODE_CMD for observe mode
-*(new method)
-**
-** Returns none
-**
-*******************************************************************************/
-static void stpropnci_build_get_prop_config_cmd(uint8_t *buf,
- uint16_t *buflen) {
- // Build PROP_GET_CONFIG command to retrieve NDEF-NFCEE config
- uint8_t *pp = buf, *paylen;
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_NCI_MSG_PROP);
- paylen = pp++;
-
- UINT8_TO_STREAM(pp, 0x03); // PROP_GET_CONFIG
- UINT8_TO_STREAM(pp, 0x00);
- UINT8_TO_STREAM(pp, 0x04); // NDEF-NFCEE
- UINT8_TO_STREAM(pp, 0x01);
- UINT8_TO_STREAM(pp, 0x00);
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-}
-
-#ifdef NCI_ANDROID_SET_UID_AND_SAK
-/*******************************************************************************
-**
-** Function stpropnci_process_uid_and_sak_steps
-**
-** Description Process the response from
-*ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME
-**
-** Returns true if the response was handled and shall not be fwded.
-**
-*******************************************************************************/
-static bool stpropnci_process_uid_and_sak_steps(bool dir_from_upper,
- const uint8_t *payload,
- const uint16_t payloadlen,
- uint8_t mt, uint8_t gid,
- uint8_t oid) {
- uint8_t *buf = stpropnci_state.tmpbuff;
- uint16_t *buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
- // Check status code of last response
- if (payload[3] != NCI_STATUS_OK) {
- stpropnci_prop_uid_and_sak_send_rsp(payload[3]);
- return true;
- }
- if (stpropnci_state.uid_and_sak_state ==
- stpropnci_state::UID_N_SAK_GET_CONFIG) {
- LOG_D("Received PROP_GET_CONFIG_RSP");
- // Got RSP to PROP_GET_CONFIG, modify values and call PROP_SET_CONFIG
- stpropnci_state.uid_and_sak_state = stpropnci_state::UID_N_SAK_SET_CONFIG;
-
- uint8_t ndef_ncfee_config[payload[6]];
- memcpy(ndef_ncfee_config, payload + 7, payload[6]);
- ndef_ncfee_config[20] = stpropnci_state.uid_length;
- ndef_ncfee_config[26] = stpropnci_state.sak;
- for (int i = 0; i < stpropnci_state.uid_length; i++) {
- ndef_ncfee_config[72 + i] = stpropnci_state.uid[i];
- }
-
- // build the response to stack
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_NCI_MSG_PROP);
- paylen = pp++;
-
- UINT8_TO_STREAM(pp, 0x04); // PROP_SET_CONFIG
- UINT8_TO_STREAM(pp, 0x00);
- UINT8_TO_STREAM(pp, 0x04); // NDEF-NFCEE
- UINT8_TO_STREAM(pp, 0x01);
- UINT8_TO_STREAM(pp, 0x00); // Param Id
- UINT8_TO_STREAM(pp, payload[6]); // Length
- ARRAY_TO_STREAM(pp, ndef_ncfee_config, payload[6]);
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- return stpropnci_pump_post(MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen,
- stpropnci_process_uid_and_sak_steps);
- } else if (stpropnci_state.uid_and_sak_state ==
- stpropnci_state::UID_N_SAK_SET_CONFIG) {
- LOG_D("Received PROP_SET_CONFIG_RSP");
- // Got RSP to PROP_SET_CONFIG, send ANDROID RSP
- stpropnci_prop_uid_and_sak_send_rsp(NCI_STATUS_OK);
- } else {
- // Unknown, send failed ANDROID RSP
- stpropnci_prop_uid_and_sak_send_rsp(NCI_STATUS_FAILED);
- }
- return true;
-}
-/*******************************************************************************
-**
-** Function stpropnci_prop_uid_and_sak_send_rsp
-**
-** Description Generate a GET_RESO_FREQ response with error code
-**
-** Returns n/a
-**
-*******************************************************************************/
-static void stpropnci_prop_uid_and_sak_send_rsp(uint8_t status) {
- uint8_t *buf = stpropnci_state.tmpbuff;
- uint16_t *buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_state.uid_and_sak_state = stpropnci_state::UID_N_SAK_GET_CONFIG;
-
- stpropnci_tmpbuff_reset();
-
- // send rsp to stack
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_PROP_ANDROID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, NCI_ANDROID_SET_UID_AND_SAK);
- UINT8_TO_STREAM(pp, status);
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- if (!stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr)) {
- LOG_E("Failed to send error response to stack");
- }
-}
-#endif // NCI_ANDROID_SET_UID_AND_SAK
diff --git a/libstpropnci/src/stpropnci_prop_st.cc b/libstpropnci/src/stpropnci_prop_st.cc
deleted file mode 100755
index 0f8d988..0000000
--- a/libstpropnci/src/stpropnci_prop_st.cc
+++ /dev/null
@@ -1,1214 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2025 STMicroelectronics
- *
- * 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.
- *
- ******************************************************************************/
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stpropnci-internal.h>
-#include <nfa_hci_defs.h>
-#include <nfc_api.h>
-
-static bool stpropnci_prop_st_cb_apdu_gate_atr(const uint8_t* payload,
- const uint16_t payloadlen);
-static bool stpropnci_cb_get_apdu_info(bool dir_from_upper,
- const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t gid, uint8_t oid);
-bool stpropnci_prop_st_send_hci(uint8_t pipe_id, uint8_t type,
- uint8_t instruction, uint16_t msg_len,
- const uint8_t* p_msg,
- bool (*hci_cb)(const uint8_t* payload,
- const uint16_t payloadlen));
-bool stpropnci_prop_st_hci_reassembly_cb(bool dir_from_upper,
- const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t gid, uint8_t oid);
-static bool stpropnci_prop_st_cb_apdu_gate_transceive(
- const uint8_t* payload, const uint16_t payloadlen);
-void parse_fw_ntf(const uint8_t* payload, const uint16_t payloadlen);
-void eseMonitor(uint8_t format, uint16_t data_len, const uint8_t* p_data,
- bool last);
-static bool stpropnci_prop_st_cb_set_custom_polling_rsp(
- bool dir_from_upper, const uint8_t* payload, const uint16_t payloadlen,
- uint8_t mt, uint8_t gid, uint8_t oid);
-static bool stpropnci_prop_st_build_set_custom_polling_cmd(
- uint8_t* buf, uint16_t* buflen, const uint8_t* incoming,
- const uint16_t incominglen);
-extern uint16_t iso14443_crc(const uint8_t* data, size_t szLen, int type);
-
-static bool stpropnci_cb_disable_ese_rsp(bool dir_from_upper,
- const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t gid, uint8_t oid);
-static bool stpropnci_cb_reset_ese_rsp(bool dir_from_upper,
- const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t gid, uint8_t oid);
-
-static const uint8_t ESE_ATR_REG_IDX = 0x01;
-static const uint8_t EVT_SE_SOFT_RESET = 0x11;
-static const uint8_t EVT_WTX_REQUEST = 0x11;
-static const uint8_t EVT_TRANSMIT_DATA = 0x10;
-
-/*******************************************************************************
-**
-** Function stpropnci_process_prop_st
-**
-** Description This function is default handler for ST NCI
-**
-** Returns true if message was handled and does not need to be
-*forwarded
-**
-*******************************************************************************/
-bool stpropnci_process_prop_st(bool inform_only, bool dir_from_upper,
- const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t oid) {
- bool handled = false;
- uint8_t* buf = stpropnci_state.tmpbuff;
- uint16_t* buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
-
- if (inform_only) {
- // Process the updates as needed
-
- return false;
- }
-
- switch (mt) {
- case NCI_MT_CMD:
- /*********************************************************************/
- /*** CMD ***/
- /*********************************************************************/
- if (dir_from_upper != MSG_DIR_FROM_STACK) {
- LOG_E(" Unexpected CMD coming from NFCC");
- return false;
- }
- switch (oid) {
- case ST_PROP_NCI_OID: // command from extensions
- /******************* NFC OEM ext CMD ***********************/
- switch (payload[3]) {
- case ST_PROP_NCI_SET_LIB_PASSTHOUGH: {
- LOG_I("Set passthrough mode: %02hhx", payload[4]);
- stpropnci_state.passthrough_mode = (payload[4] == 0x01);
- // and respond
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_NCI_SET_LIB_PASSTHOUGH);
- UINT8_TO_STREAM(pp, NCI_STATUS_OK);
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- } break;
-
- case ST_PROP_NCI_GET_STPROPNCI_VERSION_SUBOID: {
- uint16_t version = STPROPNCI_LIB_VERSION;
-
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_NCI_GET_STPROPNCI_VERSION_SUBOID);
- UINT8_TO_STREAM(pp, NCI_STATUS_OK);
- UINT8_TO_STREAM(pp, (version >> 8) & 0xFF);
- UINT8_TO_STREAM(pp, version & 0xFF);
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it back
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- } break;
-
- case ST_PROP_NCI_GET_MANUF_DATA_SUBOID: {
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_NCI_GET_MANUF_DATA_SUBOID);
- if (stpropnci_state.manu_specific_info_len > 0) {
- UINT8_TO_STREAM(pp, NCI_STATUS_OK);
- ARRAY_TO_STREAM(pp, stpropnci_state.manu_specific_info,
- stpropnci_state.manu_specific_info_len);
- } else {
- UINT8_TO_STREAM(pp, NCI_STATUS_NOT_INITIALIZED);
- }
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it back
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- } break;
-
- case ST_PROP_NCI_GET_NFCEE_ID_LIST: {
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_NCI_GET_NFCEE_ID_LIST);
-
- if (stpropnci_state.nb_active_nfcees > 0) {
- UINT8_TO_STREAM(pp, NCI_STATUS_OK);
- UINT8_TO_STREAM(pp, stpropnci_state.nb_active_nfcees);
- ARRAY_TO_STREAM(pp, stpropnci_state.active_nfcee_ids,
- stpropnci_state.nb_active_nfcees);
- } else {
- UINT8_TO_STREAM(pp, NCI_STATUS_FAILED);
- }
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it back
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- } break;
-
- case ST_PROP_NCI_SETUP_ADPU_GATE: {
- if (stpropnci_state.apdu_gate_ready) {
- // Send SOFT RESET
- if (!stpropnci_prop_st_send_hci(
- stpropnci_state.apdu_pipe_id & 0x7F, NFA_HCI_EVENT_TYPE,
- EVT_SE_SOFT_RESET, 0, nullptr, nullptr)) {
- LOG_E("Send HCI message failed");
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- ST_PROP_NCI_OID, payload[3], NCI_STATUS_FAILED);
- // send it back
- handled = stpropnci_pump_post(
- MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- break;
- }
-
- // Send GET ATR
- uint8_t get_atr[] = {ESE_ATR_REG_IDX};
- if (!stpropnci_prop_st_send_hci(
- stpropnci_state.apdu_pipe_id & 0x7F,
- NFA_HCI_COMMAND_TYPE, NFA_HCI_ANY_GET_PARAMETER,
- sizeof(get_atr), get_atr,
- stpropnci_prop_st_cb_apdu_gate_atr)) {
- LOG_E(" Send HCI message failed");
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- ST_PROP_NCI_OID, payload[3], NCI_STATUS_FAILED);
- // send it back
- handled = stpropnci_pump_post(
- MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- break;
- }
- handled = true;
- } else {
- LOG_E(" APDU gate not functional");
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- ST_PROP_NCI_OID, payload[3], NCI_STATUS_FAILED);
- // send it back
- handled = stpropnci_pump_post(
- MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- }
- } break;
-
- case ST_PROP_NCI_TRANSCEIVE_ADPU_GATE: {
- if (stpropnci_state.apdu_gate_ready) {
- if (!stpropnci_prop_st_send_hci(
- stpropnci_state.apdu_pipe_id & 0x7F, NFA_HCI_EVENT_TYPE,
- EVT_TRANSMIT_DATA, payloadlen - 4, (payload + 4),
- stpropnci_prop_st_cb_apdu_gate_transceive)) {
- LOG_E("Send HCI message failed");
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- ST_PROP_NCI_OID, payload[3], NCI_STATUS_FAILED);
- // send it back
- handled = stpropnci_pump_post(
- MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- break;
- } else {
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- ST_PROP_NCI_OID, payload[3], NCI_STATUS_OK);
- // send it back
- handled = stpropnci_pump_post(
- MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- }
- } else {
- LOG_E(" APDU gate not functional");
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- ST_PROP_NCI_OID, payload[3], NCI_STATUS_FAILED);
- // send it back
- handled = stpropnci_pump_post(
- MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- }
- } break;
-
- case ST_PROP_EMULATE_NFC_A_CARD_2: {
- stpropnci_state.is_card_a_on =
- ((payload[4] & 0xFF) == 0x01 ? true : false);
-
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_EMULATE_NFC_A_CARD_2);
- UINT8_TO_STREAM(pp, NCI_STATUS_OK);
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it back
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- } break;
-
- case ST_PROP_SET_FELICA_CARD_ENABLED:
- stpropnci_state.is_ese_felica_enabled =
- ((payload[4] & 0xFF) == 0x01 ? true : false);
-
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_SET_FELICA_CARD_ENABLED);
- UINT8_TO_STREAM(pp, NCI_STATUS_OK);
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it back
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- break;
-
- case ST_PROP_SET_RF_CUSTOM_POLL_FRAME:
- stpropnci_state.is_cust_poll_frame_set =
- ((payload[4] & 0xFF) >= 0x01 ? true : false);
- stpropnci_state.is_rf_intf_cust_tx = false;
- // Prepare the native message
- // ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME (add CRC)
- if (!stpropnci_prop_st_build_set_custom_polling_cmd(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- payload, payloadlen)) {
- // the frame was not valid.
- stpropnci_tmpbuff_reset();
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- ST_PROP_NCI_OID, ST_PROP_SET_RF_CUSTOM_POLL_FRAME,
- NCI_STATUS_MESSAGE_CORRUPTED);
-
- // send it back
- handled = stpropnci_pump_post(
- MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- } else {
- // send it to NFCC
- handled = stpropnci_pump_post(
- MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen,
- stpropnci_prop_st_cb_set_custom_polling_rsp);
- }
- break;
-
- default:
- LOG_I("ST OID(1) suboid %02hhx not supported", payload[3]);
- stpropnci_build_prop_status_rsp(
- stpropnci_state.tmpbuff, stpropnci_state.tmpbufflen,
- ST_PROP_NCI_OID, payload[3], NCI_STATUS_NOT_SUPPORTED);
-
- // send it back
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- }
- break;
-
- case ST_NCI_MSG_PROP:
- /******************* NFC ST NCI PROP ***********************/
- switch (payload[3]) {
- case ST_NCI_PROP_GET_CONFIG:
- if (payload[4] == ST_NCI_PROP_GET_CONFIG__ESE_ATTR_ID) {
- handled =
- stpropnci_pump_post(MSG_DIR_TO_NFCC, payload, payloadlen,
- stpropnci_cb_get_apdu_info);
- } else if (payload[4] & 0x08) {
- // Retrieve pipe list for another SE, expected, just
- // passthrough.
- handled =
- stpropnci_pump_post(MSG_DIR_TO_NFCC, payload, payloadlen,
- stpropnci_cb_passthrough_rsp);
- } else {
- // Another config, not used so far
- LOG_I(
- "Received ST FW prop command from stack, unexpected but "
- "let it passthrough");
- handled =
- stpropnci_pump_post(MSG_DIR_TO_NFCC, payload, payloadlen,
- stpropnci_cb_passthrough_rsp);
- }
- break;
- default:
- LOG_I(
- "Received ST FW prop command from stack, unexpected but let "
- "it "
- "passthrough");
- handled =
- stpropnci_pump_post(MSG_DIR_TO_NFCC, payload, payloadlen,
- stpropnci_cb_passthrough_rsp);
- break;
- }
- break;
-
- default:
- /******************* default ***********************/
- LOG_I(
- "Received ST prop command from stack, unexpected but let it "
- "passthrough");
- handled = stpropnci_pump_post(MSG_DIR_TO_NFCC, payload, payloadlen,
- stpropnci_cb_passthrough_rsp);
-
- break;
- }
- break;
-
- case NCI_MT_RSP:
- /*********************************************************************/
- /*** RSP ***/
- /*********************************************************************/
- LOG_E(" Unexpected RSP to process, should be always via cb. let through");
- return false;
-
- case NCI_MT_NTF:
- /*********************************************************************/
- /*** NTF ***/
- /*********************************************************************/
- if (dir_from_upper != MSG_DIR_FROM_NFCC) {
- LOG_E(" Unexpected NTF coming from stack, let it go");
- return false;
- }
-
- switch (oid) {
- case ST_NCI_MSG_PROP_PWR_MON_RW_ON_NTF:
- stpropnci_state.pwr_mon_isActiveRW = true;
- stpropnci_state.pwr_mon_errorCount = 0;
- handled = true;
- break;
-
- case ST_NCI_MSG_PROP_PWR_MON_RW_OFF_NTF:
- stpropnci_pump_watchdog_remove(WD_ACTIVE_RW_TOO_LONG);
- if (stpropnci_state.pwr_mon_isActiveRW) {
- stpropnci_state.pwr_mon_isActiveRW = false;
- } else {
- if (stpropnci_state.pwr_mon_errorCount++ > 20) {
- LOG_E("Too many PWR_MON_RW_OFF without ON, recovery");
- if (!stpropnci_send_core_reset_ntf_recovery(0)) {
- LOG_E("Failed to send CORE_RESET_NTF, critical failure");
- abort();
- }
- }
- }
- handled = true;
- break;
-
- case ST_NCI_MSG_PROP_RF_OBSERVE_MODE_SUSPENDED:
- stpropnci_state.observe_mode_suspended = true;
- // send NCI_ANDROID_PASSIVE_OBSERVER_SUSPENDED_NTF
- NCI_MSG_BLD_HDR0(pp, NCI_MT_NTF, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_PROP_ANDROID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, NCI_ANDROID_PASSIVE_OBSERVER_SUSPENDED_NTF);
-
- // Add the content of the notif but remove 2 bytes of the CRC
- {
- const uint8_t* in = payload + 3;
- uint8_t motiflen;
- UINT8_TO_STREAM(pp, *in++); // type byte
- motiflen = *in++ - 2;
- UINT8_TO_STREAM(pp, motiflen); // length byte
- ARRAY_TO_STREAM(pp, in, motiflen); // matching motif except the CRC
- }
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- break;
-
- case ST_NCI_MSG_PROP_RF_OBSERVE_MODE_RESUMED:
- stpropnci_state.observe_mode_suspended = false;
- // send NCI_ANDROID_PASSIVE_OBSERVER_RESUMED_NTF
- NCI_MSG_BLD_HDR0(pp, NCI_MT_NTF, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_PROP_ANDROID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, NCI_ANDROID_PASSIVE_OBSERVER_RESUMED_NTF);
- // no payload in this one
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- break;
-
- case ST_NCI_MSG_PROP:
- /******************* NFC ST NCI PROP ***********************/
- switch (payload[4]) {
- case ST_NCI_PROP_LOG:
- // Parse FW NTF
- parse_fw_ntf(payload, payloadlen);
-
- // We have no further processing at the moment.
- // we may add more workarounds here later.
- handled = true;
- break;
-
- default:
- LOG_I("ST Prop NTF not processed, but block it");
- handled = true;
- break;
- }
- break;
-
- default:
- /******************* default ***********************/
- LOG_I("ST Prop NTF not processed, but block it");
- handled = true;
- break;
- }
- break;
- }
-
- return handled;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_st_set_hal_passthrough
-**
-** Description Instruct lower lib to stop processing.
-**
-** Returns true
-**
-*******************************************************************************/
-void stpropnci_st_set_hal_passthrough() {
-#ifdef STPROPNCI_VENDOR
- LOG_E("This method shall not be called in VENDOR version");
-#else // STPROPNCI_VENDOR
- uint8_t* buf = stpropnci_state.tmpbuff;
- uint16_t* buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
-
- // send NCI_ANDROID_PASSIVE_OBSERVER_SUSPENDED_NTF
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_NCI_SET_LIB_PASSTHOUGH);
- UINT8_TO_STREAM(pp, 0x01); // enable passthrough
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- (void)stpropnci_pump_post(MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen,
- stpropnci_cb_block_rsp);
-#endif // STPROPNCI_VENDOR
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_get_apdu_info
-**
-** Description Save pipes information.
-**
-** Returns true if success
-**
-*******************************************************************************/
-static bool stpropnci_cb_get_apdu_info(bool dir_from_upper,
- const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t gid, uint8_t oid) {
- // Check status
- if (payload[3] != 0x00) {
- LOG_E(" status NOK");
- } else {
- // Check if APDU gate if ready for use
- int i = 0;
- int nb_entry = payload[6] / 12;
- stpropnci_state.apdu_gate_ready = false;
-
- while (i < nb_entry) {
- if (payload[12 * i + 12] != 0) {
- if ((payload[12 * i + 8] == 0xf0) && (payload[12 * i + 12] == 0x06)) {
- stpropnci_state.apdu_gate_ready = true;
- stpropnci_state.apdu_pipe_id = payload[12 * i + 11];
- LOG_I(" Found functional APDU gate, pipeId=0x%x",
- stpropnci_state.apdu_pipe_id);
- break;
- }
- }
- i++;
- }
- }
-
- return stpropnci_pump_post(MSG_DIR_TO_STACK, payload, payloadlen, nullptr);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_prop_st_cb_apdu_gate_atr
-**
-** Description If we let a command passthrough, let the rsp as well.
-**
-** Returns true
-**
-*******************************************************************************/
-static bool stpropnci_prop_st_cb_apdu_gate_atr(const uint8_t* payload,
- const uint16_t payloadlen) {
- // Try and get the BWI value in ATR response
- uint8_t bwi_idx = 3 /*1*/, level = 1, nb_bit_set, bwi;
- stpropnci_state.tx_waiting_time = 0xFF;
- int status = NCI_STATUS_OK;
- uint8_t* buf = stpropnci_state.tmpbuff;
- uint16_t* buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
-
- if (payload[1] == 0x80) {
- while (level != 3) // BWI is 4MSB of TB3
- {
- nb_bit_set = 0;
- for (int i = 0; i < 4; i++) // Check bitmap (T0 or TDi)
- {
- if (payload[bwi_idx] & (0x10 << i)) {
- nb_bit_set++;
- }
- }
-
- // Check that there is a bitmap for next level until level 3, i.e.
- // there is a TDi
- if (payload[bwi_idx] & 0x80) {
- level++;
- } else
- // No next level(TDi, i={1, 2}), exit
- break;
-
- bwi_idx += nb_bit_set;
- }
-
- if (level == 3) // Level 3 reached
- {
- nb_bit_set = 0;
- // Check if TA3 is here, is so, go next byte
- if (payload[bwi_idx] & 0x10) {
- nb_bit_set++;
- }
- // TB3 here? BWI is in there. Update mBwi value.
- if (payload[bwi_idx] & 0x20) {
- nb_bit_set++;
- bwi_idx += nb_bit_set;
- bwi = (payload[bwi_idx] & 0xF0) >> 4;
- stpropnci_state.tx_waiting_time = (0x1 << bwi) * 100; // in ms
- stpropnci_state.tx_waiting_time =
- (stpropnci_state.tx_waiting_time * 10) /
- 3; // eSE clock may run at 30%
- LOG_I(" APDU gate waiting time=%d", stpropnci_state.tx_waiting_time);
- }
- }
- } else {
- status = NCI_STATUS_FAILED;
- }
-
- // Prepare RSP for ST OEM Ext
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_NCI_SETUP_ADPU_GATE);
- UINT8_TO_STREAM(pp, status);
- UINT8_TO_STREAM(pp, stpropnci_state.tx_waiting_time >> 8);
- UINT8_TO_STREAM(pp, stpropnci_state.tx_waiting_time & 0xFF);
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it back
- return stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_prop_st_cb_apdu_gate_transceive
-**
-** Description If we let a command passthrough, let the rsp as well.
-**
-** Returns true
-**
-*******************************************************************************/
-static bool stpropnci_prop_st_cb_apdu_gate_transceive(
- const uint8_t* payload, const uint16_t payloadlen) {
- int status = NCI_STATUS_OK;
- uint8_t* buf = stpropnci_state.tmpbuff;
- uint16_t* buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
- uint8_t type, instruction;
-
- stpropnci_tmpbuff_reset();
- LOG_D("0x%x 0x%x 0x%x", payload[0], payload[1], payload[2]);
-
- if ((payload[0] & 0x7F) != stpropnci_state.apdu_pipe_id) {
- LOG_E("HCI data not from APDU pipe");
- return false;
- }
- type = payload[1] >> 6;
- instruction = (payload[1] & 0x3F);
- if (type != NFA_HCI_EVENT_TYPE) {
- LOG_E("Not NFA_HCI_EVENT_TYPE");
- return false;
- }
-
- // Prepare NTF for ST OEM Ext
- NCI_MSG_BLD_HDR0(pp, NCI_MT_NTF, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_NCI_TRANSCEIVE_ADPU_GATE);
- UINT8_TO_STREAM(pp, NFC_STATUS_OK);
- if (instruction == EVT_TRANSMIT_DATA) {
- ARRAY_TO_STREAM(pp, (payload + 2), payloadlen - 2);
- }
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it back
- return stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_prop_st_hciu_send_msg
-**
-** Description This function will fragment the given packet, if necessary
-** and send it on the given pipe.
-**
-** Returns status
-**
-*******************************************************************************/
-bool stpropnci_prop_st_send_hci(uint8_t pipe_id, uint8_t type,
- uint8_t instruction, uint16_t msg_len,
- const uint8_t* p_msg,
- bool (*hci_cb)(const uint8_t* payload,
- const uint16_t payloadlen)) {
- NFC_HDR* p_buf;
- uint8_t* p_data;
- bool first_pkt = true;
- uint16_t data_len;
- int cb = 0;
-
- // As described in DS: The maximum payload length of an NCI Data Packet
- // Size of NCI header is not included
- uint16_t max_seg_hcp_pkt_size = 255;
-
- if ((msg_len != 0) && (p_msg == nullptr)) {
- LOG_E(" msg_len is 0 and p_msg is null");
- return false;
- }
-
- if (hci_cb != nullptr) {
- if (stpropnci_state.hci_rsp_cb != nullptr) {
- LOG_E(" HCI CB function already registered");
- return false;
- }
- if (!stpropnci_modcb_register(stpropnci_prop_st_hci_reassembly_cb, true,
- NCI_MT_DATA, true, NFC_HCI_CONN_ID, false,
- 0x00, false, 0)) {
- LOG_E(" Error registering HCI cb function");
- return false;
- }
- // Reset pointer for reassembly to beginning of reassembly buff
- stpropnci_state.hci_reassembly_p = stpropnci_state.hci_reassembly_buff;
- stpropnci_state.hci_rsp_cb = hci_cb;
- }
-
- while ((first_pkt == true) || (msg_len != 0)) {
- /* First packet has a 2-byte header, subsequent fragments have a 1-byte
- * header */
- data_len =
- first_pkt ? (max_seg_hcp_pkt_size - 2) : (max_seg_hcp_pkt_size - 1);
-
- // Initialize pointer
- p_data = stpropnci_state.tmpbuff;
- stpropnci_tmpbuff_reset();
-
- /* Last or only segment has "no fragmentation" bit set */
- if (msg_len > data_len) {
- cb = 0;
- } else {
- data_len = msg_len;
- cb = 1;
- }
-
- /* build NCI Data packet header */
- NCI_DATA_PBLD_HDR(p_data, 0, NFC_HCI_CONN_ID,
- data_len + (first_pkt ? 2 : 1));
-
- *p_data++ = (cb << 7) | (pipe_id & 0x7F);
-
- /* Message header only goes in the first segment */
- if (first_pkt) {
- first_pkt = false;
- *p_data++ = (type << 6) | instruction;
- }
-
- if (data_len > 0) {
- memcpy(p_data, p_msg, data_len);
- p_data += data_len;
- }
- msg_len -= data_len;
- p_msg += data_len;
-
- *stpropnci_state.tmpbufflen = p_data - stpropnci_state.tmpbuff;
-
- stpropnci_state.hci_cr_cnt++;
-
- if (!stpropnci_pump_post(MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr)) {
- LOG_E(" Failed to send fragment");
- return false;
- }
- }
-
- return true;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_hci_reassembly_cb
-**
-** Description This function will fragment the given packet, if necessary
-** and send it on the given pipe.
-**
-** Returns status
-**
-*******************************************************************************/
-bool stpropnci_prop_st_hci_reassembly_cb(bool dir_from_upper,
- const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t gid, uint8_t oid) {
- const uint8_t* pp;
- uint8_t cb, pbf, cid, instruction;
- uint8_t *ps, *pd;
- uint16_t size;
- uint16_t len;
- bool handled = false, first = (stpropnci_state.hci_reassembly_p ==
- stpropnci_state.hci_reassembly_buff);
- pp = payload;
-
- NCI_DATA_PRS_HDR(pp, pbf, cid, len);
-
- if (cid != NFC_HCI_CONN_ID) {
- LOG_D("not HCI data, dropping");
- return false;
- }
-
- cb = (pp[0] & 0x80) ? 1 : 0;
- if (!first) {
- // Skip first byte
- pp++;
- len--;
- }
- if (stpropnci_state.hci_reassembly_p - stpropnci_state.hci_reassembly_buff >
- MAX_HCI_RECEIVE_LEN - len) {
- LOG_E("too much HCI data, truncate");
- cb = 1;
- } else {
- memcpy(stpropnci_state.hci_reassembly_p, pp, len);
- stpropnci_state.hci_reassembly_p += len;
- }
- handled = true;
-
- // last fragment
- if (cb == 1) {
- handled = (*stpropnci_state.hci_rsp_cb)(
- stpropnci_state.hci_reassembly_buff,
- stpropnci_state.hci_reassembly_p - stpropnci_state.hci_reassembly_buff);
-
- // DO not unregister if EVT_WTX
- instruction = stpropnci_state.hci_reassembly_buff[1] & 0x3F;
- if (instruction != EVT_WTX_REQUEST) {
- stpropnci_state.hci_rsp_cb = nullptr;
- stpropnci_modcb_unregister(stpropnci_prop_st_hci_reassembly_cb);
- }
-
- stpropnci_state.hci_reassembly_p = stpropnci_state.hci_reassembly_buff;
- }
-
- return handled;
-}
-
-/*******************************************************************************
-**
-** Function parse_fw_ntf
-**
-** Description This function will fragment the given packet, if necessary
-** and send it on the given pipe.
-**
-** Returns status
-**
-*******************************************************************************/
-void parse_fw_ntf(const uint8_t* payload, const uint16_t payloadlen) {
- int current_tlv_pos = 6;
- int current_tlv_length;
-
- while (1) {
- if (current_tlv_pos + 1 > payloadlen) break;
- current_tlv_length = payload[current_tlv_pos + 1] + 2;
- if (current_tlv_pos + current_tlv_length > payloadlen) break;
-
- // check that eSE behavior is OK ( no repeat frames)
- eseMonitor(payload[3], current_tlv_length, payload + current_tlv_pos,
- current_tlv_pos + current_tlv_length >= payloadlen);
-
- // go to next TLV
- current_tlv_pos = current_tlv_pos + current_tlv_length;
- }
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_build_set_custom_polling_cmd
-**
-** Description Prepare the ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME
-** based on Android NCI command, but some params need to be
-*remaped a bit.
-**
-** Returns none
-**
-*******************************************************************************/
-static bool stpropnci_prop_st_build_set_custom_polling_cmd(
- uint8_t* buf, uint16_t* buflen, const uint8_t* incoming,
- const uint16_t incominglen) {
- const uint8_t* in;
- uint16_t remaining = incominglen;
- uint8_t *pp = buf, *paylen;
- uint8_t nb_frames = 0, motiflen = 0, frame_type = 0, is_crc = 0;
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_PROP); // idx 0
- NCI_MSG_BLD_HDR1(pp, ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME); // idx
- // 1
- paylen = pp++; // idx 2
-
- if (remaining < (3 + 2)) {
- LOG_E("ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME too short");
- return false;
- }
-
- in = incoming + 4; // beginning of the payload
- nb_frames = *in;
- if (nb_frames > 4) {
- LOG_E(
- "ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME unsupported number of "
- "frames");
- return false;
- }
-
- UINT8_TO_STREAM(pp, *in++); // nb_frames - idx 3
- remaining -= 5;
- if ((nb_frames > 0) && (remaining < 4)) {
- LOG_E("ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME too short");
- return false;
- }
-
- if (nb_frames) {
- uint16_t crc = 0;
-
- while (nb_frames--) {
- frame_type = (*in & 0x07);
-
- UINT8_TO_STREAM(pp, *in++); // qual-type - idx 4
-
- // pointing to lengh: length RF frame = length - waiting time byte
- motiflen = *in - 1;
-
- is_crc = (*(in + 1) & 0x80) >> 7;
- UINT8_TO_STREAM(pp, *in++ + ((is_crc != 0) ? 2 : 0)); // length - idx 5
- UINT8_TO_STREAM(pp, *in++); // waiting time - idx 6
-
- if ((is_crc != 0) && (frame_type <= NFC_B_FRAME)) {
- crc = iso14443_crc(in, motiflen, frame_type);
- }
-
- ARRAY_TO_STREAM(pp, in, motiflen);
- in += motiflen;
-
- if (is_crc != 0) {
- UINT8_TO_STREAM(pp, (uint8_t)(crc & 0xFF));
- UINT8_TO_STREAM(pp, (uint8_t)(crc >> 8));
- }
- }
- }
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- return true;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_set_custom_polling_rsp
-**
-** Description Process the response from
-*ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME
-**
-** Returns true if the response was handled and shall not be fwded.
-**
-*******************************************************************************/
-static bool stpropnci_prop_st_cb_set_custom_polling_rsp(
- bool dir_from_upper, const uint8_t* payload, const uint16_t payloadlen,
- uint8_t mt, uint8_t gid, uint8_t oid) {
- uint8_t* buf = stpropnci_state.tmpbuff;
- uint16_t* buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
-
- // build the response to stack
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_SET_RF_CUSTOM_POLL_FRAME);
- UINT8_TO_STREAM(pp, payload[3]);
-
- // Update the pending fields
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
-
- return stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
-}
-
-/*******************************************************************************
-**
-** Function eseMonitor
-**
-** Description Checks FW logs to detect any abnormal SWP flow
-**
-** Returns -
-**
-*******************************************************************************/
-void eseMonitor(uint8_t format, uint16_t data_len,
- const uint8_t* p_data, bool last) {
- uint8_t* buf = stpropnci_state.tmpbuff;
- uint16_t* buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- if ((format & 0x1) == 1) {
- data_len -= 4; // ignore the timestamp
- }
-
- if (p_data[0] == FWLOG_T_SwpDeact) {
- // SWP deactivated, we clear our state
- stpropnci_state.last_tx_cnt = 0;
- stpropnci_state.last_tx_len = 0;
- if (stpropnci_state.last_rx_param_len) {
- LOG_D("clear saved param on deact");
- }
- stpropnci_state.last_rx_param_len = 0;
- stpropnci_state.last_rx_is_frag[0] = false;
- stpropnci_state.last_rx_is_frag[1] = false;
- stpropnci_state.last_rx_is_frag[2] = false;
- stpropnci_state.last_rx_is_frag[3] = false;
- return;
- }
-
- if (data_len <= 2) return;
-
- if (p_data[2] != 0x01) {
- // if it is an SWP log, it s not for eSE, we can return
- return;
- }
-
- if (p_data[0] >= FWLOG_T_RxAct && p_data[0] <= FWLOG_T_RxErr) {
- // We received something, we can reset Tx counter
- stpropnci_state.last_tx_cnt = 0;
- stpropnci_state.last_tx_len = 0;
-
- // check if it is a ANY_SET_PARAM e.g. TT LL SS RL 86 A3 01 07 00
- if ((data_len >= 8) && ((p_data[4] & 0xC0) == 0x80)) {
- bool has_cb = (p_data[5] & 0x80) == 0x80;
- bool is_first_frag = true;
- uint8_t pid = p_data[5] & 0x7F;
-
- // manage fragmented frames on pipes 21~24.
- if (pid >= 0x21 && pid <= 0x24) {
- if (stpropnci_state.last_rx_is_frag[pid - 0x21]) {
- // we got a fragment before
- is_first_frag = false;
- }
- stpropnci_state.last_rx_is_frag[pid - 0x21] = !has_cb;
- }
-
- // I frame
- if (is_first_frag && (pid >= 0x21) // one of the card gates
- && (pid <= 0x24) && (p_data[6] == 0x01) // ANY-SET_PARAM
- ) {
- // This is an ANY_SET-PARAM
- int newParamLen =
- data_len -
- 4; // this is at least 4 for II + pID + cmd + the param ID
- // same as last one ?
- if ((stpropnci_state.last_rx_param_len == newParamLen) &&
- ((p_data[4] & 0x38) !=
- (stpropnci_state.last_rx_param[0] & 0x38)) // N(S) increased, it s not the
- // same I-frame resent (RNR case)
- && (!memcmp(p_data + 5, // but the SET-PARAM data is the same
- stpropnci_state.last_rx_param + 1,
- (newParamLen < (int)sizeof(stpropnci_state.last_rx_param))
- ? (newParamLen - 1)
- : (sizeof(stpropnci_state.last_rx_param) - 1)))) {
- LOG_E("Same ANY-SET_PARAM received from eSE twice, maybe stuck");
- // abort(); // disable at the moment, some cases are abnormal but eSE
- // not stuck.
- } else {
- // save this param
- stpropnci_state.last_rx_param_len = newParamLen;
- memcpy(stpropnci_state.last_rx_param, p_data + 4,
- newParamLen < (int)sizeof(stpropnci_state.last_rx_param)
- ? newParamLen
- : sizeof(stpropnci_state.last_rx_param));
- LOG_D("saved param: %02hhx", p_data[7]);
- }
- } else {
- // we received an I-frame but it is not ANY-SET-PARAM
- if (is_first_frag && (stpropnci_state.last_rx_param_len != 0)) {
- LOG_D(" clear saved param");
- stpropnci_state.last_rx_param_len = 0;
- }
- }
- }
- }
-
- if (p_data[0] > FWLOG_T_TxAct && p_data[0] <= FWLOG_T_TxIr) {
- // CLF sent this frame, compare and record.
- if ((data_len == stpropnci_state.last_tx_len) &&
- !memcmp(stpropnci_state.last_tx, p_data + 2, data_len < 7 ? data_len - 2 : 5)) {
- // identical with the last frame we sent
- stpropnci_state.last_tx_cnt++;
- if (stpropnci_state.last_tx_cnt >= 30) {
- // Send PROP_TEST_RESET_ST54J_SE then restart NFC
- LOG_E("Same frame repeat on SWP, Start task disable/reset eSE, restart service");
- stpropnci_state.is_ese_stuck = true;
- // Send CMD to disable eSE
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_EE_MANAGE);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_NFCEE_MODE_SET);
- paylen = pp++;
- UINT8_TO_STREAM(pp, 0x86);
- UINT8_TO_STREAM(pp, 0x00);
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it back
- stpropnci_pump_post(MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen,
- stpropnci_cb_disable_ese_rsp);
- }
- } else {
- // different frame, store this one
- stpropnci_state.last_tx_cnt = 0;
- memcpy(stpropnci_state.last_tx, p_data + 2, data_len < 7 ? data_len - 2 : 5);
- stpropnci_state.last_tx_len = data_len;
- }
- }
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_disable_ese_rsp
-**
-** Description SWP was disabled with the eSE, now reset it.
-**
-** Returns true if success
-**
-*******************************************************************************/
-static bool stpropnci_cb_disable_ese_rsp(
- __attribute__((unused)) bool dir_from_upper, const uint8_t* payload,
- const uint16_t payloadlen, __attribute__((unused)) uint8_t mt,
- __attribute__((unused)) uint8_t gid, __attribute__((unused)) uint8_t oid) {
- uint8_t* buf = stpropnci_state.tmpbuff;
- uint16_t* buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- // Check status
- if (payload[3] != 0x00) {
- LOG_E(" status NOK");
- } else {
- //Stop eSE
- uint8_t ese_id[] = {0x86};
- // Send CMD to reset eSE
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_NCI_MSG_PROP_TEST);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_NCI_PROP_TEST_RESET_ST54J_SE);
- ARRAY_TO_STREAM(pp, ese_id, sizeof(ese_id));
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it back
- return stpropnci_pump_post(MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen,
- stpropnci_cb_reset_ese_rsp);
- }
-
- return true;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_reset_ese_rsp
-**
-** Description eSE has been reset, now emit a fake core_reset_ntf to reset stack
-**
-** Returns true if success
-**
-*******************************************************************************/
-static bool stpropnci_cb_reset_ese_rsp(
- __attribute__((unused)) bool dir_from_upper, const uint8_t* payload,
- const uint16_t payloadlen, __attribute__((unused)) uint8_t mt,
- __attribute__((unused)) uint8_t gid, __attribute__((unused)) uint8_t oid) {
- uint8_t* buf = stpropnci_state.tmpbuff;
- uint16_t* buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- // Check status
- if (payload[3] != 0x00) {
- LOG_E(" status NOK");
- } else {
- // send it back
- stpropnci_state.is_ese_stuck = false;
- LOG_D("Send CORE_RESET_NTF for ESE stuck detected");
- return stpropnci_send_core_reset_ntf_recovery(0x00);
- }
-
- return true;
-}
diff --git a/libstpropnci/src/stpropnci_prop_st.h b/libstpropnci/src/stpropnci_prop_st.h
deleted file mode 100755
index c230915..0000000
--- a/libstpropnci/src/stpropnci_prop_st.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2025 STMicroelectronics
- *
- * 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.
- *
- ******************************************************************************/
-
-#ifndef STPROPNCI_PROP_ST_H
-#define STPROPNCI_PROP_ST_H
-
-#include <nci_defs.h>
-#include <stpropnci.h>
-
-/* ST proprietary NCI definitions */
-
-/* Proprietary status codes */
-#define ST_NCI_STATUS_TM_NCI_RF_MIFARE_LIB_ERROR 0xE0
-#define ST_NCI_STATUS_PROP_BUFFER_OVERFLOW 0xE1
-#define ST_NCI_STATUS_PROP_COLLISION_AVOIDANCE 0xE2
-#define ST_NCI_STATUS_PROP_FALSE_TAG_DETECTION 0xE3
-#define ST_NCI_STATUS_PROP_TAG_DETECTION 0xE5
-#define ST_NCI_STATUS_PROP_PLL_LOCK_ISSUE 0xE6
-#define ST_NCI_STATUS_PROP_RF_FIELD_ON_DETECTED 0xE7
-
-/* Proprietary NCI parameters */
-#define ST_NCI_PARAM_ID_TAGDET_INTERVAL 0xA1
-#define ST_NCI_PARAM_ID_RWTD_GUARD 0xA2
-#define ST_NCI_PARAM_ID_RF_DONT_ANSWER_PASSIVE_LISTEN 0xA3
-#define ST_NCI_PARAM_ID_RF_SET_LISTEN_IOT_SEQ 0xA4
-#define ST_NCI_PARAM_ID_TEMPORARY_FORCED_SAK 0xA5
-#define ST_NCI_PARAM_ID_DMP_CONTROL 0xA8
-#define ST_NCI_PARAM_ID_TEMPORARY_FORWARD_ISO_OVER_CLT 0xA9
-#define ST_NCI_PARAM_ID_DIS_LPTD 0xAA
-
-/* ST Prop OID */
-#define ST_NCI_MSG_PROP 0x02
-/* ST Prop subOIDs */
-#define ST_NCI_PROP_GET_NFC_MODE 0x01
-#define ST_NCI_PROP_SET_NFC_MODE 0x02
-#define ST_NCI_PROP_GET_CONFIG 0x03
-#define ST_NCI_PROP_GET_CONFIG__ESE_ATTR_ID 0x0B
-#define ST_NCI_PROP_SET_CONFIG 0x04
-#define ST_NCI_PROP_EMVCO_PCD_MODE 0x05
-#define ST_NCI_PROP_NFC_FW_UPDATE 0x06
-#define ST_NCI_PROP_SET_DUAL_MATCHING_CMD 0x07
-#define ST_NCI_PROP_DISCONNECT_DH 0x08
-#define ST_NCI_PROP_NFCEE_POWER_CNTRL 0x09
-#define ST_NCI_PROP_APPLY_RF_CONFIG 0x0A
-#define ST_NCI_PROP_STOP_PRODUCTION_MODE_PULSE 0x10
-#define ST_NCI_PROP_GET_FIELD_INFO 0x12
-#define ST_NCI_PROP_RAW_RF_MODE_CTRL 0x13
-#define ST_NCI_PROP_GPIO_CONFIGURE_AS_OUTPUT 0x15
-#define ST_NCI_PROP_GPIO_SET_OUTPUT 0x16
-#define ST_NCI_PROP_RAW_RF_MODE_AUTH 0x17
-#define ST_NCI_PROP_LOG 0x20
-#define ST_NCI_PROP_GET_PERSO_DATA 0x22
-#define ST_NCI_PROP_PULSE_PATTERN_DETECTED 0x23
-
-/* Proprietary registers ID */
-#define ST_NCI_PROP__CONFIG_SUBSET__NFCC_CONFIG 0x01
-#define ST_NCI_PROP__CONFIG_SUBSET__HW_CONFIG 0x02
-
-/* types of FW logs */
-#define FWLOG_T_firstRx 0x04
-#define FWLOG_T_dynParamUsed 0x07
-#define FWLOG_T_CETx 0x08
-#define FWLOG_T_CERx 0x09
-#define FWLOG_T_RWTx 0x0A
-#define FWLOG_T_RWRx 0x0B
-#define FWLOG_T_Active_A 0x0C
-#define FWLOG_T_Sleep_A 0x0E
-#define FWLOG_T_fieldOn 0x10
-#define FWLOG_T_fieldOff 0x11
-#define FWLOG_T_fieldSenseStopped 0x17
-#define FWLOG_T_fieldLevel 0x18
-#define FWLOG_T_CERxError 0x19
-#define FWLOG_T_RWRxError 0x1A
-#define FWLOG_T_TxAct 0x30
-#define FWLOG_T_TxCtrl 0x31
-#define FWLOG_T_TxI 0x32
-#define FWLOG_T_TxIr 0x33
-#define FWLOG_T_TxSwpClt 0x34
-#define FWLOG_T_RxAct 0x35
-#define FWLOG_T_RxCtrl 0x36
-#define FWLOG_T_RxI 0x37
-#define FWLOG_T_RxErr 0x38
-#define FWLOG_T_RxSwpClt 0x39
-#define FWLOG_T_SwpDeact 0x3B
-#define FWLOG_T_Idle 0x45
-#define FWLOG_T_LogOverwrite 0xFF
-
-/* ST Prop Test OID */
-#define ST_NCI_MSG_PROP_TEST 0x03
-/* ST Prop Test subOIDs */
-#define ST_NCI_PROP_TEST_RESET_SYNC_ID 0x00
-#define ST_NCI_PROP_TEST_RESET_ST54J_SE 0x01
-#define ST_NCI_PROP_TEST_READ_VCC_UICC_CLASS 0x03
-#define ST_NCI_PROP_TEST_LOADER_PRODUCT_INFO 0x07
-#define ST_NCI_PROP_TEST_READER_CFG 0xB0
-#define ST_NCI_PROP_TEST_CARD_CFG 0xB1
-#define ST_NCI_PROP_TEST_DATA 0xB2
-#define ST_NCI_PROP_TEST_FIELD 0xB3
-#define ST_NCI_PROP_TEST_RFI_GET 0xB5
-#define ST_NCI_PROP_TEST_ADJUST_AND_WRITE_PHASE 0xB7
-#define ST_NCI_PROP_READ_RF_REGISTER 0xB8
-#define ST_NCI_PROP_WRITE_RF_MASK_REGISTER 0xB9
-#define ST_NCI_PROP_TEST_DATA_EXTENDED 0xBB
-#define ST_NCI_PROP_TEST_WRITE_CUSTOM_DATA 0xBE
-#define ST_NCI_PROP_TEST_GET_CUSTOM_DATA 0xBF
-#define ST_NCI_PROP_TEST_PHASE_TRIM_UPDATE 0xC6
-#define ST_NCI_PROP_TEST_GET_MEASUREMENT 0xC9
-#define ST_NCI_PROP_TEST_PROD_TEST_V3 0xCC
-#define ST_NCI_PROP_TEST_ANT_DIAG_V3 0xCD
-#define ST_NCI_PROP_TEST_RFI_GET_EXT 0xCE
-#define ST_NCI_PROP_TEST_LOOPBACK 0xCF
-#define ST_NCI_PROP_TEST_FIELD_ADJ_POWER 0xD0
-
-/* ST Prop loader OID */
-#define ST_NCI_MSG_PROP_LOADER 0x04
-
-/* ST Prop monitoring OID */
-#define ST_NCI_MSG_PROP_PWR_MON_RW_ON_NTF 0x05
-#define ST_NCI_MSG_PROP_PWR_MON_RW_OFF_NTF 0x06
-
-/* ST Prop OIDs related to exit frame */
-#define ST_NCI_MSG_PROP_RF_SET_OBSERVE_MODE_EXIT_FRAME 0x19
-#define ST_NCI_MSG_PROP_RF_GET_OBSERVE_MODE_EXIT_FRAME 0x1A
-#define ST_NCI_MSG_PROP_RF_OBSERVE_MODE_SUSPENDED 0x1B
-#define ST_NCI_MSG_PROP_RF_OBSERVE_MODE_RESUMED 0x1C
-
-/* ST Prop OIDs related to custom polling */
-#define ST_NCI_MSG_PROP_RF_SET_CUST_PASSIVE_POLL_FRAME 0x1D
-#define ST_NCI_MSG_PROP_RF_GET_CUST_PASSIVE_POLL_FRAME 0x1E
-
-/* These ones are not proprietary but not defined in libnfc-nci */
-#ifndef NCI_MSG_RF_SET_FORCED_NFCEE_ROUTING
-#define NCI_MSG_RF_SET_FORCED_NFCEE_ROUTING 0x11
-#endif
-#ifndef NCI_MSG_RF_SET_LISTEN_OBSERVE_MODE
-#define NCI_MSG_RF_SET_LISTEN_OBSERVE_MODE 0x16
-#endif
-#ifndef NCI_MSG_RF_GET_LISTEN_OBSERVE_MODE_STATE
-#define NCI_MSG_RF_GET_LISTEN_OBSERVE_MODE_STATE 0x17
-#endif
-#ifndef NCI_MSG_RF_FRAME_INFO_NTF
-#define NCI_MSG_RF_FRAME_INFO_NTF 0x18
-#endif
-
-/**************************
- ST NCI management
- **************************/
-bool stpropnci_process_prop_st(bool inform_only, bool dir_from_upper,
- const uint8_t* payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t oid);
-
-/*****************************************************************************/
-/* Definitions for ST Proprietary NCI messages (between StNfcExtensionService
- * and HAL or compatibility layer)*/
-/*****************************************************************************/
-#define ST_PROP_NCI_OID 0x01
-
-#define ST_PROP_NCI_SET_LIB_PASSTHOUGH 0x00
-/* command: 1 byte : 00 (disabled) / 01 (enabled) */
-/* response: no payload */
-/* NTF: no ntf */
-
-#define ST_PROP_NCI_GET_STPROPNCI_VERSION_SUBOID 0x01
-/* command: no payload */
-/* response: 2 bytes (=STPROPNCI_LIB_VERSION, MSB) */
-/* NTF: 2 bytes (=STPROPNCI_LIB_VERSION, MSB), sent by HAL only. */
-
-#define ST_PROP_NCI_GET_MANUF_DATA_SUBOID 0x02
-/* command: no payload */
-/* response: n bytes (=manufacturer data from CORE_RESET_NTF) */
-/* no NTF */
-
-#define ST_PROP_NCI_GET_NFCEE_ID_LIST 0x03
-/* command: no payload */
-/* response: nb nfcee, nfcee list */
-/* no NTF */
-
-#define ST_PROP_NCI_SETUP_ADPU_GATE 0x04
-/* command: no payload */
-/* response: Waiting time (2 bytes MSB) */
-/* no NTF */
-
-#define ST_PROP_NCI_TRANSCEIVE_ADPU_GATE 0x05
-/* command: command bytes */
-/* response: no payload */
-/* ntf: payload empty if WTX or APDU + SW*/
-
-#define ST_PROP_NCI_NFCEE_ACTION_NTF_AID_WITH_SW 0x06
-/* no CMD */
-/* no RSP */
-/* NTF : same payload as RF_NFCEE_ACTION_NTF with trigger == 0x11 */
-
-#define ST_PROP_NCI_RAW_JNI_SEQ 0x07
-/* command: byte + byte array (parameters of RawJniSeq)*/
-/* rsp: always OK */
-/* NTF: bytes returned by RawJniSeq */
-
-#define ST_PROP_NCI_SKIP_MIFARE 0x08
-/* command: status ON/OFF*/
-/* rsp: always OK */
-/* no NTF */
-
-#define ST_PROP_EMULATE_NFC_A_CARD_1 0x09
-/* command: command bytes */
-/* rsp: OK/KO */
-/* no NTF */
-
-#define ST_PROP_EMULATE_NFC_A_CARD_2 0x10
-/* command: on/off */
-/* rsp: OK */
-/* no NTF */
-
-#define ST_PROP_STORE_MIFARE_TOKEN 0x11
-/* command: on/off */
-/* rsp: OK */
-/* NTF: bytes stored */
-
-#define ST_PROP_SET_FELICA_CARD_ENABLED 0x12
-/* command: on/off */
-/* rsp: OK */
-/* no NTF */
-
-#define ST_PROP_SET_RF_CUSTOM_POLL_FRAME 0x13
-/* command: on/off - RF frames*/
-/* rsp: OK */
-/* no NTF */
-
-#define ST_PROP_RF_INTF_ACTIV_CUST_POLL_NTF 0x14
-/* no cmd */
-/* no rsp */
-/* NTF: payload of RF_INTF_ACTIVATED_NTF */
-
-#endif // STPROPNCI_PROP_ST_H
diff --git a/libstpropnci/src/stpropnci_pump.cc b/libstpropnci/src/stpropnci_pump.cc
deleted file mode 100755
index d444548..0000000
--- a/libstpropnci/src/stpropnci_pump.cc
+++ /dev/null
@@ -1,741 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2025 STMicroelectronics
- *
- * 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.
- *
- ******************************************************************************/
-#include <pthread.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stpropnci-internal.h>
-
-// How many seconds after sending do we consider a message was lost ?
-#define DELAY_FOR_ACK_MS 700
-
-// when we need to emulate a critical error so NFC service will restart
-uint8_t abnormal_core_reset_ntf[] = {0x60, 0x00, 0x05, 0x00,
- 0x01, 0x20, 0x02, 0x00};
-uint16_t abnormal_core_reset_ntf_len = sizeof(abnormal_core_reset_ntf);
-
-/*******************************************************************************
-**
-** Function message_*
-**
-** Description Set of helper functions to manage msg_t queue and items.
-** These functions must be called with the appropriate mutex
-** locked.
-**
-** Returns *
-**
-*******************************************************************************/
-// add in queue in first position
-static void message_push_first(msg_t* queue, int* ctr, msg_t* m) {
- m->next = queue->next;
- queue->next = m;
- *ctr += 1;
-}
-
-// add in queue in last position
-static void message_push_last(msg_t* queue, int* ctr, msg_t* m) {
- msg_t* p = queue;
- while (p->next != nullptr) {
- p = p->next;
- }
- p->next = m;
- m->next = nullptr;
- *ctr += 1;
-}
-
-// remove from queue in first position
-static msg_t* message_pop_first(msg_t* queue, int* ctr) {
- msg_t* r = queue->next;
- if (r != nullptr) {
- queue->next = r->next;
- r->next = nullptr;
- *ctr -= 1;
- }
- return r;
-}
-
-// remove first message that meets criterya
-static msg_t* message_pop_first_except(msg_t* queue, int* ctr,
- bool skip_cmd_to_nfcc,
- bool skip_data_to_nfcc) {
- msg_t* prev = queue;
- msg_t* m = nullptr;
- while ((m = prev->next) != nullptr) {
- uint8_t mt = (m->payload[0] & NCI_MT_MASK) >> NCI_MT_SHIFT;
-
- if ((m->dir_to_nfcc == MSG_DIR_TO_NFCC) &&
- ((skip_cmd_to_nfcc && (mt == NCI_MT_CMD)) ||
- (skip_data_to_nfcc && (mt == NCI_MT_DATA)))) {
- // we skip this one, go to next in queue
- prev = m;
- continue;
- }
-
- /* other cases, we pop this message */
- break;
- }
-
- if (m != nullptr) {
- prev->next = m->next;
- m->next = nullptr;
- *ctr -= 1;
- }
- return m;
-}
-
-// remove from queue in last position
-static msg_t* message_pop_last(msg_t* queue, int* ctr) {
- msg_t *p = queue, *r = nullptr;
- if (p->next == nullptr) {
- // queue is empty
- return r;
- }
- while (p->next->next != nullptr) {
- p = p->next;
- }
- r = p->next;
- p->next = nullptr;
- *ctr -= 1;
- return r;
-}
-
-// remove from queue if CMD matching gid/oid
-static msg_t* message_pop_cmd(msg_t* queue, int* ctr, uint8_t gid,
- uint8_t oid) {
- msg_t* p = queue;
- msg_t* r;
- do {
- r = p->next;
- if (r == nullptr) {
- break;
- }
- if ((((r->payload[0] & NCI_MT_MASK) >> NCI_MT_SHIFT) == NCI_MT_CMD) &&
- ((r->payload[0] & NCI_GID_MASK) == gid) &&
- ((r->payload[1] & NCI_OID_MASK) == oid)) {
- break;
- }
- } while ((p = p->next) != nullptr);
-
- if (r != nullptr) {
- // Matching message was found in the queue, dequeue it
- p->next = r->next;
- *ctr -= 1;
- r->next = nullptr;
- }
-
- return r;
-}
-
-// remove from queue if DATA matching connid
-static msg_t* message_pop_data(msg_t* queue, int* ctr, uint8_t connid) {
- msg_t* p = queue;
- msg_t* r;
- do {
- r = p->next;
- if (r == nullptr) {
- break;
- }
- if ((((r->payload[0] & NCI_MT_MASK) >> NCI_MT_SHIFT) == NCI_MT_DATA) &&
- ((r->payload[0] & NCI_CID_MASK) == connid)) {
- break;
- }
- } while ((p = p->next) != nullptr);
-
- if (r != nullptr) {
- // Matching message was found in the queue, dequeue it
- p->next = r->next;
- *ctr -= 1;
- r->next = nullptr;
- }
-
- return r;
-}
-
-// Get a new msg_t buffer from pool if any, or allocate it, or return null
-static msg_t* message_pool_get() {
- msg_t* m;
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_pool_mtx);
- m = message_pop_first(&stpropnci_state.pumpstate.msgPool,
- &stpropnci_state.pumpstate.msgPool_ctr);
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_pool_mtx);
- if (m == nullptr) {
- m = (msg_t*)malloc(sizeof(msg_t));
- if (m == nullptr) {
- LOG_E("Failed to allocate memory");
- return nullptr;
- }
- memset(m, 0, sizeof(msg_t));
- }
- return m;
-}
-
-// Return a msg_t to pool
-static void message_pool_put(msg_t* m) {
- memset(m, 0, sizeof(*m));
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_pool_mtx);
- message_push_first(&stpropnci_state.pumpstate.msgPool,
- &stpropnci_state.pumpstate.msgPool_ctr, m);
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_pool_mtx);
-}
-
-/*******************************************************************************
-**
-** Function ts*
-**
-** Description Set of helper functions to facilitate struct timespec
-** operations
-**
-** Returns *
-**
-*******************************************************************************/
-// Compare two timespecs, returns >0 if 'a' is later than 'b'
-static int tscmp(struct timespec a, struct timespec b) {
- if (a.tv_sec == b.tv_sec)
- return (int)(a.tv_nsec - b.tv_nsec);
- else
- return (int)(a.tv_sec - b.tv_sec);
-}
-
-// add ms to ts
-static void tsadd(struct timespec* t, int ms) {
- t->tv_sec += ms / 1000;
- ms = ms % 1000;
- t->tv_nsec += (1000000LL * (long long)ms);
- if (t->tv_nsec >= 1000000000LL) {
- t->tv_sec += 1;
- t->tv_nsec -= 1000000000LL;
- }
-}
-
-// substract ms from ts
-static void tssub(struct timespec* t, int ms) {
- t->tv_sec -= ms / 1000;
- ms = ms % 1000;
- if (t->tv_nsec < (1000000LL * (long long)ms)) {
- t->tv_sec -= 1;
- t->tv_nsec += 1000000000LL;
- }
- t->tv_nsec -= (1000000LL * (long long)ms);
-}
-
-/*******************************************************************************
-**
-** Function wd*
-**
-** Description Set of helper functions to facilitate watchdog_t
-**
-** Returns *
-**
-*******************************************************************************/
-static watchdog_t* wd_pop_first(watchdog_t* queue) {
- watchdog_t* r = queue->next;
- if (r != nullptr) {
- queue->next = r->next;
- r->next = nullptr;
- }
- return r;
-}
-
-static void wd_push_first(watchdog_t* queue, watchdog_t* w) {
- w->next = queue->next;
- queue->next = w;
-}
-
-// Insert a watchdog item in an ordered list (ts_expire INC)
-// lock is assumed to be held already
-static void wd_insert_ordered(watchdog_t* queue, watchdog_t* w) {
- watchdog_t* prev = queue;
- while ((prev->next != nullptr) &&
- (tscmp(prev->next->ts_expire, w->ts_expire) < 0)) {
- prev = prev->next;
- }
- w->next = prev->next;
- prev->next = w;
-}
-
-// Any wd of type 'e' in 'from' list will be delisted and listed in 'to'
-static void wd_move_matching(watchdog_t* from, watchdog_t* to,
- watchdog_event_t e) {
- while (from->next != nullptr) {
- watchdog_t* w = from->next;
- if (w->event == e) {
- // delist
- from->next = w->next;
- // relist
- wd_push_first(to, w);
- } else {
- from = w;
- }
- }
-}
-
-// Get a watchdog_t from pool and initialize its content
-static watchdog_t* wd_pool_get(watchdog_event_t e, int delay) {
- watchdog_t* ret = nullptr;
-
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_pool_mtx);
- ret = wd_pop_first(&stpropnci_state.pumpstate.wdPool);
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_pool_mtx);
-
- if (ret == nullptr) {
- // Alloc the watchdog structure. we could use a pool if performance needs
- ret = (watchdog_t*)malloc(sizeof(watchdog_t));
- if (ret == nullptr) {
- LOG_E("Failed to allocate memory");
- return nullptr;
- }
- }
-
- if (ret != nullptr) {
- memset(ret, 0, sizeof(watchdog_t));
- ret->event = e;
- (void)clock_gettime(CLOCK_MONOTONIC, &ret->ts_expire);
- tsadd(&ret->ts_expire, delay);
- }
-
- return ret;
-}
-
-// Return a watchdog_t to pool
-static void wd_pool_put(watchdog_t* w) {
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_pool_mtx);
- wd_push_first(&stpropnci_state.pumpstate.wdPool, w);
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_pool_mtx);
-}
-
-/*******************************************************************************
-**
-** Function message_pump_thr
-**
-** Description The function of the pump thread that sends the messages
-** posted and manages eventual retransmits when a message
-** is not ack'd
-**
-** Returns (ignored)
-**
-*******************************************************************************/
-static void* message_pump_thr(void* st) {
- LOG_D("starting");
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_mtx);
- do {
- msg_t* m;
- struct timespec t;
- bool timed = false;
- bool skip_cmd = false;
- bool skip_data = false;
- bool updated = false;
- int ctr_start = stpropnci_state.pumpstate.toSend_ctr;
-
- // check which messages are pending
- for (m = stpropnci_state.pumpstate.toAck.next; m != nullptr; m = m->next) {
- uint8_t mt = (m->payload[0] & NCI_MT_MASK) >> NCI_MT_SHIFT;
- if (mt == NCI_MT_CMD) {
- // a cmd is pending, don t send a new one
- skip_cmd = true;
- }
- if (mt == NCI_MT_DATA) {
- // a data is pending, don t send a new one
- skip_data = true;
- }
- }
-
- // send any outgoing message
- while ((m = message_pop_first_except(&stpropnci_state.pumpstate.toSend,
- &stpropnci_state.pumpstate.toSend_ctr,
- skip_cmd, skip_data)) != nullptr) {
- updated = true;
-
- // Unlock while sending responses but not commands.
- if (!m->dir_to_nfcc) {
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_mtx);
- }
- // send this message
- stpropnci_state.outCb(m->dir_to_nfcc, m->payload, m->payloadlen);
- // relock
- if (!m->dir_to_nfcc) {
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_mtx);
- }
-
- // save the message in case we may need to resend it
- if (m->dir_to_nfcc) {
- // update the timestamp
- (void)clock_gettime(CLOCK_MONOTONIC, &m->ts);
-
- // store in toAck queue
- message_push_last(&stpropnci_state.pumpstate.toAck,
- &stpropnci_state.pumpstate.toAck_ctr, m);
-
- } else {
- // We don't keep the messages sent to upper layers
- message_pool_put(m);
- }
- }
-
- // is there any unacked message reaching expiry ?
- if (stpropnci_state.pumpstate.toAck.next != nullptr) {
- (void)clock_gettime(CLOCK_MONOTONIC, &t);
- tssub(&t, DELAY_FOR_ACK_MS);
- // if the message was sent earlier than t, it is expired
- if (tscmp(stpropnci_state.pumpstate.toAck.next->ts, t) < 0) {
- updated = true;
- m = message_pop_first(&stpropnci_state.pumpstate.toAck,
- &stpropnci_state.pumpstate.toAck_ctr);
- if (!m->retried) {
- // enqueue it for sending next
- LOG_D("Message was not acked (once): %02hhx%02hhx%02hhx, resend",
- m->payload[0], m->payload[1], m->payload[2]);
- m->retried = true;
- message_push_first(&stpropnci_state.pumpstate.toSend,
- &stpropnci_state.pumpstate.toSend_ctr, m);
- // loop now so it is handled quickly
- continue;
- } else {
- LOG_D(
- "Message was not acked (twice): %02hhx%02hhx%02hhx, emulate "
- "CORE_RESET_NTF",
- m->payload[0], m->payload[1], m->payload[2]);
-
- if (((m->payload[0] & NCI_MT_MASK) >> NCI_MT_SHIFT) == NCI_MT_DATA) {
- // In case of DATA message, send a fake CORE_RESET_NTF.
- // Not needed in case of CMD, the core stack will take care of it.
- // Not using stpropnci_send_core_reset_ntf_recovery() here to avoid
- // complex lock management.
-
- // Unlock while sending.
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_mtx);
- // send a critical core reset error to upper
- stpropnci_state.outCb(false, abnormal_core_reset_ntf,
- abnormal_core_reset_ntf_len);
- // relock
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_mtx);
- }
-
- message_pool_put(m);
- }
- }
- }
-
- // Is there a watchdog expiring ?
- if (stpropnci_state.pumpstate.toWatch.next != nullptr) {
- (void)clock_gettime(CLOCK_MONOTONIC, &t);
- if (tscmp(stpropnci_state.pumpstate.toWatch.next->ts_expire, t) < 0) {
- updated = true;
- watchdog_t* w = wd_pop_first(&stpropnci_state.pumpstate.toWatch);
- LOG_E("Watchdog (type %d) expired, generating CORE_RESET_NTF",
- w->event);
- wd_pool_put(w);
-
- // Unlock while sending.
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_mtx);
- // send a critical core reset error to upper
- stpropnci_state.outCb(false, abnormal_core_reset_ntf,
- abnormal_core_reset_ntf_len);
- // relock
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_mtx);
- }
- }
-
- if (stpropnci_state.pumpstate.mustExit) {
- // stop order came while we were sending.
- break;
- }
- if (stpropnci_state.pumpstate.toSend.next != nullptr) {
- if ((!updated) && (ctr_start == stpropnci_state.pumpstate.toSend_ctr)) {
- // no change in lists, wait 1ms before loop
- // otherwise if there was an update, a new message was queued while we
- // were processing, we skip the wait and loop directly.
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_mtx);
- usleep(1000);
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_mtx);
- }
- continue;
- }
-
- if (stpropnci_state.pumpstate.toAck.next != nullptr) {
- t = stpropnci_state.pumpstate.toAck.next->ts;
- tsadd(&t, DELAY_FOR_ACK_MS);
- timed = true;
- }
-
- if (stpropnci_state.pumpstate.toWatch.next != nullptr) {
- if (timed) {
- // Check if watchdog comes first
- if (tscmp(stpropnci_state.pumpstate.toWatch.next->ts_expire, t) < 0) {
- t = stpropnci_state.pumpstate.toWatch.next->ts_expire;
- }
- } else {
- t = stpropnci_state.pumpstate.toWatch.next->ts_expire;
- timed = true;
- }
- }
-
- if (timed) {
- // Wait until at most expiry of the next message
- (void)pthread_cond_timedwait(&stpropnci_state.pumpstate.pump_cnd,
- &stpropnci_state.pumpstate.pump_mtx, &t);
- } else {
- // just wait until awaken
- (void)pthread_cond_wait(&stpropnci_state.pumpstate.pump_cnd,
- &stpropnci_state.pumpstate.pump_mtx);
- }
- } while (!stpropnci_state.pumpstate.mustExit);
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_mtx);
- LOG_D("exiting");
- return NULL;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_pump_post
-**
-** Description Enqueue a message for sending by the pump thread
-**
-** Returns true if message was queued successfully.
-**
-*******************************************************************************/
-bool stpropnci_pump_post(bool dir_to_nfcc, const uint8_t* payload,
- uint16_t payloadlen, module_cb_t rspcb) {
- msg_t* m;
- int msgPool_ctr, toSend_ctr, toAck_ctr;
- if (payloadlen > MAX_NCI_MESSAGE_LEN) {
- LOG_E("Message is too long: %u", payloadlen);
- return false;
- }
- m = message_pool_get();
- if (m == nullptr) {
- return false;
- }
- memcpy(&m->payload, payload, payloadlen);
- m->payloadlen = payloadlen;
- m->dir_to_nfcc = dir_to_nfcc;
- m->rspcb = rspcb;
-
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_mtx);
- message_push_last(&stpropnci_state.pumpstate.toSend,
- &stpropnci_state.pumpstate.toSend_ctr, m);
- msgPool_ctr = stpropnci_state.pumpstate.msgPool_ctr;
- toSend_ctr = stpropnci_state.pumpstate.toSend_ctr;
- toAck_ctr = stpropnci_state.pumpstate.toAck_ctr;
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_mtx);
- (void)pthread_cond_signal(&stpropnci_state.pumpstate.pump_cnd);
-
- if ((msgPool_ctr > 20) || (toSend_ctr > 10) || (toAck_ctr > 10)) {
- LOG_E("Unexpected many messages queued: %d/%d/%d", msgPool_ctr, toSend_ctr,
- toAck_ctr);
- }
-
- return true;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_pump_watchdog_add
-**
-** Description Start a watchdog timer for an event.
-** If this is not cleared before ms later,
-** a fake core_reset_ntf will be generated to start recovery.
-**
-** Returns true if watchdog was queued successfully.
-**
-*******************************************************************************/
-bool stpropnci_pump_watchdog_add(watchdog_event_t t, int ms) {
- watchdog_t* w = wd_pool_get(t, ms);
- if (w == nullptr) {
- LOG_E("Failed to retrieve a watchdog_t from pool, no memory ?");
- return false;
- }
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_mtx);
- wd_insert_ordered(&stpropnci_state.pumpstate.toWatch, w);
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_mtx);
- (void)pthread_cond_signal(&stpropnci_state.pumpstate.pump_cnd);
- return true;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_pump_watchdog_remove
-**
-** Description Clear all matching watchdogs registered with above function
-**
-** Returns none
-**
-*******************************************************************************/
-void stpropnci_pump_watchdog_remove(watchdog_event_t t) {
- watchdog_t toFree = {.next = nullptr};
- watchdog_t* w = nullptr;
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_mtx);
- wd_move_matching(&stpropnci_state.pumpstate.toWatch, &toFree, t);
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_mtx);
- while ((w = wd_pop_first(&toFree)) != nullptr) {
- wd_pool_put(w);
- }
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_pump_got
-**
-** Description Called upon reception of a message from NFCC, to match
-** previously sent commands or data that are waiting their
-** ack'd.
-**
-** Returns none
-**
-*******************************************************************************/
-void stpropnci_pump_got(const uint8_t* payload, uint16_t payloadlen,
- bool* handled) {
- msg_t* m = nullptr;
-
- uint8_t mt = (payload[0] & NCI_MT_MASK) >> NCI_MT_SHIFT;
-
- if (mt == NCI_MT_RSP) {
- // check if we have a corresponding CMD GID/OID to ack.
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_mtx);
- m = message_pop_cmd(&stpropnci_state.pumpstate.toAck,
- &stpropnci_state.pumpstate.toAck_ctr,
- payload[0] & NCI_GID_MASK, payload[1] & NCI_OID_MASK);
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_mtx);
- if (m != nullptr) {
- if (m->rspcb != nullptr) {
- const uint8_t* p = payload;
- uint8_t pbf, gid, oid;
- NCI_MSG_PRS_HDR0(p, mt, pbf, gid);
- NCI_MSG_PRS_HDR1(p, oid);
-
- *handled =
- (*m->rspcb)(MSG_DIR_FROM_NFCC, payload, payloadlen, mt, gid, oid);
- }
- message_pool_put(m);
- }
- } else if (mt == NCI_MT_NTF) {
- // Only care for CORE_CONN_CREDIT here
- if (((payload[0] & NCI_GID_MASK) == NCI_GID_CORE) &&
- ((payload[1] & NCI_OID_MASK) == NCI_MSG_CORE_CONN_CREDITS)) {
- // check if we have a DATA packet with this conn ID to ack.
- if (payloadlen == 6) {
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_mtx);
- m = message_pop_data(&stpropnci_state.pumpstate.toAck,
- &stpropnci_state.pumpstate.toAck_ctr, payload[4]);
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_mtx);
- if (m != nullptr) {
- message_pool_put(m);
- }
- } else {
- // ST FW only returns 1 conn credit at a time currently.
- LOG_E("Unexpected CORE_CONN_CREDITS message data");
- }
- }
- }
- // we are not interested in other cases
-
- return;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_pump_init
-**
-** Description Initializes the pump module and starts the thread.
-**
-** Returns true if init is successful.
-**
-*******************************************************************************/
-bool stpropnci_pump_init() {
- int ret = 0;
- pthread_condattr_t attr;
-
- (void)pthread_mutex_init(&stpropnci_state.pumpstate.pump_mtx, nullptr);
- (void)pthread_mutex_init(&stpropnci_state.pumpstate.pump_pool_mtx, nullptr);
-
- (void)pthread_condattr_init(&attr);
- (void)pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
- (void)pthread_cond_init(&stpropnci_state.pumpstate.pump_cnd, &attr);
- (void)pthread_condattr_destroy(&attr);
-
- ret = pthread_create(&stpropnci_state.pumpstate.pump_thr, nullptr,
- message_pump_thr, nullptr);
- if (ret != 0) {
- LOG_E("Failed to create thread: %s", strerror(ret));
- return false;
- }
-
- return true;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_pump_fini
-**
-** Description Deinitializes the pump module, stops the thread, frees the
-** resources.
-**
-** Returns none
-**
-*******************************************************************************/
-void stpropnci_pump_fini() {
- void* tret = nullptr;
- int ret = 0;
- msg_t* m;
- watchdog_t* w;
-
- // Ensure we wake up the thread so it can see mustExit
- (void)pthread_mutex_lock(&stpropnci_state.pumpstate.pump_mtx);
- stpropnci_state.pumpstate.mustExit = true;
- (void)pthread_cond_signal(&stpropnci_state.pumpstate.pump_cnd);
- (void)pthread_mutex_unlock(&stpropnci_state.pumpstate.pump_mtx);
-
- // Wait for the thread to exit
- ret = pthread_join(stpropnci_state.pumpstate.pump_thr, &tret);
- if (0 != ret) {
- LOG_E("Failed to join thread: %s", strerror(ret));
- }
-
- // Discard all pending messages.
- while ((m = message_pop_first(&stpropnci_state.pumpstate.toSend,
- &stpropnci_state.pumpstate.toSend_ctr)) !=
- nullptr) {
- LOG_D("Drop outgoing msg: %02hhx%02hhx%02hhx", m->payload[0], m->payload[1],
- m->payload[2]);
- free(m);
- }
- while ((m = message_pop_first(&stpropnci_state.pumpstate.toAck,
- &stpropnci_state.pumpstate.toAck_ctr)) !=
- nullptr) {
- LOG_D("Drop un-acked sent msg: %02hhx%02hhx%02hhx", m->payload[0],
- m->payload[1], m->payload[2]);
- free(m);
- }
- while ((m = message_pop_first(&stpropnci_state.pumpstate.msgPool,
- &stpropnci_state.pumpstate.msgPool_ctr)) !=
- nullptr) {
- free(m);
- }
- while ((w = wd_pop_first(&stpropnci_state.pumpstate.toWatch)) != nullptr) {
- free(w);
- }
- while ((w = wd_pop_first(&stpropnci_state.pumpstate.wdPool)) != nullptr) {
- free(w);
- }
-
- // Destroy mutex and cond
- (void)pthread_cond_destroy(&stpropnci_state.pumpstate.pump_cnd);
- (void)pthread_mutex_destroy(&stpropnci_state.pumpstate.pump_mtx);
- (void)pthread_mutex_destroy(&stpropnci_state.pumpstate.pump_pool_mtx);
-
- // We are done.
-}
diff --git a/libstpropnci/src/stpropnci_std.cc b/libstpropnci/src/stpropnci_std.cc
deleted file mode 100755
index ec06938..0000000
--- a/libstpropnci/src/stpropnci_std.cc
+++ /dev/null
@@ -1,790 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 2025 STMicroelectronics
- *
- * 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.
- *
- ******************************************************************************/
-#include <pthread.h>
-#include <unistd.h>
-#include <string.h>
-#include <stpropnci-internal.h>
-#include <nfc_api.h>
-
-static void stpropnci_process_core_reset_ntf(const uint8_t *payload,
- const uint16_t payloadlen);
-
-/*******************************************************************************
-**
-** Function stpropnci_process_std
-**
-** Description Called upon incoming messages with standard GID (CORE/RF/EE)
-**
-** Returns true if message was handled and processing should stop.
-**
-*******************************************************************************/
-bool stpropnci_process_std(bool inform_only, bool dir_from_upper,
- const uint8_t *payload, const uint16_t payloadlen,
- uint8_t mt, uint8_t gid, uint8_t oid) {
- bool handled = false;
- uint8_t *buf = stpropnci_state.tmpbuff;
- uint16_t *buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
-
- if (inform_only) {
- // Process the updates as needed
- if ((mt == NCI_MT_NTF) && (gid == NCI_GID_CORE) &&
- (oid == NCI_MSG_CORE_RESET)) {
- stpropnci_process_core_reset_ntf(payload, payloadlen);
- }
-
- return false;
- }
-
- if (mt == NCI_MT_DATA) {
- // the gid is actually the connection id in this case
- switch (gid) {
- case NFC_RF_CONN_ID:
- if (dir_from_upper == MSG_DIR_FROM_STACK) {
- // save the timestamp
- (void)clock_gettime(CLOCK_MONOTONIC, &stpropnci_state.ts_last_rf_tx);
- if (stpropnci_state.is_reader_activation && (payloadlen == 3)) {
- stpropnci_state.is_tx_empty_iframe = true;
- }
- } else {
- // clear timestamp
- memset(&stpropnci_state.ts_last_rf_tx, 0,
- sizeof(stpropnci_state.ts_last_rf_tx));
-
- if (stpropnci_state.is_reader_activation && (payloadlen == 3)) {
- if (stpropnci_state.is_tx_empty_iframe) {
- stpropnci_state.is_tx_empty_iframe = false;
- } else {
- // trash frame
- LOG_D("Discard received empty I Frame (not pres check)");
- handled = true;
- }
- }
- }
- break;
-
- case NFC_HCI_CONN_ID:
- break;
-
- case NFC_T4TNFCEE_CONN_ID:
- break;
- }
-
- return handled;
- }
-
- // Other cases, CMD/RSP/NTF
- switch (gid) {
- case NCI_GID_CORE:
- switch (oid) {
- case NCI_MSG_CORE_RESET:
- if (mt == NCI_MT_NTF) {
- stpropnci_process_core_reset_ntf(payload, payloadlen);
- }
- break;
-
- case NCI_MSG_CORE_GEN_ERR_STATUS:
- if (mt == NCI_MT_NTF) {
- if (payloadlen <= 3) {
- LOG_E("CORE_GENERIC_ERROR_NTF length too short: %d", payloadlen);
- break;
- }
-
- // check the error status
- switch (payload[3]) {
- case NCI_STATUS_ACTIVATION_FAILED:
- // Stop the field watchdog
- stpropnci_pump_watchdog_remove(WD_FIELD_ON_TOO_LONG);
- break;
-
- case ST_NCI_STATUS_PROP_BUFFER_OVERFLOW:
- LOG_E(
- "NFCC has overflown (IRQ not fast enough?), trigger "
- "recovery to ensure resync state");
- handled = stpropnci_send_core_reset_ntf_recovery(
- ST_NCI_STATUS_PROP_BUFFER_OVERFLOW);
- break;
-
- case ST_NCI_STATUS_PROP_PLL_LOCK_ISSUE:
- if (HW_VERSION == HW_VERSION_ST21NFCD) {
- LOG_E(
- "PLL lock error (platform clock issue?), ST21NFCD cannot "
- "recover it, trigger recovery");
- handled = stpropnci_send_core_reset_ntf_recovery(
- ST_NCI_STATUS_PROP_PLL_LOCK_ISSUE);
- }
- break;
- }
- }
- break;
-
- case NCI_MSG_CORE_SET_POWER_SUB_STATE:
- if (mt == NCI_MT_CMD) {
- if (payloadlen <= 3) {
- LOG_E("CORE_SET_POWER_SUB_STATE length too short: %d",
- payloadlen);
- break;
- }
- // Going to screen off ?
- if (stpropnci_state.mHalConfig.hal_activerw_timer) {
- if (payload[3] == 0x01 || payload[3] == 0x03) {
- if (stpropnci_state.pwr_mon_isActiveRW) {
- // Start the watchdog for CLF power monitoring
- if (!stpropnci_pump_watchdog_add(WD_ACTIVE_RW_TOO_LONG, 5000)) {
- LOG_E("Failed to add watchdog on PWR_MON_OFF, continue");
- }
- }
- }
- }
- }
- break;
-
- case NCI_MSG_CORE_CONN_CREDITS:
- if ((payload[4] == NFC_HCI_CONN_ID) &&
- (stpropnci_state.hci_cr_cnt > 0)) {
- stpropnci_state.hci_cr_cnt--;
- // Do not send to stack
- handled = true;
- }
- break;
-
- default:
- // We are not interested in others
- break;
- }
-
- break;
-
- case NCI_GID_RF_MANAGE:
- switch (oid) {
- case NCI_MSG_RF_SET_ROUTING:
- if (mt == NCI_MT_CMD) {
- uint8_t idx = 5;
- uint8_t nb_entries = 0;
- uint8_t route_a = 0x00, route_b = 0x00, idx_a = 0, idx_b = 0,
- idx_block, idx_f = 0, route_f = 0x00;
- // Check routing for listen tech
- while (nb_entries < payload[4]) {
- // Check if entry type if tech routing
- if ((payload[idx] & 0xF) == 0x00) {
- if (payload[idx + 4] == NCI_RF_TECHNOLOGY_A) {
- idx_a = idx;
- route_a = payload[idx + 2];
- } else if (payload[idx + 4] == NCI_RF_TECHNOLOGY_B) {
- idx_b = idx;
- route_b = payload[idx + 2];
- } else if (payload[idx + 4] == NCI_RF_TECHNOLOGY_F) {
- idx_f = idx;
- route_f = payload[idx + 2];
- }
- }
- idx += (payload[idx + 1] + 2);
- nb_entries++;
- }
- if (stpropnci_state.is_card_a_on) {
- LOG_D("Routing techA/B to NDEF-NFCEE");
- memcpy(pp, payload, payloadlen);
- // Route Tech to NDEF-NFCEE
- // All power states
- pp[idx_a + 2] = 0x10;
- pp[idx_a + 3] = 0x3B;
- pp[idx_b + 2] = 0x10;
- pp[idx_b + 3] = 0x3B;
-
- *buflen = payloadlen;
- // send it
- handled =
- stpropnci_pump_post(MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- } else {
- memcpy(pp, payload, payloadlen);
-
- if ((route_a != route_b) && (idx_a != 0) && (idx_b != 0)) {
- LOG_D(
- "route_a=0x%x, route_b=0x%x, not same route, block tech "
- "routed to DH",
- route_a, route_b);
- // If route is 0, means this tech was not supported by original
- // route. This is the one we want to block.
- if (route_a == 0x00) {
- idx_block = idx_a;
- } else {
- idx_block = idx_b;
- }
- pp[idx_block] |= 0x40;
- // No power states allowed
- pp[idx_block + 3] = 0x00;
- }
-
- if (!stpropnci_state.is_ese_felica_enabled) {
- if (route_f == 0x86 && idx_f != 0) {
- LOG_D("Routing techF to DH");
- // Route Tech F to DH
- // Power states: 0x11 (switched ON, screen unlocked)
- pp[idx_f + 2] = 0x00;
- pp[idx_f + 3] = 0x11;
- }
- }
-
- *buflen = payloadlen;
- // send it
- handled =
- stpropnci_pump_post(MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- }
- }
- break;
-
- case NCI_MSG_RF_DISCOVER:
- if (mt == NCI_MT_NTF) {
- // Stop the field watchdog
- stpropnci_pump_watchdog_remove(WD_FIELD_ON_TOO_LONG);
- // Stop the pwr_mon watchdog
- stpropnci_pump_watchdog_remove(WD_ACTIVE_RW_TOO_LONG);
- stpropnci_state.pwr_mon_errorCount = 0;
- }
- break;
-
- case NCI_MSG_RF_INTF_ACTIVATED:
- if (mt == NCI_MT_NTF) {
- // Stop the field watchdog
- stpropnci_pump_watchdog_remove(WD_FIELD_ON_TOO_LONG);
- // Stop the pwr_mon watchdog
- stpropnci_pump_watchdog_remove(WD_ACTIVE_RW_TOO_LONG);
- stpropnci_state.pwr_mon_errorCount = 0;
-
- // Check if activated in reader mode
- if ((payload[6] < NCI_DISCOVERY_TYPE_LISTEN_A)) {
- stpropnci_state.is_reader_activation = true;
- } else {
- stpropnci_state.is_reader_activation = false;
- }
-
- // Check custom polling activation
- if (payload[6] == NFC_CUST_PASSIVE_POLL_MODE) {
- int len_tp = payload[9] - 2;
- uint8_t rf_tech_mode = NFC_DISCOVERY_TYPE_POLL_A;
-
- // Only send the prop NTF once
- if (!stpropnci_state.is_rf_intf_cust_tx) {
- // Send received RF_INTF_ACTIVATED_NTF as prop OID NTF to ST OEM
- // extensions
- NCI_MSG_BLD_HDR0(pp, NCI_MT_NTF, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_RF_INTF_ACTIV_CUST_POLL_NTF);
- ARRAY_TO_STREAM(pp, payload + 3, payload[2]);
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- stpropnci_state.is_rf_intf_cust_tx = true;
- }
-
- // reset pointer
- pp = buf;
- stpropnci_tmpbuff_reset();
-
- // Now we need to create STD RF_INTF_ACTIVATED_NTF
- if (payload[5] != NFC_PROTOCOL_UNKNOWN) {
- //Case CUST_POLL_STD_RESP
- rf_tech_mode = payload[10];
- } else {
- // Case CUST_POLL_NOSTD_RESP
- switch (payload[10]) {
- case PROP_A_POLL:
- rf_tech_mode = NFC_DISCOVERY_TYPE_POLL_A;
- break;
- case PROP_B_POLL:
- rf_tech_mode = NFC_DISCOVERY_TYPE_POLL_B;
- break;
- case PROP_F_POLL:
- rf_tech_mode = NFC_DISCOVERY_TYPE_POLL_F;
- break;
- case PROP_V_POLL:
- rf_tech_mode = NFC_DISCOVERY_TYPE_POLL_V;
- break;
- case PROP_B_NOEOFSOF_POLL:
- rf_tech_mode = NFC_DISCOVERY_TYPE_POLL_B;
- break;
- case PROP_B_NOSOF_POLL:
- rf_tech_mode = NFC_DISCOVERY_TYPE_POLL_B;
- break;
- default:
- LOG_E("Unknown RF tech mode: 0x%x", payload[10]);
- break;
- }
- }
-
- NCI_MSG_BLD_HDR0(pp, NCI_MT_NTF, NCI_GID_RF_MANAGE);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_INTF_ACTIVATED);
- paylen = pp++;
-
- UINT8_TO_STREAM(pp, payload[3]); // 3 - RF disc id ID
- UINT8_TO_STREAM(pp, payload[4]); // 4 - RF interface
- UINT8_TO_STREAM(pp, payload[5]); // 5 - RF protocol
- UINT8_TO_STREAM(pp, rf_tech_mode); // 6 - RF tech mode
- UINT8_TO_STREAM(pp, payload[7]); // 7 - max data payload size
- UINT8_TO_STREAM(pp, payload[8]); // 8 - init nb credits
- UINT8_TO_STREAM(pp, len_tp); // 9 - length RF tech param
- ARRAY_TO_STREAM(pp, payload + 12,
- len_tp); // 10 - RF tech param
- UINT8_TO_STREAM(pp,
- rf_tech_mode); // 10+n - data ex tch and mode
- ARRAY_TO_STREAM(
- pp, payload + 13 + len_tp,
- payload[2] - 10 - len_tp); // 11+n - remaining data
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- }
- }
- break;
-
- case NCI_MSG_RF_DEACTIVATE:
- if (mt == NCI_MT_CMD) {
- // If we sent RF data recently, ensure some time before forwarding.
- if (stpropnci_state.ts_last_rf_tx.tv_sec != 0 ||
- stpropnci_state.ts_last_rf_tx.tv_nsec != 0) {
- struct timespec now;
- (void)clock_gettime(CLOCK_MONOTONIC, &now);
-
- // add 10ms to last TX
- stpropnci_state.ts_last_rf_tx.tv_nsec += 10000000LL;
- if (stpropnci_state.ts_last_rf_tx.tv_nsec >= 1000000000LL) {
- stpropnci_state.ts_last_rf_tx.tv_sec += 1;
- stpropnci_state.ts_last_rf_tx.tv_nsec -= 1000000000LL;
- }
-
- // check if this delay is already passed or not.
- if ((stpropnci_state.ts_last_rf_tx.tv_sec > now.tv_sec) ||
- ((stpropnci_state.ts_last_rf_tx.tv_sec == now.tv_sec) &&
- (stpropnci_state.ts_last_rf_tx.tv_nsec > now.tv_nsec))) {
- // We wait for the remaining time.
- long long remaining =
- (stpropnci_state.ts_last_rf_tx.tv_sec - now.tv_sec) *
- 1000000000LL;
- remaining +=
- stpropnci_state.ts_last_rf_tx.tv_nsec - now.tv_nsec;
- // in ms
- remaining /= 1000000LL;
- remaining += 1;
- LOG_D("Waiting for %d ms before sending the deactivate cmd",
- (int)remaining);
- usleep(remaining * 1000);
- }
-
- // clear timestamp
- memset(&stpropnci_state.ts_last_rf_tx, 0,
- sizeof(stpropnci_state.ts_last_rf_tx));
- }
- }
- break;
-
- case NCI_MSG_RF_FIELD:
- if (mt == NCI_MT_NTF) {
- if (payloadlen <= 3) {
- LOG_E("NCI_MSG_RF_FIELD length too short: %d", payloadlen);
- break;
- }
- if (payload[3] == 0x01) {
- // FIELD ON
- // This watchdog was started only if STNFC_REMOTE_FIELD_TIMER in
- // config file before. We enable it only for ST54J at the moment,
- // it can be updated later.
- if (HW_VERSION >= HW_VERSION_ST54J) {
- if (stpropnci_state.mHalConfig.hal_field_timer) {
- if (!stpropnci_pump_watchdog_add(WD_FIELD_ON_TOO_LONG, 20000)) {
- LOG_E("Failed to add watchdog on NCI_MSG_RF_FIELD, continue");
- }
- }
- }
- } else {
- // FIELD OFF
- stpropnci_pump_watchdog_remove(WD_FIELD_ON_TOO_LONG);
- }
- }
- break;
-
- case NCI_MSG_RF_EE_ACTION:
- // In case of proprietary trigger, remap to standard AID trigger and
- // generate a custom ST notification.
- if (mt == NCI_MT_NTF) {
- if (payloadlen < 6) {
- LOG_E("NCI_MSG_RF_EE_ACTION length too short: %d", payloadlen);
- break;
- }
- if (payload[4] == 0x11) {
- // This is ST NFC custom trigger format with both AID and SW.
- // We generate a custom NCI NTF for extensions and
- // remap to regular AID trigger for the stack.
-
- // Generate the custom frame first.
- NCI_MSG_BLD_HDR0(pp, NCI_MT_NTF, NCI_GID_PROP);
- NCI_MSG_BLD_HDR1(pp, ST_PROP_NCI_OID);
- paylen = pp++;
- UINT8_TO_STREAM(pp, ST_PROP_NCI_NFCEE_ACTION_NTF_AID_WITH_SW);
- ARRAY_TO_STREAM(pp, payload + 3, payloadlen - 3);
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- if (!handled) {
- LOG_E(
- "Failed to post notification, stop processing of "
- "NFCEE_ACTION_NTF");
- break;
- }
-
- // reset pointer
- pp = buf;
- stpropnci_tmpbuff_reset();
-
- // Create fake notif with trigger = AID
- NCI_MSG_BLD_HDR0(pp, NCI_MT_NTF, NCI_GID_RF_MANAGE);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_EE_ACTION);
- paylen = pp++;
-
- UINT8_TO_STREAM(pp, payload[3]); // NFCEE ID
- UINT8_TO_STREAM(pp, 0x00); // trigger: force AID
- ARRAY_TO_STREAM(pp, payload + 7,
- payload[7] + 1); // AID length + AID
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- }
- }
- break;
-
- case NCI_MSG_RF_EE_DISCOVERY_REQ:
- if (mt == NCI_MT_NTF) {
- uint8_t idx = 0;
- if (payloadlen <= NFC_EE_DISCOVER_ENTRY_LEN) {
- LOG_E("NCI_MSG_RF_EE_DISCOVERY_REQ length too short: %d",
- payloadlen);
- break;
- }
- for (int i = 0; i < payload[3]; i++) {
- idx = 0xFF;
- // Check if info for this NFCEE Id already stored
- for (int j = 0; j < stpropnci_state.nb_ee_info; j++) {
- if (stpropnci_state.ee_info[j].nfcee_id == payload[6 + i * 5]) {
- idx = j;
- break;
- }
- }
- if (idx == 0xFF) {
- idx = stpropnci_state.nb_ee_info;
- stpropnci_state.ee_info[idx].nfcee_id = payload[6 + i * 5];
- stpropnci_state.nb_ee_info++;
- }
- if (payload[7 + i * 5] == NCI_DISCOVERY_TYPE_LISTEN_A) {
- if (payload[8 + i * 5] == NFC_PROTOCOL_T2T) {
- if (payload[4 + i * 5] == NFC_EE_DISC_OP_ADD) {
- stpropnci_state.ee_info[idx].la |= NFC_PROTO_T2T_MASK;
- } else {
- stpropnci_state.ee_info[idx].la &= ~NFC_PROTO_T2T_MASK;
- }
- } else if (payload[8 + i * 5] == NCI_PROTOCOL_ISO_DEP) {
- if (payload[4 + i * 5] == NFC_EE_DISC_OP_ADD) {
- stpropnci_state.ee_info[idx].la |= NFC_PROTO_T4T_MASK;
- } else {
- stpropnci_state.ee_info[idx].la &= ~NFC_PROTO_T4T_MASK;
- }
- }
- } else if (payload[7 + i * 5] == NCI_DISCOVERY_TYPE_LISTEN_B) {
- if (payload[4 + i * 5] == NFC_EE_DISC_OP_ADD) {
- stpropnci_state.ee_info[idx].lb |= NFC_PROTO_T4T_MASK;
- } else {
- stpropnci_state.ee_info[idx].lb &= ~NFC_PROTO_T4T_MASK;
- }
- } else if (payload[7 + i * 5] == NCI_DISCOVERY_TYPE_LISTEN_F) {
- if (payload[4 + i * 5] == NFC_EE_DISC_OP_ADD) {
- stpropnci_state.ee_info[idx].lf |= NFC_PROTO_T3T_MASK;
- } else {
- stpropnci_state.ee_info[idx].lf &= ~NFC_PROTO_T3T_MASK;
- }
- }
- }
- LOG_D("nb_ee_info=0x%x", stpropnci_state.nb_ee_info);
- for (int i = 0; i < stpropnci_state.nb_ee_info; i++) {
- LOG_D("nfceeId=0x%x, la=0x%x, lb=0x%x, lf=0x%x",
- stpropnci_state.ee_info[i].nfcee_id,
- stpropnci_state.ee_info[i].la,
- stpropnci_state.ee_info[i].lb,
- stpropnci_state.ee_info[i].lf);
- }
- }
- break;
-
- default:
- // We are not interested in this one
- break;
- }
-
- break;
-
- case NCI_GID_EE_MANAGE:
- switch (oid) {
- case NCI_MSG_NFCEE_MODE_SET:
- if (mt == NCI_MT_CMD) {
- if (payloadlen < 2) {
- LOG_E("NFCEE_MODE_SET_CMD length too short: %d", payloadlen);
- break;
- }
- LOG_I("NFCEE_MODE_SET_CMD: nfceeId=0x%x", payload[3]);
- // Get NFCEE ID
- if (payload[4] == 0x01) {
- stpropnci_state.wait_nfcee_ntf = true;
- }
- stpropnci_state.waiting_nfcee_id = payload[3];
- } else if (mt == NCI_MT_NTF) {
- if (payload[3] == 0x00) {
- LOG_I("NFCEE_MODE_SET_NTF: status=0x%x", payload[3]);
- // activation
- if (stpropnci_state.wait_nfcee_ntf) {
- stpropnci_state
- .active_nfcee_ids[stpropnci_state.nb_active_nfcees] =
- stpropnci_state.waiting_nfcee_id;
- stpropnci_state.nb_active_nfcees++;
- if (stpropnci_state.waiting_nfcee_id == 0x86) {
- // Calling NFCEE_POWER_AND_LINK_CTRL_CMD to set SWP always ON
- // Create fake notif with trigger = AID
- NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_EE_MANAGE);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_NFCEE_POWER_LINK_CTRL);
- paylen = pp++;
-
- UINT8_TO_STREAM(
- pp, stpropnci_state.waiting_nfcee_id); // NFCEE ID
- UINT8_TO_STREAM(pp, 0x03); // trigger: force AID
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it
- (void)stpropnci_pump_post(
- MSG_DIR_TO_NFCC, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, stpropnci_cb_block_rsp);
- }
- } else {
- // deactivation
- for (int i = 0; i < stpropnci_state.nb_active_nfcees; i++) {
- if (stpropnci_state.active_nfcee_ids[i] ==
- stpropnci_state.waiting_nfcee_id) {
- for (int j = i; j < stpropnci_state.nb_active_nfcees - 1;
- j++) {
- stpropnci_state.active_nfcee_ids[j] =
- stpropnci_state.active_nfcee_ids[j + 1];
- }
- stpropnci_state.nb_active_nfcees--;
- }
- }
- }
- }
- stpropnci_state.wait_nfcee_ntf = false;
- if (stpropnci_state.is_ese_stuck) {
- //Drop NTF due to handle recovery
- handled = true;
- }
- }
- break;
- case NCI_MSG_NFCEE_POWER_LINK_CTRL:
- NCI_MSG_BLD_HDR0(pp, NCI_MT_RSP, NCI_GID_EE_MANAGE);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_NFCEE_POWER_LINK_CTRL);
- paylen = pp++;
- UINT8_TO_STREAM(pp, NFC_STATUS_OK); // NFCEE ID
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it
- handled =
- stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
- break;
- default:
- break;
- }
- break;
-
- default:
- // Unexpected GID, unhandled.
- LOG_E("Unexpected GID: 0x%02hhx", gid);
- break;
- }
-
- return handled;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_process_core_reset_ntf
-**
-** Description Save the information from a core reset ntf (chip type, fw
-*version, ...)
-**
-** Returns n/a
-**
-*******************************************************************************/
-static void stpropnci_process_core_reset_ntf(const uint8_t *payload,
- const uint16_t payloadlen) {
- if (payloadlen <= 8) {
- LOG_E("CORE_RESET_NTF length too short: %d", payloadlen);
- return;
- }
-
- // CORE_RESET_NTF ; copy the manuf data in the structure
- uint8_t trigger = payload[3];
- uint8_t manuf_id = payload[6];
- uint8_t manuf_len = payload[7];
-
- if (manuf_id != 0x02) {
- LOG_E("CORE_RESET_NTF ignored, not ST: %02hhx", manuf_id);
- return;
- }
-
- switch (trigger) {
- case 0x00:
- // Unrecoverable error -- this may be forged message, ignore it
-
- break;
- case 0xA0: // after PROP_SET_NFC_MODE
- switch (payload[7 + manuf_len]) {
- case 0x00:
- stpropnci_state.clf_mode = stpropnci_state::CLF_MODE_ROUTER_DISABLED;
- break;
- case 0x01:
- stpropnci_state.clf_mode = stpropnci_state::CLF_MODE_ROUTER_ENABLED;
- break;
- case 0x02:
- stpropnci_state.clf_mode =
- stpropnci_state::CLF_MODE_ROUTER_USBCHARGING;
- break;
- default:
- // Unexpected trigger, ignore
- LOG_E("Unexpected mode: 0x%02hhx", payload[7 + manuf_len]);
- break;
- }
- [[fallthrough]]; // also save FW information
- case 0x01: // end of boot
- case 0x02: // after core_reset_cmd
- stpropnci_state.manu_specific_info_len = manuf_len;
- if (manuf_len > sizeof(stpropnci_state.manu_specific_info)) {
- stpropnci_state.manu_specific_info_len =
- sizeof(stpropnci_state.manu_specific_info);
- }
- memcpy(stpropnci_state.manu_specific_info, &payload[8],
- stpropnci_state.manu_specific_info_len);
- break;
- case 0xA2: // Loader mode
- stpropnci_state.clf_mode = stpropnci_state::CLF_MODE_LOADER;
- break;
- default:
- // Unexpected trigger, ignore
- LOG_E("Unexpected trigger: 0x%02hhx", trigger);
- break;
- }
- // Done
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_send_core_reset_ntf_recovery
-**
-** Description Generic method to build and post a simple core reset
-*notification
-** with an abnormal status code, so the stack will trigger a
-*recovery.
-**
-** Returns true if the message was posted, false otherwise.
-**
-*******************************************************************************/
-bool stpropnci_send_core_reset_ntf_recovery(uint8_t hint) {
- bool handled = false;
- uint8_t *buf = stpropnci_state.tmpbuff;
- uint16_t *buflen = stpropnci_state.tmpbufflen;
- uint8_t *pp = buf, *paylen;
-
- stpropnci_tmpbuff_reset();
-
- LOG_I("Generating a CORE_RESET_NTF (hint: %02hhx)", hint);
-
- NCI_MSG_BLD_HDR0(pp, NCI_MT_NTF, NCI_GID_CORE);
- NCI_MSG_BLD_HDR1(pp, NCI_MSG_CORE_RESET);
- paylen = pp++;
-
- // use hint if it falls in the For Proprietary Use range, otherwise reset
- // trigger 0.
- UINT8_TO_STREAM(pp, hint >= 0xA0 ? hint : 0x00);
- UINT8_TO_STREAM(pp, 0x01); // configuration status
- UINT8_TO_STREAM(pp, 0x20); // NCI version
- UINT8_TO_STREAM(pp, 0x02); // Manuf ID
- UINT8_TO_STREAM(pp, 0x00); // Manuf Data len
-
- *paylen = pp - (paylen + 1);
- *buflen = pp - buf;
- // send it back
- handled = stpropnci_pump_post(MSG_DIR_TO_STACK, stpropnci_state.tmpbuff,
- *stpropnci_state.tmpbufflen, nullptr);
-
- return handled;
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_passthrough_rsp
-**
-** Description If we let a command passthrough, let the rsp as well.
-**
-** Returns true
-**
-*******************************************************************************/
-bool stpropnci_cb_passthrough_rsp(bool dir_from_upper, const uint8_t *payload,
- const uint16_t payloadlen, uint8_t mt,
- uint8_t gid, uint8_t oid) {
- return stpropnci_pump_post(MSG_DIR_TO_STACK, payload, payloadlen, nullptr);
-}
-
-/*******************************************************************************
-**
-** Function stpropnci_cb_block_rsp
-**
-** Description For commands generated in this lib, block corresponding
-*responses.
-**
-** Returns true
-**
-*******************************************************************************/
-bool stpropnci_cb_block_rsp(bool dir_from_upper, const uint8_t *payload,
- const uint16_t payloadlen, uint8_t mt, uint8_t gid,
- uint8_t oid) {
- // Drop this response, don t forward.
- return true;
-}
diff --git a/st21nfc/Android.bp b/st21nfc/Android.bp
index c34044e..4ebbb04 100644
--- a/st21nfc/Android.bp
+++ b/st21nfc/Android.bp
@@ -25,35 +25,8 @@
defaults: ["hidl_defaults"],
proprietary: true,
- export_include_dirs: [
- "include",
- "gki/ulinux",
- "hal",
- ],
-
- whole_static_libs: [
- "nfc_nci.st21nfc.st.static",
- ],
-
- shared_libs: [
- "libbase",
- "libcutils",
- "libhardware",
- "libhardware_legacy",
- "libhidlbase",
- "liblog",
- "libutils",
- ],
-}
-
-cc_library_static {
- name: "nfc_nci.st21nfc.st.static",
- defaults: ["hidl_defaults"],
- proprietary: true,
-
cflags: [
"-DST21NFC",
- "-DST21NFC_DTA",
"-Wall",
"-Werror",
"-Wextra",
@@ -65,11 +38,13 @@
"adaptation/i2clayer.cc",
"hal/halcore.cc",
"hal_wrapper.cc",
+ "hal/hal_fwlog.cc",
"hal/hal_fd.cc",
"hal/hal_event_logger.cc",
],
local_include_dirs: [
+ "gki/common",
"gki/ulinux",
"hal",
"include",
@@ -79,11 +54,6 @@
"include",
"gki/ulinux",
],
-
- whole_static_libs: [
- "libstpropnci-vendor",
- ],
-
shared_libs: [
"libbase",
"libcutils",
diff --git a/st21nfc/adaptation/android_logmsg.cpp b/st21nfc/adaptation/android_logmsg.cpp
index 0d291f6..b944aae 100644
--- a/st21nfc/adaptation/android_logmsg.cpp
+++ b/st21nfc/adaptation/android_logmsg.cpp
@@ -21,8 +21,6 @@
#include <pthread.h>
#include <stdio.h>
-#include <string>
-
void DispHal(const char* title, const void* data, size_t length);
unsigned char hal_trace_level = STNFC_TRACE_LEVEL_DEBUG;
unsigned char hal_conf_trace_level = STNFC_TRACE_LEVEL_DEBUG;
@@ -80,29 +78,6 @@
bool first_line = true;
bool privacy = false;
uint16_t frame_nb;
- char hal_prefix[4] = {0};
-
- if ((title[0] == 'R' || title[0] == 'T') && title[7] == ' ') {
- if (title[8] == 'S' && title[10] == 'H') {
- // Stack to Hal : upper layer
- memcpy(hal_prefix, " UL", 4);
- } else if (title[8] == 'H' && title[10] == 'S') {
- // Hal to Stack : upper layer
- memcpy(hal_prefix, " UL", 4);
- } else if (title[8] == 'K' && title[10] == 'H') {
- // Kernel to Hal : lower layer
- memcpy(hal_prefix, " LL", 4);
- } else if (title[8] == 'H' && title[10] == 'K') {
- // Hal to Kernel : lower layer
- memcpy(hal_prefix, " LL", 4);
- } else if (title[8] == 'R' && title[10] == 'H') {
- // Replay to Hal : lower layer
- memcpy(hal_prefix, " LL", 4);
- } else if (title[8] == 'H' && title[10] == 'R') {
- // Hal to Replay : lower layer
- memcpy(hal_prefix, " LL", 4);
- }
- }
pthread_mutex_lock(&halLogMutex);
frame_nb = hal_log_cnt;
@@ -138,18 +113,18 @@
if (first_line == true) {
first_line = false;
if (title[0] == 'R') {
- STLOG_HAL_D("(#0%04X)%s Rx %s\n", frame_nb, hal_prefix, line);
+ STLOG_HAL_D("(#0%04X) Rx %s\n", frame_nb, line);
} else if (title[0] == 'T') {
- STLOG_HAL_D("(#0%04X)%s Tx %s\n", frame_nb, hal_prefix, line);
+ STLOG_HAL_D("(#0%04X) Tx %s\n", frame_nb, line);
} else {
STLOG_HAL_D("%s\n", line);
}
pthread_mutex_unlock(&halLogMutex);
} else {
if (title[0] == 'R') {
- STLOG_HAL_D("(#0%04X)%s rx %s\n", frame_nb, hal_prefix, line);
+ STLOG_HAL_D("(#0%04X) rx %s\n", frame_nb, line);
} else if (title[0] == 'T') {
- STLOG_HAL_D("(#0%04X)%s tx %s\n", frame_nb, hal_prefix, line);
+ STLOG_HAL_D("(#0%04X) tx %s\n", frame_nb, line);
} else {
STLOG_HAL_D("%s\n", line);
}
@@ -167,18 +142,18 @@
if (first_line == true) {
if (title[0] == 'R') {
- STLOG_HAL_D("(#0%04X)%s Rx %s\n", frame_nb, hal_prefix, line);
+ STLOG_HAL_D("(#0%04X) Rx %s\n", frame_nb, line);
} else if (title[0] == 'T') {
- STLOG_HAL_D("(#0%04X)%s Tx %s\n", frame_nb, hal_prefix, line);
+ STLOG_HAL_D("(#0%04X) Tx %s\n", frame_nb, line);
} else {
STLOG_HAL_D("%s\n", line);
}
pthread_mutex_unlock(&halLogMutex);
} else {
if (title[0] == 'R') {
- STLOG_HAL_D("(#0%04X)%s rx %s\n", frame_nb, hal_prefix, line);
+ STLOG_HAL_D("(#0%04X) rx %s\n", frame_nb, line);
} else if (title[0] == 'T') {
- STLOG_HAL_D("(#0%04X)%s tx %s\n", frame_nb, hal_prefix, line);
+ STLOG_HAL_D("(#0%04X) tx %s\n", frame_nb, line);
} else {
STLOG_HAL_D("%s\n", line);
}
diff --git a/st21nfc/adaptation/i2clayer.cc b/st21nfc/adaptation/i2clayer.cc
index 50f5b9f..dbdf6f1 100644
--- a/st21nfc/adaptation/i2clayer.cc
+++ b/st21nfc/adaptation/i2clayer.cc
@@ -62,6 +62,7 @@
pthread_mutex_t i2ctransport_mtx = PTHREAD_MUTEX_INITIALIZER;
unsigned long hal_ctrl_clk = 0;
+unsigned long hal_activerw_timer = 0;
/**************************************************************************************************
*
@@ -170,10 +171,10 @@
}
if (bytesRead == remaining) {
if ((buffer[0] == 0x6f) && (buffer[1] == 0x02)) {
- if (mDisplayFwLog) DispHal("RX DATA K2H", buffer, 3 + bytesRead);
+ if (mDisplayFwLog) DispHal("RX DATA", buffer, 3 + bytesRead);
} else {
- DispHal("RX DATA K2H", buffer, 3 + bytesRead);
- }
+ DispHal("RX DATA", buffer, 3 + bytesRead);
+ }
HalSendUpstream(hHAL, buffer, 3 + bytesRead);
} else {
readOk = false;
@@ -316,6 +317,8 @@
}
GetNumValue(NAME_STNFC_CONTROL_CLK, &hal_ctrl_clk, sizeof(hal_ctrl_clk));
+ GetNumValue(NAME_STNFC_ACTIVERW_TIMER, &hal_activerw_timer,
+ sizeof(hal_activerw_timer));
if (hal_ctrl_clk) {
if (ioctl(fidI2c, ST21NFC_CLK_DISABLE, NULL) < 0) {
@@ -473,9 +476,12 @@
int clk_state = -1;
char msg[LINUX_DBGBUFFER_SIZE];
- if ((hal_ctrl_clk) && length >= 4 &&
+ if ((hal_ctrl_clk || hal_activerw_timer) && length >= 4 &&
pvBuffer[0] == 0x20 && pvBuffer[1] == 0x09) {
-
+ if (hal_activerw_timer && (pvBuffer[3] == 0x01 || pvBuffer[3] == 0x03)) {
+ // screen off cases
+ hal_wrapper_set_state(HAL_WRAPPER_STATE_SET_ACTIVERW_TIMER);
+ }
if (hal_ctrl_clk && 0 > (clk_state = ioctl(fid, ST21NFC_CLK_STATE, NULL))) {
strerror_r(errno, msg, LINUX_DBGBUFFER_SIZE);
STLOG_HAL_E("ST21NFC_CLK_STATE failed errno %d(%s)", errno, msg);
diff --git a/st21nfc/hal/hal_fd.cc b/st21nfc/hal/hal_fd.cc
index 90e2a29..32451c1 100644
--- a/st21nfc/hal/hal_fd.cc
+++ b/st21nfc/hal/hal_fd.cc
@@ -28,7 +28,6 @@
#include "android_logmsg.h"
#include "hal_event_logger.h"
#include "halcore.h"
-#include "halcore_private.h"
/* Initialize fw info structure pointer used to access fw info structure */
FWInfo* mFWInfo = NULL;
@@ -36,7 +35,6 @@
FILE* mFwFileBin;
FILE* mCustomFileBin;
-FILE* mCustomFileTxt;
fpos_t mPos;
fpos_t mPosInit;
uint8_t mBinData[260];
@@ -51,9 +49,6 @@
const char* FwType = "generic";
char mApduAuthent[24];
-uint8_t txtCmd[MAX_BUFFER_SIZE];
-uint16_t txtCmdLen = 0;
-
static const uint8_t propNfcModeSetCmdOn[] = {0x2f, 0x02, 0x02, 0x02, 0x01};
static const uint8_t coreInitCmd[] = {0x20, 0x01, 0x02, 0x00, 0x00};
static const uint8_t NciPropNfcFwUpdate[] = {0x2F, 0x02, 0x05, 0x06,
@@ -127,20 +122,6 @@
typedef size_t (*STLoadUwbParams)(void* out_buff, size_t buf_size);
-static int ascii2hex(char c) {
- int res = -1;
-
- if ((c >= '0') && (c <= '9')) {
- res = c - '0';
- } else if ((c >= 'A') && (c <= 'F')) {
- res = c - 'A' + 10;
- } else if ((c >= 'a') && (c <= 'f')) {
- res = c - 'a' + 10;
- }
-
- return res;
-}
-
/***********************************************************************
* Determine UserKey
*
@@ -248,7 +229,6 @@
mFwFileBin = NULL;
mCustomFileBin = NULL;
- mCustomFileTxt = NULL;
// Check if FW patch binary file is present
// If not, get recovery FW patch file
@@ -311,40 +291,12 @@
if ((mCustomFileBin = fopen((char*)ConfPath, "r")) == NULL) {
STLOG_HAL_D("%s - st21nfc custom configuration not detected\n", __func__);
} else {
- char conf_line[600];
- uint16_t fwconf_crc = 0;
- if (fwConfName[strlen(fwConfName) - 1] == 't') {
- mCustomFileTxt = mCustomFileBin;
- mCustomFileBin = NULL;
- STLOG_HAL_D("text configuration detected\n");
- fgets(conf_line, sizeof conf_line, mCustomFileTxt);
- if ((conf_line[0] == 'R') && (conf_line[11] == 'C') &&
- (conf_line[12] == 'R')) {
- fwconf_crc = ascii2hex(conf_line[21]) |
- ((ascii2hex(conf_line[20]) << 4) & 0xF0) |
- ((ascii2hex(conf_line[19]) << 8) & 0xF00) |
- ((ascii2hex(conf_line[18]) << 12) & 0xF000);
- mFWInfo->fileCustVersion = fwconf_crc;
- STLOG_HAL_D("-> txt configuration CRC 0x%04X \n",
- mFWInfo->fileCustVersion);
- result |= FW_CUSTOM_PARAM_AVAILABLE;
- } else {
- STLOG_HAL_E("text configuration invalid content\n");
- fclose(mCustomFileTxt);
- mCustomFileTxt = NULL;
- }
- } else if (fwConfName[strlen(fwConfName) - 1] == 'n') {
STLOG_HAL_D("%s - %s file detected\n", __func__, ConfPath);
fread(mBinData, sizeof(uint8_t), 2, mCustomFileBin);
mFWInfo->fileCustVersion = mBinData[0] << 8 | mBinData[1];
STLOG_HAL_D("%s --> st21nfc_custom configuration version 0x%04X \n",
__func__, mFWInfo->fileCustVersion);
result |= FW_CUSTOM_PARAM_AVAILABLE;
- } else {
- STLOG_HAL_E("configuration file name not recognized\n");
- fclose(mCustomFileBin);
- mCustomFileBin = NULL;
- }
}
if (ft_CheckUWBConf()) {
@@ -369,10 +321,6 @@
fclose(mCustomFileBin);
mCustomFileBin = NULL;
}
- if (mCustomFileTxt != NULL) {
- fclose(mCustomFileTxt);
- mCustomFileTxt = NULL;
- }
}
FWInfo* hal_fd_getFwInfo() {
@@ -973,102 +921,6 @@
}
}
-/*******************************************************************************
- ** Function
- **
- ** Description ASCII to Hexadecimal conversion (whole line)
- **
- ** @param input, a \0-terminated string with ASCII bytes representation (e.g. 01
- ** 23 45). Spaces are allowed, but must be aligned on bytes boundaries.
- ** @param pCmd, converted bytes are stored here.
- ** @param maxLen, storage size of pCmd
- ** @param pcmdlen, how many bytes have been written upon return.
- ** @return 0 on success, -1 on failure
- *******************************************************************************/
-static int convstr2hex(char* input, uint8_t* pCmd, int maxLen,
- uint16_t* pcmdlen) {
- char* in = input;
- int c;
- *pcmdlen = 0;
-
- while ((in[0] != '\0') && (in[1] != '\0') &&
- (*pcmdlen < maxLen)) // we need at least 2 characters left
- {
- // Skip white spaces
- if (in[0] == ' ' || in[0] == '\t' || in[0] == '\r' || in[0] == '\n') {
- in++;
- continue;
- }
-
- // Is MSB char a valid HEX value ?
- c = ascii2hex(*in);
- if (c < 0) {
- STLOG_HAL_E(" Error: invalid character (%x,'%c')\n", *in, *in);
- return -1;
- }
- // Store it
- pCmd[*pcmdlen] = c << 4;
- in++;
-
- // Is LSB char a valid HEX value ?
- c = ascii2hex(*in);
- if (c < 0) {
- STLOG_HAL_E(" Error: invalid character (%x,'%c')\n", *in, *in);
- return -1;
- }
- // Store it
- pCmd[*pcmdlen] |= c;
- in++;
- (*pcmdlen)++;
- }
-
- if (*pcmdlen == maxLen) {
- STLOG_HAL_D(" Warning: input conversion may be truncated\n");
- }
-
- return 0;
-}
-
-int ft_FwConfConvertor(char* string_cmd, uint8_t pCmd[256], uint16_t* pcmdlen) {
- uint16_t converted;
- int res = convstr2hex(string_cmd, pCmd + 3, 256 - 3, &converted);
- if (res < 0) {
- *pcmdlen = 0;
- return 0;
- }
- // We should be able to propagate an error here, TODO: if (res < 0) ....
- pCmd[0] = 0x2F;
- pCmd[1] = 0x02;
- pCmd[2] = converted;
- *pcmdlen = converted + 3;
- return 1;
-}
-// parse st21nfc_conf.txt until next command to send.
-// return 1 if a command was found, 0 if EOF
-int getNextCommandInTxt(uint8_t* cmd, uint16_t* sz) {
- int ret = 0;
- // f_cust_txt is already opened and 1st line read
- char conf_line[600];
-
- while (fgets(conf_line, sizeof conf_line, mCustomFileTxt) != NULL) {
- if (!strncmp(conf_line, "NCI_SEND_PROP", sizeof("NCI_SEND_PROP") - 1)) {
- STLOG_HAL_V("%s : parse %s", __func__, conf_line);
- ret = ft_FwConfConvertor((char*)conf_line + 20, cmd, sz);
- break;
- } else if (!strncmp(conf_line, "NCI_DIRECT_CTRL",
- sizeof("NCI_DIRECT_CTRL") - 1)) {
- STLOG_HAL_V("%s : parse %s", __func__, conf_line);
- ret = ft_FwConfConvertor((char*)conf_line + 22, cmd, sz);
- break;
- } else {
- // any other, we ignore
- STLOG_HAL_V("%s : ignore %s", __func__, conf_line);
- }
- }
-
- return ret;
-}
-
void ApplyCustomParamHandler(HALHANDLE mHalHandle, uint16_t data_len,
uint8_t* p_data) {
STLOG_HAL_D("%s - Enter ", __func__);
@@ -1077,181 +929,107 @@
return;
}
- if (mCustomFileTxt != NULL) {
- switch (p_data[0]) {
- case 0x40: //
- // CORE_RESET_RSP
- if ((p_data[1] == 0x0) && (p_data[3] == 0x0)) {
- // do nothing
- } else if ((p_data[1] == 0x1) && (p_data[3] == 0x0)) {
- if (mFWInfo->hibernate_exited == 0) {
- // Send a NFC mode on .
- if (!HalSendDownstream(mHalHandle, propNfcModeSetCmdOn,
- sizeof(propNfcModeSetCmdOn))) {
- STLOG_HAL_E("%s - SendDownstream failed", __func__);
- }
- // CORE_INIT_RSP
- } else if (mFWInfo->hibernate_exited == 1) {
- if (getNextCommandInTxt(txtCmd, &txtCmdLen)) {
- if (!HalSendDownstream(mHalHandle, txtCmd, txtCmdLen)) {
- STLOG_HAL_E("NFC-NCI HAL: %s SendDownstream failed", __func__);
- }
- }
- }
-
- } else {
- STLOG_HAL_D("%s - Error in custom param application", __func__);
- mCustomParamFailed = true;
- I2cResetPulse();
- hal_wrapper_set_state(HAL_WRAPPER_STATE_OPEN);
- }
- break;
-
- case 0x4f:
- if (mFWInfo->hibernate_exited == 1) {
- // Check if an error has occurred for PROP_SET_CONFIG_CMD
- if (p_data[3] != 0x00) {
- STLOG_HAL_D("%s - Error in custom file, retry", __func__);
- // should we need to limit number of retry ? to be decided if this
- // error is found
- usleep(5000);
- if (!HalSendDownstream(mHalHandle, txtCmd, txtCmdLen)) {
- STLOG_HAL_E("NFC-NCI HAL: %s SendDownstream failed", __func__);
- }
- } else if (getNextCommandInTxt(txtCmd, &txtCmdLen)) {
- if (!HalSendDownstream(mHalHandle, txtCmd, txtCmdLen)) {
- STLOG_HAL_E("NFC-NCI HAL: %s SendDownstream failed", __func__);
- }
- } else {
- STLOG_HAL_D("%s - EOF of custom file", __func__);
- mCustomParamDone = true;
- I2cResetPulse();
- }
- }
- break;
-
- case 0x60: //
- if (p_data[1] == 0x0) {
- if (p_data[3] == 0xa0) {
- mFWInfo->hibernate_exited = 1;
- }
- if (!HalSendDownstream(mHalHandle, coreInitCmd,
- sizeof(coreInitCmd))) {
+ switch (p_data[0]) {
+ case 0x40: //
+ // CORE_RESET_RSP
+ if ((p_data[1] == 0x0) && (p_data[3] == 0x0)) {
+ // do nothing
+ } else if ((p_data[1] == 0x1) && (p_data[3] == 0x0)) {
+ if (mFWInfo->hibernate_exited == 0) {
+ // Send a NFC mode on .
+ if (!HalSendDownstream(mHalHandle, propNfcModeSetCmdOn,
+ sizeof(propNfcModeSetCmdOn))) {
STLOG_HAL_E("%s - SendDownstream failed", __func__);
}
-
- } else if ((p_data[1] == 0x6) && mCustomParamDone) {
- mCustomParamDone = false;
- hal_wrapper_update_complete();
- }
- break;
- }
-
- } else if (mCustomFileBin != NULL) {
- switch (p_data[0]) {
- case 0x40: //
- // CORE_RESET_RSP
- if ((p_data[1] == 0x0) && (p_data[3] == 0x0)) {
- // do nothing
- } else if ((p_data[1] == 0x1) && (p_data[3] == 0x0)) {
- if (mFWInfo->hibernate_exited == 0) {
- // Send a NFC mode on .
- if (!HalSendDownstream(mHalHandle, propNfcModeSetCmdOn,
- sizeof(propNfcModeSetCmdOn))) {
- STLOG_HAL_E("%s - SendDownstream failed", __func__);
- }
- // CORE_INIT_RSP
- } else if (mFWInfo->hibernate_exited == 1) {
- if ((fread(mBinData, sizeof(uint8_t), 3, mCustomFileBin)) &&
- (fread(mBinData + 3, sizeof(uint8_t), mBinData[2],
- mCustomFileBin))) {
- if (!HalSendDownstream(mHalHandle, mBinData, mBinData[2] + 3)) {
- STLOG_HAL_E("%s - SendDownstream failed", __func__);
- }
- }
- }
-
- } else {
- STLOG_HAL_D("%s - Error in custom param application", __func__);
- mCustomParamFailed = true;
- I2cResetPulse();
- hal_wrapper_set_state(HAL_WRAPPER_STATE_OPEN);
- }
- break;
-
- case 0x4f:
- if (mFWInfo->hibernate_exited == 1) {
- if ((fread(mBinData, sizeof(uint8_t), 3, mCustomFileBin) == 3) &&
+ // CORE_INIT_RSP
+ } else if (mFWInfo->hibernate_exited == 1) {
+ if ((fread(mBinData, sizeof(uint8_t), 3, mCustomFileBin)) &&
(fread(mBinData + 3, sizeof(uint8_t), mBinData[2],
- mCustomFileBin) == mBinData[2])) {
+ mCustomFileBin))) {
if (!HalSendDownstream(mHalHandle, mBinData, mBinData[2] + 3)) {
STLOG_HAL_E("%s - SendDownstream failed", __func__);
}
+ }
+ }
+
+ } else {
+ STLOG_HAL_D("%s - Error in custom param application", __func__);
+ mCustomParamFailed = true;
+ I2cResetPulse();
+ hal_wrapper_set_state(HAL_WRAPPER_STATE_OPEN);
+ }
+ break;
+
+ case 0x4f:
+ if (mFWInfo->hibernate_exited == 1) {
+ if ((fread(mBinData, sizeof(uint8_t), 3, mCustomFileBin) == 3) &&
+ (fread(mBinData + 3, sizeof(uint8_t), mBinData[2],
+ mCustomFileBin) == mBinData[2])) {
+ if (!HalSendDownstream(mHalHandle, mBinData, mBinData[2] + 3)) {
+ STLOG_HAL_E("%s - SendDownstream failed", __func__);
+ }
+ } else {
+ STLOG_HAL_D("%s - mCustomParamDone = %d", __func__, mCustomParamDone);
+ if (!mGetCustomerField) {
+ mGetCustomerField = true;
+ if (!HalSendDownstream(mHalHandle, nciGetPropConfig,
+ sizeof(nciGetPropConfig))) {
+ STLOG_HAL_E("%s - SendDownstream failed", __func__);
+ }
+ mGetCustomerField = true;
+
+ } else if (!mCustomParamDone) {
+ STLOG_HAL_D("%s - EOF of custom file.", __func__);
+ memset(nciPropSetConfig_CustomField, 0x0,
+ sizeof(nciPropSetConfig_CustomField));
+ memcpy(nciPropSetConfig_CustomField, nciSetPropConfig, 9);
+ nciPropSetConfig_CustomField[8] = p_data[6];
+ nciPropSetConfig_CustomField[2] = p_data[6] + 6;
+ memcpy(nciPropSetConfig_CustomField + 9, p_data + 7, p_data[6]);
+ nciPropSetConfig_CustomField[13] = mFWInfo->chipUwbVersion >> 8;
+ nciPropSetConfig_CustomField[14] = mFWInfo->chipUwbVersion;
+
+ if (!HalSendDownstream(mHalHandle, nciPropSetConfig_CustomField,
+ nciPropSetConfig_CustomField[2] + 3)) {
+ STLOG_HAL_E("%s - SendDownstream failed", __func__);
+ }
+
+ mCustomParamDone = true;
+
} else {
- STLOG_HAL_D("%s - mCustomParamDone = %d", __func__,
- mCustomParamDone);
- if (!mGetCustomerField) {
- mGetCustomerField = true;
- if (!HalSendDownstream(mHalHandle, nciGetPropConfig,
- sizeof(nciGetPropConfig))) {
- STLOG_HAL_E("%s - SendDownstream failed", __func__);
- }
- mGetCustomerField = true;
-
- } else if (!mCustomParamDone) {
- STLOG_HAL_D("%s - EOF of custom file.", __func__);
- memset(nciPropSetConfig_CustomField, 0x0,
- sizeof(nciPropSetConfig_CustomField));
- memcpy(nciPropSetConfig_CustomField, nciSetPropConfig, 9);
- nciPropSetConfig_CustomField[8] = p_data[6];
- nciPropSetConfig_CustomField[2] = p_data[6] + 6;
- memcpy(nciPropSetConfig_CustomField + 9, p_data + 7, p_data[6]);
- nciPropSetConfig_CustomField[13] = mFWInfo->chipUwbVersion >> 8;
- nciPropSetConfig_CustomField[14] = mFWInfo->chipUwbVersion;
-
- if (!HalSendDownstream(mHalHandle, nciPropSetConfig_CustomField,
- nciPropSetConfig_CustomField[2] + 3)) {
- STLOG_HAL_E("%s - SendDownstream failed", __func__);
- }
-
- mCustomParamDone = true;
-
- } else {
- I2cResetPulse();
- if (mUwbConfigNeeded) {
- mCustomParamDone = false;
- mGetCustomerField = false;
- hal_wrapper_set_state(HAL_WRAPPER_STATE_APPLY_UWB_PARAM);
- }
+ I2cResetPulse();
+ if (mUwbConfigNeeded) {
+ mCustomParamDone = false;
+ mGetCustomerField = false;
+ hal_wrapper_set_state(HAL_WRAPPER_STATE_APPLY_UWB_PARAM);
}
}
}
+ }
- // Check if an error has occurred for PROP_SET_CONFIG_CMD
- // Only log a warning, do not exit code
- if (p_data[3] != 0x00) {
- STLOG_HAL_D("%s - Error in custom file, continue anyway", __func__);
+ // Check if an error has occurred for PROP_SET_CONFIG_CMD
+ // Only log a warning, do not exit code
+ if (p_data[3] != 0x00) {
+ STLOG_HAL_D("%s - Error in custom file, continue anyway", __func__);
+ }
+
+ break;
+
+ case 0x60: //
+ if (p_data[1] == 0x0) {
+ if (p_data[3] == 0xa0) {
+ mFWInfo->hibernate_exited = 1;
+ }
+ if (!HalSendDownstream(mHalHandle, coreInitCmd, sizeof(coreInitCmd))) {
+ STLOG_HAL_E("%s - SendDownstream failed", __func__);
}
- break;
-
- case 0x60: //
- if (p_data[1] == 0x0) {
- if (p_data[3] == 0xa0) {
- mFWInfo->hibernate_exited = 1;
- }
- if (!HalSendDownstream(mHalHandle, coreInitCmd,
- sizeof(coreInitCmd))) {
- STLOG_HAL_E("%s - SendDownstream failed", __func__);
- }
-
- } else if ((p_data[1] == 0x6) && mCustomParamDone) {
- mCustomParamDone = false;
- mGetCustomerField = false;
- hal_wrapper_update_complete();
- }
- break;
- }
+ } else if ((p_data[1] == 0x6) && mCustomParamDone) {
+ mCustomParamDone = false;
+ mGetCustomerField = false;
+ hal_wrapper_update_complete();
+ }
+ break;
}
}
diff --git a/st21nfc/hal/hal_fwlog.cc b/st21nfc/hal/hal_fwlog.cc
new file mode 100644
index 0000000..2cbfbba
--- /dev/null
+++ b/st21nfc/hal/hal_fwlog.cc
@@ -0,0 +1,204 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2023 ST Microelectronics S.A.
+ *
+ * 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.
+ *
+ *
+ ******************************************************************************/
+#define LOG_TAG "NfcHalFwLog"
+
+#include "hal_fwlog.h"
+
+#include <cutils/properties.h>
+#include <dlfcn.h>
+#include <errno.h>
+#include <hardware/nfc.h>
+#include <string.h>
+
+#include "android_logmsg.h"
+#include "hal_fd.h"
+#include "halcore.h"
+
+extern void DispHal(const char* title, const void* data, size_t length);
+
+uint8_t handlePollingLoopData(uint8_t format, uint8_t* tlvBuffer,
+ uint16_t data_len, uint8_t** NewTlv) {
+ uint8_t value_len = 0;
+ uint8_t flag = 0;
+
+ uint32_t timestamp = (tlvBuffer[data_len - 4] << 24) |
+ (tlvBuffer[data_len - 3] << 16) |
+ (tlvBuffer[data_len - 2] << 8) | tlvBuffer[data_len - 1];
+
+ uint32_t ts = 0;
+
+ if ((format & 0x30) == 0x30) {
+ // ST54L: 3.95us unit
+ ts = (uint32_t)(((timestamp * 1024) / 259) + 0.5);
+ } else {
+ // ST54J/K: 4.57us unit
+ ts = (uint32_t)(((timestamp * 128) / 28) + 0.5);
+ }
+
+ int t = tlvBuffer[0];
+
+ switch (t) {
+ case T_fieldOn:
+ case T_fieldOff:
+ STLOG_HAL_D("%s - FieldOn/Off", __func__);
+ *NewTlv = (uint8_t*)malloc(9 * sizeof(uint8_t));
+ value_len = 0x06;
+ (*NewTlv)[0] = TYPE_REMOTE_FIELD;
+ (*NewTlv)[1] = flag;
+ (*NewTlv)[2] = value_len;
+ (*NewTlv)[3] = (ts >> 24) & 0xFF;
+ (*NewTlv)[4] = (ts >> 16) & 0xFF;
+ (*NewTlv)[5] = (ts >> 8) & 0xFF;
+ (*NewTlv)[6] = ts & 0xFF;
+ (*NewTlv)[7] = 0xFF;
+ (*NewTlv)[8] = (t == T_fieldOn) ? 0x1 : 0x0;
+ break;
+ case T_CERxError:
+ case T_CERx: {
+ STLOG_HAL_D("%s - T_CERx", __func__);
+ int tlv_size = tlvBuffer[1] - 2;
+ if (tlv_size < 9) {
+ tlv_size = 8;
+ }
+
+ // work-around type-A short frame notification bug
+ if (hal_fd_getFwInfo() != NULL) {
+ if (hal_fd_getFwInfo()->chipHwVersion == HW_ST54J &&
+ (tlvBuffer[2] & 0xF) == 0x01 && // short frame
+ tlvBuffer[5] == 0x00 && // no error
+ tlvBuffer[6] == 0x0F // incorrect real size
+ ) {
+ tlv_size = 9;
+ }
+ } else {
+ return 0;
+ }
+
+ value_len = tlv_size - 3;
+ *NewTlv = (uint8_t*)malloc(tlv_size * sizeof(uint8_t));
+ uint8_t gain;
+ uint8_t type;
+ int length_value = tlv_size - 8;
+ gain = (tlvBuffer[3] & 0xF0) >> 4;
+
+ switch (tlvBuffer[2] & 0xF) {
+ case 0x1:
+ flag |= 0x01;
+ type = TYPE_A;
+ break;
+ case 0x2:
+ case 0x3:
+ case 0x4:
+ case 0x5:
+ case 0x6:
+ case 0xB:
+ case 0xD:
+ type = TYPE_A;
+ break;
+ case 0x7:
+ case 0xC:
+ type = TYPE_B;
+ break;
+ case 0x8:
+ case 0x9:
+ type = TYPE_F;
+ break;
+ case 0xA:
+ type = TYPE_V;
+ break;
+ default:
+ type = TYPE_UNKNOWN;
+ break;
+ }
+ if ((tlvBuffer[5] != 0) ||
+ ((type == TYPE_A) &&
+ (tlvBuffer[8] != 0x26 && tlvBuffer[8] != 0x52)) ||
+ ((type == TYPE_B) && (tlvBuffer[8] != 0x05) &&
+ (length_value == 0x3))) {
+ // if error flag is set, consider the frame as unknown.
+ type = TYPE_UNKNOWN;
+ }
+ (*NewTlv)[0] = type;
+ (*NewTlv)[1] = flag;
+ (*NewTlv)[2] = value_len;
+ (*NewTlv)[3] = (ts >> 24) & 0xFF;
+ (*NewTlv)[4] = (ts >> 16) & 0xFF;
+ (*NewTlv)[5] = (ts >> 8) & 0xFF;
+ (*NewTlv)[6] = ts & 0xFF;
+ (*NewTlv)[7] = gain;
+ if (tlv_size > 8) {
+ memcpy(*NewTlv + 8, tlvBuffer + 8, length_value);
+ }
+ } break;
+ default:
+ break;
+ }
+ if (value_len)
+ return value_len + 3;
+ else
+ return 0;
+}
+
+int notifyPollingLoopFrames(uint8_t* p_data, uint16_t data_len,
+ uint8_t* bufferToSend) {
+ int current_tlv_length = 0;
+ int tlv_len = 0;
+ int ntf_len = 4;
+ uint8_t* tlvFormatted = NULL;
+ uint8_t* ObserverNtf = NULL;
+ uint8_t* PreviousObserverNtf;
+ uint8_t NCI_ANDROID_PASSIVE_OBSERVER_HEADER[4] = {0x6f, 0xc, 0x01, 0x3};
+
+ for (int current_tlv_pos = 6;
+ current_tlv_pos + p_data[current_tlv_pos + 1] + 2 <= data_len;
+ current_tlv_pos += current_tlv_length) {
+ current_tlv_length = p_data[current_tlv_pos + 1] + 2;
+ uint8_t* tlvBuffer = p_data + current_tlv_pos;
+
+ tlv_len = handlePollingLoopData(p_data[3], tlvBuffer, current_tlv_length,
+ &tlvFormatted);
+
+ if (tlvFormatted != NULL) {
+ if (ObserverNtf == NULL) {
+ ObserverNtf = (uint8_t*)malloc(4 * sizeof(uint8_t));
+ memcpy(ObserverNtf, NCI_ANDROID_PASSIVE_OBSERVER_HEADER, 4);
+ }
+
+ PreviousObserverNtf = ObserverNtf;
+
+ ObserverNtf = (uint8_t*)malloc((ntf_len + tlv_len) * sizeof(uint8_t));
+ memcpy(ObserverNtf, PreviousObserverNtf, ntf_len);
+ memcpy(ObserverNtf + ntf_len, tlvFormatted, tlv_len);
+ ObserverNtf[2] = ntf_len + tlv_len - 3;
+ ntf_len += tlv_len;
+ free(tlvFormatted);
+ tlvFormatted = NULL;
+ free(PreviousObserverNtf);
+ }
+ }
+ if (ObserverNtf != nullptr) {
+ if (ntf_len <= 258) {
+ memcpy(bufferToSend, ObserverNtf, ntf_len);
+ }
+ free(ObserverNtf);
+ return ntf_len;
+ } else {
+ return 0;
+ }
+}
diff --git a/st21nfc/hal/hal_fwlog.h b/st21nfc/hal/hal_fwlog.h
new file mode 100644
index 0000000..c7d17a7
--- /dev/null
+++ b/st21nfc/hal/hal_fwlog.h
@@ -0,0 +1,53 @@
+/** ----------------------------------------------------------------------
+ *
+ * Copyright (C) 2023 ST Microelectronics S.A.
+ *
+ * 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.
+ *
+ *
+ ----------------------------------------------------------------------*/
+#
+
+#ifndef HAL_FWLOG_H_
+#define HAL_FWLOG_H_
+
+#include "halcore.h"
+
+static const int T_CERx = 0x09;
+static const int T_fieldOn = 0x10;
+static const int T_fieldOff = 0x11;
+static const int T_CERxError = 0x19;
+
+static const uint8_t PROPRIETARY_GID = 0x6F;
+static const uint8_t ANDROID_OID = 0x0C;
+static const uint8_t TYPE_REMOTE_FIELD = 0x00;
+static const uint8_t TYPE_A = 0x01;
+static const uint8_t TYPE_B = 0x02;
+static const uint8_t TYPE_F = 0x03;
+static const uint8_t TYPE_V = 0x04;
+
+static const uint8_t TYPE_UNKNOWN = 0x07;
+
+typedef union timestamp_bytes {
+ uint8_t ts1;
+ uint8_t ts2;
+ uint8_t ts3;
+ uint8_t ts4;
+} timestamp_bytes;
+
+int notifyPollingLoopFrames(uint8_t* p_data, uint16_t data_len,
+ uint8_t* bufferToSend);
+uint8_t handlePollingLoopData(uint8_t* tlvBuffer, uint16_t data_len,
+ uint8_t** NewTlv);
+
+#endif
diff --git a/st21nfc/hal/halcore.cc b/st21nfc/hal/halcore.cc
index f785e81..599e298 100644
--- a/st21nfc/hal/halcore.cc
+++ b/st21nfc/hal/halcore.cc
@@ -35,12 +35,23 @@
extern void DispHal(const char* title, const void* data, size_t length);
extern uint32_t ScrProtocolTraceFlag; // = SCR_PROTO_TRACE_ALL;
-extern bool is_st_stack;
// HAL WRAPPER
static void HalStopTimer(HalInstance* inst);
static bool rf_deactivate_delay;
struct timespec start_tx_data;
+uint8_t NCI_ANDROID_GET_CAPS[] = {0x2f, 0x0c, 0x01, 0x0};
+uint8_t NCI_ANDROID_GET_CAPS_RSP[] = {
+ 0x4f, 0x0c,
+ 0x14, // Command length
+ 0x00, 0x00, 0x00, 0x00,
+ 0x05, // Nb of capabilities
+ 0x00, 0x01, 0x01, // Passive Observe mode
+ 0x01, 0x01, 0x01, // Polling frame ntf
+ 0x03, 0x01, 0x00, // Autotransact polling loop filter
+ 0x04, 0x01, 0x05, // Nb of max exit frame entries
+ 0x05, 0x01, 0x01 // Polling loop annotations
+};
/**************************************************************************************************
*
@@ -105,13 +116,34 @@
}
STLOG_HAL_V("!! got event HAL_EVENT_DSWRITE for %zu bytes\n", length);
- DispHal("TX DATA H2K", (data), length);
+ DispHal("TX DATA", (data), length);
+ if (length == 4 &&
+ !memcmp(data, NCI_ANDROID_GET_CAPS, sizeof(NCI_ANDROID_GET_CAPS))) {
+ NCI_ANDROID_GET_CAPS_RSP[2] = sizeof(NCI_ANDROID_GET_CAPS_RSP) - 3;
+ NCI_ANDROID_GET_CAPS_RSP[10] = hal_fd_getFwCap()->ObserveMode;
+ NCI_ANDROID_GET_CAPS_RSP[16] = hal_fd_getFwCap()->ExitFrameSupport;
+ uint8_t FWVersionMajor =
+ (uint8_t)(hal_fd_getFwInfo()->chipFwVersion >> 24);
+ uint8_t FWVersionMinor =
+ (uint8_t)((hal_fd_getFwInfo()->chipFwVersion & 0x00FF0000) >> 16);
+ // Declare support for reader mode annotation only if fw version
+ // >= 2.06.
+ if (hal_fd_getFwInfo()->chipHwVersion == HW_ST54L &&
+ (FWVersionMajor >= 0x2) && (FWVersionMinor >= 0x6)) {
+ NCI_ANDROID_GET_CAPS_RSP[22] = 1;
+ } else {
+ NCI_ANDROID_GET_CAPS_RSP[22] = 0;
+ }
+ dev->p_data_cback(sizeof(NCI_ANDROID_GET_CAPS_RSP),
+ NCI_ANDROID_GET_CAPS_RSP);
+ } else {
// Send write command to IO thread
cmd = 'W';
I2cWriteCmd(&cmd, sizeof(cmd));
I2cWriteCmd((const uint8_t*)&length, sizeof(length));
I2cWriteCmd(data, length);
+ }
break;
case HAL_EVENT_DATAIND:
@@ -167,7 +199,6 @@
}
*/
STLOG_HAL_V("HalCreate enter\n");
- is_st_stack = false;
HalInstance* inst = (HalInstance*)calloc(1, sizeof(HalInstance));
diff --git a/st21nfc/hal_wrapper.cc b/st21nfc/hal_wrapper.cc
index ce65d71..5ba7bc1 100644
--- a/st21nfc/hal_wrapper.cc
+++ b/st21nfc/hal_wrapper.cc
@@ -21,7 +21,6 @@
#include <errno.h>
#include <hardware/nfc.h>
#include <log/log.h>
-#include <stpropnci.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
@@ -29,6 +28,7 @@
#include "android_logmsg.h"
#include "hal_event_logger.h"
#include "hal_fd.h"
+#include "hal_fwlog.h"
#include "halcore.h"
#include "i2clayer.h"
#include "st21nfc_dev.h"
@@ -50,9 +50,6 @@
hal_wrapper_state_e mHalWrapperState = HAL_WRAPPER_STATE_CLOSED;
HALHANDLE mHalHandle = NULL;
-/* Did we detect ST custom NFC stack ? */
-bool is_st_stack = false;
-
uint8_t mClfMode;
uint8_t mFwUpdateTaskMask;
int mRetryFwDwl;
@@ -84,10 +81,6 @@
bool mFieldInfoTimerStarted = false;
bool forceRecover = false;
unsigned long hal_field_timer = 0;
-unsigned long hal_activerw_timer = 0;
-struct halconfig mHalconfig;
-uint8_t propmsg[258];
-uint16_t propmsgLen;
static bool sEnableFwLog = false;
uint8_t mObserverMode = 0;
@@ -100,18 +93,6 @@
bool mDisplayFwLog = false;
-static inline void callHalWrapperDataCallback(uint16_t data_len,
- uint8_t* p_data) {
- if (stpropnci_process(MSG_DIR_FROM_NFCC, p_data, data_len)) {
- // STLOG_HAL_V("%s - message intercepted by stpropnci_process, drop",
- // __func__);
- return;
- }
-
- // Other cases, we send the frame to stack
- mHalWrapperDataCallback(data_len, p_data); // send to the stack
-}
-
void wait_ready() {
pthread_mutex_lock(&mutex);
while (!ready_flag) {
@@ -127,22 +108,6 @@
pthread_mutex_unlock(&mutex);
}
-static void stpropnci_cb(bool dir_to_nfcc, uint8_t* payload,
- uint16_t payloadlen) {
- STLOG_HAL_D("NFC-NCI HAL: %s dir:%d hdr:%02hhx%02hhx%02hhx", __func__,
- dir_to_nfcc, payload[0], payload[1], payload[2]);
- if (dir_to_nfcc == MSG_DIR_TO_NFCC) {
- // send downward
- if (!HalSendDownstream(mHalHandle, payload, payloadlen)) {
- STLOG_HAL_D("NFC-NCI HAL: %s failed to send downstream", __func__);
- }
- } else {
- // Log message Hal to Stack
- DispHal("RX DATA H2S", (payload), payloadlen);
- mHalWrapperDataCallback(payloadlen, (payload)); // send to the stack
- }
-}
-
bool hal_wrapper_open(st21nfc_dev_t* dev, nfc_stack_callback_t* p_cback,
nfc_stack_data_callback_t* p_data_cback,
HALHANDLE* pHandle) {
@@ -151,26 +116,7 @@
STLOG_HAL_D("%s", __func__);
set_ready(0);
- // Initializing structure holding some HAL configs
- memset(&mHalconfig, 0, sizeof(halconfig));
-
mFwUpdateResMask = hal_fd_init();
-
- // init the stnciprop library
- if (!stpropnci_init((int)hal_trace_level, stpropnci_cb)) {
- return -1;
- }
-
- // update config
- GetNumValue(NAME_STNFC_ACTIVERW_TIMER, &hal_activerw_timer,
- sizeof(hal_activerw_timer));
- GetNumValue(NAME_STNFC_REMOTE_FIELD_TIMER, &hal_field_timer,
- sizeof(hal_field_timer));
- mHalconfig.hal_trace_level = (int)hal_trace_level;
- mHalconfig.hal_activerw_timer = (int)hal_activerw_timer;
- mHalconfig.hal_field_timer = (int)hal_field_timer;
- stpropnci_config_settings (mHalconfig);
-
mRetryFwDwl = 5;
mFwUpdateTaskMask = 0;
@@ -178,7 +124,7 @@
mHciCreditLent = false;
mReadFwConfigDone = false;
mError_count = 0;
- is_st_stack = false;
+
mObserverMode = 0;
mObserverRsp = false;
mObserveModeSuspended = false;
@@ -214,7 +160,6 @@
uint8_t propNfcModeSetCmdQb[] = {0x2f, 0x02, 0x02, 0x02, (uint8_t)nfc_mode};
mHalWrapperState = HAL_WRAPPER_STATE_CLOSING;
- is_st_stack = false;
HalEventLogger::getInstance().log() << __func__ << std::endl;
// Send PROP_NFC_MODE_SET_CMD
HalEventLogger::getInstance().store_timer_activity("close", 100);
@@ -226,8 +171,6 @@
// Let the CLF receive and process this
usleep(50000);
- stpropnci_deinit();
-
I2cCloseLayer();
if (call_cb) mHalWrapperCallback(HAL_NFC_CLOSE_CPLT_EVT, HAL_NFC_STATUS_OK);
@@ -308,6 +251,22 @@
int mObserverLength = 0;
int nciPropEnableFwDbgTraces_size = sizeof(nciPropEnableFwDbgTraces);
+ if (mObserverMode && !mObserveModeSuspended && (p_data[0] == 0x6f) && (p_data[1] == 0x02)) {
+ if (mObserveModeSuspendPendingNotifyPollingLoop){
+ mObserveModeSuspended = true;
+ mObserveModeSuspendPendingNotifyPollingLoop = false;
+ }
+ // Firmware logs must not be formatted before sending to upper layer.
+ if ((mObserverLength = notifyPollingLoopFrames(
+ p_data, data_len, nciAndroidPassiveObserver)) > 0) {
+ DispHal("RX DATA", (nciAndroidPassiveObserver), mObserverLength);
+ mHalWrapperDataCallback(mObserverLength, nciAndroidPassiveObserver);
+ }
+ }
+ if ((p_data[0] == 0x4f) && (p_data[1] == 0x0c)) {
+ DispHal("RX DATA", (p_data), data_len);
+ }
+
switch (mHalWrapperState) {
case HAL_WRAPPER_STATE_CLOSED: // 0
STLOG_HAL_V("%s - mHalWrapperState = HAL_WRAPPER_STATE_CLOSED", __func__);
@@ -315,7 +274,6 @@
case HAL_WRAPPER_STATE_OPEN: // 1
// CORE_RESET_NTF
STLOG_HAL_V("%s - mHalWrapperState = HAL_WRAPPER_STATE_OPEN", __func__);
- stpropnci_inform(false, p_data, data_len);
if ((p_data[0] == 0x60) && (p_data[1] == 0x00)) {
mIsActiveRW = false;
@@ -405,14 +363,13 @@
}
}
} else {
- callHalWrapperDataCallback(data_len, p_data);
+ mHalWrapperDataCallback(data_len, p_data);
}
set_ready(1);
break;
case HAL_WRAPPER_STATE_OPEN_CPLT: // 2
STLOG_HAL_V("%s - mHalWrapperState = HAL_WRAPPER_STATE_OPEN_CPLT",
__func__);
- stpropnci_inform(false, p_data, data_len);
// CORE_INIT_RSP
if ((p_data[0] == 0x40) && (p_data[1] == 0x01)) {
} else if ((p_data[0] == 0x60) && (p_data[1] == 0x06)) {
@@ -428,14 +385,13 @@
__func__);
}
} else {
- callHalWrapperDataCallback(data_len, p_data);
+ mHalWrapperDataCallback(data_len, p_data);
}
break;
case HAL_WRAPPER_STATE_NFC_ENABLE_ON: // 3
STLOG_HAL_V("%s - mHalWrapperState = HAL_WRAPPER_STATE_NFC_ENABLE_ON",
__func__);
- stpropnci_inform(false, p_data, data_len);
// PROP_NFC_MODE_SET_RSP
if ((p_data[0] == 0x4f) && (p_data[1] == 0x02)) {
// DO nothing: wait for core_reset_ntf or timer timeout
@@ -446,7 +402,7 @@
HalSendDownstreamStopTimer(mHalHandle);
if (forceRecover == true) {
forceRecover = false;
- callHalWrapperDataCallback(data_len, p_data);
+ mHalWrapperDataCallback(data_len, p_data);
break;
}
@@ -467,14 +423,13 @@
}
mHalWrapperState = HAL_WRAPPER_STATE_READY;
- callHalWrapperDataCallback(data_len, p_data);
+ mHalWrapperDataCallback(data_len, p_data);
}
break;
case HAL_WRAPPER_STATE_PROP_CONFIG: // 4
STLOG_HAL_V("%s - mHalWrapperState = HAL_WRAPPER_STATE_PROP_CONFIG",
__func__);
- stpropnci_inform(false, p_data, data_len);
// CORE_SET_CONFIG_RSP
if ((p_data[0] == 0x40) && (p_data[1] == 0x02)) {
HalSendDownstreamStopTimer(mHalHandle);
@@ -500,7 +455,7 @@
}
}
}
- callHalWrapperDataCallback(data_len, p_data);
+ mHalWrapperDataCallback(data_len, p_data);
} else if (p_data[0] == 0x4f) {
// PROP_RSP
if (mReadFwConfigDone == true) {
@@ -611,6 +566,95 @@
case HAL_WRAPPER_STATE_READY: // 5
STLOG_HAL_V("%s - mHalWrapperState = HAL_WRAPPER_STATE_READY", __func__);
+ if (mObserverRsp) {
+ if (((p_data[0] == 0x41) && (p_data[1] == 0x16)) ||
+ ((p_data[0] == 0x40) && (p_data[1] == 0x02))) {
+ uint8_t rsp_status = p_data[3];
+ mObserverRsp = false;
+ p_data[0] = 0x4f;
+ p_data[1] = 0x0c;
+ p_data[2] = 0x02;
+ p_data[3] = mPerTechCmdRsp ? 0x05 : 0x02;
+ p_data[4] = rsp_status;
+ data_len = 0x5;
+ } else if (((p_data[0] == 0x41) && (p_data[1] == 0x17) &&
+ (data_len > 4)) ||
+ ((p_data[0] == 0x40) && (p_data[1] == 0x03) &&
+ (data_len > 7))) {
+ uint8_t rsp_status = p_data[3];
+ mObserverRsp = false;
+ if (hal_fd_getFwCap()->ObserveMode == 2) {
+ if (p_data[4] != mObserverMode) {
+ STLOG_HAL_E("mObserverMode got out of sync");
+ mObserverMode = p_data[4];
+ }
+ if (!mObserveModeSuspended) {
+ p_data[5] = p_data[4];
+ } else {
+ p_data[5] = 0x00;
+ }
+ } else {
+ if (p_data[7] != mObserverMode) {
+ STLOG_HAL_E("mObserverMode got out of sync");
+ mObserverMode = p_data[7];
+ }
+ p_data[5] = p_data[7];
+ }
+ p_data[0] = 0x4f;
+ p_data[1] = 0x0c;
+ p_data[2] = 0x03;
+ p_data[3] = 0x04;
+ p_data[4] = rsp_status;
+ data_len = 0x6;
+ DispHal("RX DATA", (p_data), data_len);
+ }
+ }
+
+ if ((p_data[0] == 0x4f) && (p_data[1] == 0x19)) {
+ p_data[4] = p_data[3];
+ p_data[0] = 0x4f;
+ p_data[1] = 0x0c;
+ p_data[2] = 0x02;
+ p_data[3] = 0x06;
+ data_len = 0x5;
+ DispHal("RX DATA", (p_data), data_len);
+ } else if ((p_data[0] == 0x6f) && (p_data[1] == 0x1b)) {
+ // PROP_RF_OBSERVE_MODE_SUSPENDED_NTF
+ mObserveModeSuspendPendingNotifyPollingLoop = true;
+ // Remove two byte CRC at end of frame.
+ data_len -= 2;
+ p_data[2] -= 2;
+ p_data[4] -= 2;
+ memcpy(nciAndroidPassiveObserver, p_data + 3, data_len - 3);
+
+ p_data[0] = 0x6f;
+ p_data[1] = 0x0c;
+ p_data[2] = p_data[2] + 1;
+ p_data[3] = 0xB;
+ memcpy(p_data + 4, nciAndroidPassiveObserver, data_len - 3);
+ data_len = data_len + 1;
+ DispHal("RX DATA", (p_data), data_len);
+ } else if ((p_data[0] == 0x6f) && (p_data[1] == 0x1c)) {
+ // PROP_RF_OBSERVE_MODE_RESUMED_NTF
+ mObserveModeSuspended = false;
+
+ p_data[0] = 0x6f;
+ p_data[1] = 0x0c;
+ p_data[2] = p_data[2] + 1;
+ p_data[3] = 0xC;
+ data_len = data_len + 1;
+ DispHal("RX DATA", (p_data), data_len);
+ } else if ((p_data[0] == 0x4f) && (p_data[1] == 0x1d)) {
+ // PROP_RF_SET_CUST_PASSIVE_POLL_FRAME_RSP
+ memcpy(nciAndroidPassiveObserver, p_data + 3, data_len - 3);
+ p_data[4] = p_data[3];
+ p_data[0] = 0x4f;
+ p_data[1] = 0x0c;
+ p_data[2] = 0x02;
+ p_data[3] = 0x09;
+ data_len = 0x5;
+ DispHal("RX DATA", (p_data), data_len);
+ }
if (!((p_data[0] == 0x60) && (p_data[3] == 0xa0))) {
if (mHciCreditLent && (p_data[0] == 0x60) && (p_data[1] == 0x06)) {
@@ -643,15 +687,90 @@
mFieldInfoTimerStarted = false;
}
}
- }else if (p_data[0] == 0x60 && p_data[1] == 0x00) {
- stpropnci_inform(false, p_data, data_len);
+ } else if ((p_data[0] == 0x6f) && (p_data[1] == 0x05)) {
+ (void)pthread_mutex_lock(&mutex_activerw);
+ // start timer
+ mTimerStarted = true;
+ mIsActiveRW = true;
+ (void)pthread_mutex_unlock(&mutex_activerw);
+ } else if ((p_data[0] == 0x6f) && (p_data[1] == 0x06)) {
+ (void)pthread_mutex_lock(&mutex_activerw);
+ // stop timer
+ if (mTimerStarted) {
+ HalSendDownstreamStopTimer(mHalHandle);
+ mTimerStarted = false;
+ }
+ if (mIsActiveRW == true) {
+ mIsActiveRW = false;
+ } else {
+ mError_count++;
+ STLOG_HAL_E("Error Act -> Act count=%d", mError_count);
+ if (mError_count > 20) {
+ mError_count = 0;
+ STLOG_HAL_E("NFC Recovery Start");
+ mTimerStarted = true;
+ HalEventLogger::getInstance().store_timer_activity(
+ "NFC Recovery Start", 1);
+ HalSendDownstreamTimer(mHalHandle, 1);
+ }
+ }
+ (void)pthread_mutex_unlock(&mutex_activerw);
+ } else if (((p_data[0] == 0x61) && (p_data[1] == 0x05)) ||
+ ((p_data[0] == 0x61) && (p_data[1] == 0x03))) {
+ mError_count = 0;
+ // stop timer
+ if (mFieldInfoTimerStarted) {
+ HalSendDownstreamStopTimer(mHalHandle);
+ mFieldInfoTimerStarted = false;
+ }
+ if (mTimerStarted) {
+ HalSendDownstreamStopTimer(mHalHandle);
+ mTimerStarted = false;
+ }
+ } else if (p_data[0] == 0x60 && p_data[1] == 0x00) {
STLOG_HAL_E("%s - Reset trigger from 0x%x to 0x0", __func__,
p_data[3]);
p_data[3] = 0x0; // Only reset trigger that should be received in
// HAL_WRAPPER_STATE_READY is unreocoverable error.
mHalWrapperState = HAL_WRAPPER_STATE_RECOVERY;
+ } else if (data_len >= 4 && p_data[0] == 0x60 && p_data[1] == 0x07) {
+ if (p_data[3] == 0xE1) {
+ // Core Generic Error - Buffer Overflow Ntf - Restart all
+ STLOG_HAL_E("Core Generic Error - restart");
+ p_data[0] = 0x60;
+ p_data[1] = 0x00;
+ p_data[2] = 0x03;
+ p_data[3] = 0xE1;
+ p_data[4] = 0x00;
+ p_data[5] = 0x00;
+ data_len = 0x6;
+ mHalWrapperState = HAL_WRAPPER_STATE_RECOVERY;
+ } else if (p_data[3] == 0xE6) {
+ unsigned long hal_ctrl_clk = 0;
+ GetNumValue(NAME_STNFC_CONTROL_CLK, &hal_ctrl_clk,
+ sizeof(hal_ctrl_clk));
+ if (hal_ctrl_clk) {
+ STLOG_HAL_E("%s - Clock Error - restart", __func__);
+ STLOG_HAL_E("%s ST21NFC_CLK_STATE:%d", __func__,
+ ioctl(fidI2c, ST21NFC_CLK_STATE, NULL));
+ // Core Generic Error
+ p_data[0] = 0x60;
+ p_data[1] = 0x00;
+ p_data[2] = 0x03;
+ p_data[3] = 0xE6;
+ p_data[4] = 0x00;
+ p_data[5] = 0x00;
+ data_len = 0x6;
+ mHalWrapperState = HAL_WRAPPER_STATE_RECOVERY;
+ }
+ } else if (p_data[3] == 0xA1) {
+ if (mFieldInfoTimerStarted) {
+ HalSendDownstreamStopTimer(mHalHandle);
+ mFieldInfoTimerStarted = false;
+ }
+ }
}
- callHalWrapperDataCallback(data_len, p_data);
+ mHalWrapperDataCallback(data_len, p_data);
} else {
STLOG_HAL_V("%s - Core reset notification - Nfc mode ", __func__);
}
@@ -660,13 +779,12 @@
case HAL_WRAPPER_STATE_CLOSING: // 6
STLOG_HAL_V("%s - mHalWrapperState = HAL_WRAPPER_STATE_CLOSING",
__func__);
- stpropnci_inform(false, p_data, data_len);
+ hal_fd_close();
if ((p_data[0] == 0x4f) && (p_data[1] == 0x02)) {
- hal_fd_close();
// intercept this expected message, don t forward.
mHalWrapperState = HAL_WRAPPER_STATE_CLOSED;
} else {
- callHalWrapperDataCallback(data_len, p_data);
+ mHalWrapperDataCallback(data_len, p_data);
}
break;
@@ -679,14 +797,12 @@
case HAL_WRAPPER_STATE_UPDATE: // 7
STLOG_HAL_V("%s - mHalWrapperState = HAL_WRAPPER_STATE_UPDATE", __func__);
- stpropnci_inform(false, p_data, data_len);
FwUpdateHandler(mHalHandle, data_len, p_data);
break;
case HAL_WRAPPER_STATE_APPLY_CUSTOM_PARAM: // 8
STLOG_HAL_V(
"%s - mHalWrapperState = HAL_WRAPPER_STATE_APPLY_CUSTOM_PARAM",
__func__);
- stpropnci_inform(false, p_data, data_len);
ApplyCustomParamHandler(mHalHandle, data_len, p_data);
break;
case HAL_WRAPPER_STATE_APPLY_UWB_PARAM: // 9
@@ -694,6 +810,26 @@
__func__);
ApplyUwbParamHandler(mHalHandle, data_len, p_data);
break;
+ case HAL_WRAPPER_STATE_SET_ACTIVERW_TIMER: // 10
+ (void)pthread_mutex_lock(&mutex_activerw);
+ if (mIsActiveRW == true) {
+ STLOG_HAL_D(
+ "%s - mHalWrapperState = "
+ "HAL_WRAPPER_STATE_SET_ACTIVERW_TIMER",
+ __func__);
+ // start timer
+ mTimerStarted = true;
+ HalEventLogger::getInstance().store_timer_activity("SET_ACTIVERW_TIMER",
+ 5000);
+ HalSendDownstreamTimer(mHalHandle, 5000);
+ // Chip state should back to Active
+ // at screen off state.
+ }
+ (void)pthread_mutex_unlock(&mutex_activerw);
+ mHalWrapperState = HAL_WRAPPER_STATE_READY;
+ mHalWrapperDataCallback(data_len, p_data);
+ break;
+
case HAL_WRAPPER_STATE_APPLY_PROP_CONFIG:
STLOG_HAL_V("%s - mHalWrapperState = HAL_WRAPPER_STATE_APPLY_PROP_CONFIG",
__func__);
@@ -836,7 +972,7 @@
p_data[4] = 0x00;
p_data[5] = 0x00;
data_len = 0x6;
- callHalWrapperDataCallback(data_len, p_data);
+ mHalWrapperDataCallback(data_len, p_data);
mHalWrapperState = HAL_WRAPPER_STATE_RECOVERY;
}
return;
@@ -856,7 +992,7 @@
p_data[4] = 0x00;
p_data[5] = 0x00;
data_len = 0x6;
- callHalWrapperDataCallback(data_len, p_data);
+ mHalWrapperDataCallback(data_len, p_data);
mHalWrapperState = HAL_WRAPPER_STATE_OPEN;
return;
}
@@ -875,7 +1011,7 @@
p_data[4] = 0x00;
p_data[5] = 0x00;
data_len = 0x6;
- callHalWrapperDataCallback(data_len, p_data);
+ mHalWrapperDataCallback(data_len, p_data);
mHalWrapperState = HAL_WRAPPER_STATE_OPEN;
return;
}
@@ -894,7 +1030,7 @@
p_data[4] = 0x00;
p_data[5] = 0x00;
data_len = 0x6;
- callHalWrapperDataCallback(data_len, p_data);
+ mHalWrapperDataCallback(data_len, p_data);
mHalWrapperState = HAL_WRAPPER_STATE_OPEN;
return;
}
@@ -1012,6 +1148,8 @@
return "HAL_WRAPPER_STATE_APPLY_CUSTOM_PARAM";
case HAL_WRAPPER_STATE_APPLY_UWB_PARAM:
return "HAL_WRAPPER_STATE_APPLY_UWB_PARAM";
+ case HAL_WRAPPER_STATE_SET_ACTIVERW_TIMER:
+ return "HAL_WRAPPER_STATE_SET_ACTIVERW_TIMER";
case HAL_WRAPPER_STATE_APPLY_PROP_CONFIG:
return "HAL_WRAPPER_STATE_APPLY_PROP_CONFIG";
case HAL_WRAPPER_STATE_RECOVERY:
diff --git a/st21nfc/include/hal_config.h b/st21nfc/include/hal_config.h
index f6bcc56..cb2616a 100644
--- a/st21nfc/include/hal_config.h
+++ b/st21nfc/include/hal_config.h
@@ -47,7 +47,5 @@
#define NAME_ST_NFC_RESET_REQ_SYSFS "ST_NFC_RESET_REQ_SYSFS"
#define NAME_HAL_EVENT_LOG_DEBUG_ENABLED "HAL_EVENT_LOG_DEBUG_ENABLED"
#define NAME_HAL_EVENT_LOG_STORAGE "HAL_EVENT_LOG_STORAGE"
-#define NAME_STNFC_CMD_DELAY_IN_RAWMODE_MS "STNFC_CMD_DELAY_IN_RAWMODE_MS"
-#define NAME_OFF_HOST_SIM_PIPE_IDS "OFF_HOST_SIM_PIPE_IDS"
-#define NAME_T4T_NFCEE_ENABLE "T4T_NFCEE_ENABLE"
+
#endif
diff --git a/st21nfc/include/halcore.h b/st21nfc/include/halcore.h
index 25f772c..5b65008 100644
--- a/st21nfc/include/halcore.h
+++ b/st21nfc/include/halcore.h
@@ -55,6 +55,7 @@
HAL_WRAPPER_STATE_UPDATE,
HAL_WRAPPER_STATE_APPLY_CUSTOM_PARAM,
HAL_WRAPPER_STATE_APPLY_UWB_PARAM,
+ HAL_WRAPPER_STATE_SET_ACTIVERW_TIMER,
HAL_WRAPPER_STATE_APPLY_PROP_CONFIG,
HAL_WRAPPER_STATE_RECOVERY,
} hal_wrapper_state_e;