AID-matching-requirements-added-for-prefi
diff --git a/halimpl/pn54x/libnfc-brcm_NCI2_0.conf b/halimpl/pn54x/libnfc-brcm_NCI2_0.conf
index 89fd2f9..0eca62c 100644
--- a/halimpl/pn54x/libnfc-brcm_NCI2_0.conf
+++ b/halimpl/pn54x/libnfc-brcm_NCI2_0.conf
@@ -379,7 +379,8 @@
#AID_MATCHING_EXACT_ONLY 0x00
#AID_MATCHING_EXACT_OR_PREFIX 0x01
#AID_MATCHING_PREFIX_ONLY 0x02
-AID_MATCHING_MODE=0x01
+#AID_MATCHING_EXACT_OR_SUBSET_OR_PREFIX 0x03
+AID_MATCHING_MODE=0x03
###############################################################################
#Default Secure Element route id
diff --git a/src/hal/include/nci_defs.h b/src/hal/include/nci_defs.h
index 2d6a905..3de818a 100644
--- a/src/hal/include/nci_defs.h
+++ b/src/hal/include/nci_defs.h
@@ -466,6 +466,10 @@
#define NCI_DISCOVER_PARAM_SIZE_DEACT_RSP 0x01 /* Status (1 octet) */
#define NCI_DISCOVER_PARAM_SIZE_DEACT_NTF 0x01 /* type */
+#define NCI_ROUTE_QUAL_MASK 0x70
+#define NCI_ROUTE_QUAL_LONG_SELECT 0x10 /* AID matching is allowed when the SELECT AID is longer */
+#define NCI_ROUTE_QUAL_SHORT_SELECT 0x20 /* AID matching is allowed when the SELECT AID is shorter */
+#define NCI_ROUTE_QUAL_BLOCK_ROUTE 0x40 /* AID is blocked in unsupported power mode */
/**********************************************
* NCI RF Management / PWR AND LINK CTRl Group Params
**********************************************/
diff --git a/src/nfa/ee/nfa_ee_act.c b/src/nfa/ee/nfa_ee_act.c
old mode 100755
new mode 100644
index 1042de5..a648e88
--- a/src/nfa/ee/nfa_ee_act.c
+++ b/src/nfa/ee/nfa_ee_act.c
@@ -506,17 +506,20 @@
nfa_ee_cb.ecb[xx].aid_len = GKI_getbuf(max_aid_entries);
nfa_ee_cb.ecb[xx].aid_pwr_cfg = GKI_getbuf(max_aid_entries);
nfa_ee_cb.ecb[xx].aid_rt_info = GKI_getbuf(max_aid_entries);
- nfa_ee_cb.ecb[xx].aid_rt_loc = GKI_getbuf(max_aid_entries);
+ nfa_ee_cb.ecb[xx].aid_rt_loc = GKI_getbuf(max_aid_entries);
+ nfa_ee_cb.ecb[xx].aid_info = GKI_getbuf(max_aid_entries);
nfa_ee_cb.ecb[xx].aid_cfg = GKI_getbuf(max_aid_config_length);
if ((NULL != nfa_ee_cb.ecb[xx].aid_len) &&
(NULL != nfa_ee_cb.ecb[xx].aid_pwr_cfg) &&
(NULL != nfa_ee_cb.ecb[xx].aid_rt_info) &&
(NULL != nfa_ee_cb.ecb[xx].aid_rt_loc) &&
+ (NULL != nfa_ee_cb.ecb[xx].aid_info) &&
(NULL != nfa_ee_cb.ecb[xx].aid_cfg)) {
memset(nfa_ee_cb.ecb[xx].aid_len, 0, max_aid_entries);
memset(nfa_ee_cb.ecb[xx].aid_pwr_cfg, 0, max_aid_entries);
memset(nfa_ee_cb.ecb[xx].aid_rt_info, 0, max_aid_entries);
memset(nfa_ee_cb.ecb[xx].aid_rt_loc, 0, max_aid_entries);
+ memset(nfa_ee_cb.ecb[xx].aid_info, 0, max_aid_entries);
memset(nfa_ee_cb.ecb[xx].aid_cfg, 0, max_aid_config_length);
} else {
NFA_TRACE_ERROR0("GKI_getbuf allocation for ECB failed !");
@@ -559,6 +562,7 @@
GKI_freebuf(nfa_ee_cb.ecb[xx].aid_pwr_cfg);
GKI_freebuf(nfa_ee_cb.ecb[xx].aid_rt_info);
GKI_freebuf(nfa_ee_cb.ecb[xx].aid_rt_loc);
+ GKI_freebuf(nfa_ee_cb.ecb[xx].aid_info);
GKI_freebuf(nfa_ee_cb.ecb[xx].aid_cfg);
}
#endif
@@ -785,7 +789,7 @@
#if (NXP_EXTNS == TRUE)
tNFA_EE_ECB* dh_ecb = NULL;
- uint8_t vs_info = p_add->vs_info;
+ uint8_t aid_info = p_add->aid_info;
#endif
tNFA_EE_ECB* p_chk_cb;
uint8_t* p, *p_start;
@@ -813,6 +817,7 @@
"nfa_ee_api_add_aid The AID entry is already in the database");
if (p_chk_cb == p_cb) {
p_cb->aid_rt_info[entry] |= NFA_EE_AE_ROUTE;
+ p_cb->aid_info[entry] = p_add->aid_info;
new_size = nfa_ee_total_lmrt_size();
if (new_size > NFC_GetLmrtSize()) {
NFA_TRACE_ERROR1("Exceed LMRT size:%d (add ROUTE)", new_size);
@@ -820,6 +825,7 @@
p_cb->aid_rt_info[entry] &= ~NFA_EE_AE_ROUTE;
} else {
p_cb->aid_pwr_cfg[entry] = p_add->power_state;
+ p_cb->aid_info[entry] = p_add->aid_info;
}
} else {
NFA_TRACE_ERROR1(
@@ -883,14 +889,13 @@
len = nfa_ee_find_total_aid_len(dh_ecb, 0);
// Always use single aid_cfg buffer to keep the aid order intact.
dh_ecb->aid_pwr_cfg[dh_ecb->aid_entries] = p_add->power_state;
- dh_ecb->aid_rt_info[dh_ecb->aid_entries] =
- NFA_EE_AE_ROUTE |
- ((NFA_EE_AE_NXP_PREFIX_MATCH & vs_info) ? NFA_EE_AE_NXP_PREFIX_MATCH
- : 0x00);
+ dh_ecb->aid_rt_info[dh_ecb->aid_entries] = NFA_EE_AE_ROUTE;
dh_ecb->aid_rt_loc[dh_ecb->aid_entries] = p_cb->nfcee_id;
+ dh_ecb->aid_info[dh_ecb->aid_entries] = p_add->aid_info;
p = dh_ecb->aid_cfg + len;
#else
p_cb->aid_pwr_cfg[p_cb->aid_entries] = p_add->power_state;
+ p_cb->aid_info[p_cb->aid_entries] = p_add->aid_info;
p_cb->aid_rt_info[p_cb->aid_entries] = NFA_EE_AE_ROUTE;
p = p_cb->aid_cfg + len;
#endif
@@ -979,6 +984,8 @@
GKI_shiftup(&p_cb->aid_len[entry], &p_cb->aid_len[entry + 1], rest_len);
GKI_shiftup(&p_cb->aid_pwr_cfg[entry], &p_cb->aid_pwr_cfg[entry + 1],
rest_len);
+ GKI_shiftup(&p_cb->aid_info[entry], &p_cb->aid_info[entry + 1],
+ rest_len);
GKI_shiftup(&p_cb->aid_rt_info[entry], &p_cb->aid_rt_info[entry + 1],
rest_len);
#if (NXP_EXTNS == TRUE)
@@ -1008,11 +1015,13 @@
memset(&p_cb->aid_len[0], 0x00, max_aid_entries);
memset(&p_cb->aid_pwr_cfg[0], 0x00, max_aid_entries);
memset(&p_cb->aid_rt_info[0], 0x00, max_aid_entries);
+ memset(&p_cb->aid_info[0], 0x00, max_aid_entries);
#else
memset(&p_cb->aid_cfg[0], 0x00, sizeof(p_cb->aid_cfg));
memset(&p_cb->aid_len[0], 0x00, NFA_EE_MAX_AID_ENTRIES);
memset(&p_cb->aid_pwr_cfg[0], 0x00, NFA_EE_MAX_AID_ENTRIES);
memset(&p_cb->aid_rt_info[0], 0x00, NFA_EE_MAX_AID_ENTRIES);
+ memset(&p_cb->aid_info[0], 0x00, NFA_EE_MAX_AID_ENTRIES);
#endif
p_cb->aid_entries = 0;
nfa_ee_cb.ee_cfged |= nfa_ee_ecb_to_mask(p_cb);
@@ -1027,11 +1036,13 @@
memset(&p_ecb->aid_len[0], 0x00, max_aid_entries);
memset(&p_ecb->aid_pwr_cfg[0], 0x00, max_aid_entries);
memset(&p_ecb->aid_rt_info[0], 0x00, max_aid_entries);
+ memset(&p_ecb->aid_info[0], 0x00, max_aid_entries);
#else
memset(&p_ecb->aid_cfg[0], 0x00, sizeof(p_ecb->aid_cfg));
memset(&p_ecb->aid_len[0], 0x00, NFA_EE_MAX_AID_ENTRIES);
memset(&p_ecb->aid_pwr_cfg[0], 0x00, NFA_EE_MAX_AID_ENTRIES);
memset(&p_ecb->aid_rt_info[0], 0x00, NFA_EE_MAX_AID_ENTRIES);
+ memset(&p_ecb->aid_info[0], 0x00, NFA_EE_MAX_AID_ENTRIES);
#endif
p_ecb->aid_entries = 0;
p_cb->ecb_flags |= NFA_EE_ECB_FLAGS_AID;
@@ -1816,6 +1827,7 @@
mode_set.status = p_rsp->status;
mode_set.ee_handle = (tNFA_HANDLE)p_rsp->nfcee_id | NFA_HANDLE_GROUP_EE;
mode_set.ee_status = p_cb->ee_status;
+
nfa_ee_report_event(p_cb->p_ee_cback, NFA_EE_MODE_SET_EVT,
(void*)&mode_set);
@@ -2297,6 +2309,7 @@
for (xx = 0; xx < p_cb->aid_entries; xx++) {
/* rememebr the beginning of this AID routing entry, just in case we need
* to put it in next command */
+ uint8_t route_qual = 0;
p_start = pp;
/* add one AID entry */
if ((p_cb->aid_rt_info[xx] & NFA_EE_AE_ROUTE) &&
@@ -2306,20 +2319,15 @@
pa = &p_cb->aid_cfg[start_offset];
pa++; /* EMV tag */
len = *pa++; /* aid_len */
- if (p_cb->aid_rt_info[xx] & NFA_EE_AE_NXP_PREFIX_MATCH) {
- // This aid is for prefix match.
- *pp = NFC_ROUTE_TAG_AID | NFA_EE_AE_NXP_PREFIX_MATCH;
+ if(p_cb->aid_info[xx] & NCI_ROUTE_QUAL_LONG_SELECT)
+ route_qual |= NCI_ROUTE_QUAL_LONG_SELECT;
+ if(p_cb->aid_info[xx] & NCI_ROUTE_QUAL_SHORT_SELECT)
+ route_qual |= NCI_ROUTE_QUAL_SHORT_SELECT;
+ *pp = NFC_ROUTE_TAG_AID | route_qual;
#if (NXP_NFCC_ROUTING_BLOCK_BIT == true)
*pp |= route_blacklist_mask;
#endif
- } else {
- // This aid is for exact match.
- *pp = NFC_ROUTE_TAG_AID;
-#if (NXP_NFCC_ROUTING_BLOCK_BIT == true)
- *pp |= route_blacklist_mask;
-#endif
- }
- *pp++;
+ pp++;
*pp++ = len + 2;
*pp++ = p_cb->aid_rt_loc[xx];
*pp++ = p_cb->aid_pwr_cfg[xx];
@@ -2385,7 +2393,7 @@
*proto_pp |= route_blacklist_mask;
}
#endif
- *proto_pp++;
+ proto_pp++;
*proto_pp++ = 3;
*proto_pp++ = p_cb->nfcee_id;
*proto_pp++ = power_cfg;
@@ -2572,18 +2580,16 @@
pa++; /* EMV tag */
len = *pa++; /* aid_len */
#if (NXP_EXTNS == TRUE)
- if (p_cb->aid_rt_info[xx] & NFA_EE_AE_NXP_PREFIX_MATCH) {
-#if (NXP_NFCC_ROUTING_BLOCK_BIT == false)
- // This aid is for prefix match.
- *pp++ = (NFC_ROUTE_TAG_AID | NFA_EE_AE_NXP_PREFIX_MATCH) |
- (route_blacklist_mask);
-#endif
- } else {
-#if (NXP_NFCC_ROUTING_BLOCK_BIT == false)
+ if(p_cb->aid_info[xx] & NCI_ROUTE_QUAL_LONG_SELECT)
+ route_qual |= NCI_ROUTE_QUAL_LONG_SELECT;
+ if(p_cb->aid_info[xx] & NCI_ROUTE_QUAL_SHORT_SELECT)
+ route_qual |= NCI_ROUTE_QUAL_SHORT_SELECT;
+ *pp = NFC_ROUTE_TAG_AID | route_qual;
+#if (NXP_NFCC_ROUTING_BLOCK_BIT == true)
// This aid is for exact match.
- *pp++ = NFC_ROUTE_TAG_AID | (route_blacklist_mask);
+ *pp |= (route_blacklist_mask);
#endif
- }
+ pp++;
#else
*pp++ = NFC_ROUTE_TAG_AID;
#endif
diff --git a/src/nfa/ee/nfa_ee_api.c b/src/nfa/ee/nfa_ee_api.c
old mode 100755
new mode 100644
index 2e9fba1..80eab8b
--- a/src/nfa/ee/nfa_ee_api.c
+++ b/src/nfa/ee/nfa_ee_api.c
@@ -543,7 +543,7 @@
uint8_t* p_aid, tNFA_EE_PWR_STATE power_state
#if (NXP_EXTNS == TRUE)
,
- uint8_t vs_info)
+ uint8_t aidInfo)
#else
)
#endif
@@ -573,7 +573,7 @@
p_msg->power_state = power_state;
p_msg->p_aid = (uint8_t*)(p_msg + 1);
#if (NXP_EXTNS == TRUE)
- p_msg->vs_info = vs_info;
+ p_msg->aid_info = aidInfo;
#endif
memcpy(p_msg->p_aid, p_aid, aid_len);
diff --git a/src/nfa/int/nfa_ee_int.h b/src/nfa/int/nfa_ee_int.h
index 59ab304..28faeeb 100644
--- a/src/nfa/int/nfa_ee_int.h
+++ b/src/nfa/int/nfa_ee_int.h
@@ -262,6 +262,7 @@
uint8_t* aid_rt_info; /* route/vs info for this AID entry */
uint8_t* aid_rt_loc; /* route location info for this AID entry */
uint8_t* aid_cfg; /* routing entries based on AID */
+ uint8_t* aid_info; /* AID info prefix/subset routing */
#else
uint8_t aid_rt_loc[NFA_EE_MAX_AID_ENTRIES]; /* route location info for this
AID entry */
@@ -279,6 +280,8 @@
uint8_t aid_rt_info[NFA_EE_MAX_AID_ENTRIES]; /* route/vs info for this AID
entry */
uint8_t aid_cfg[NFA_EE_MAX_AID_CFG_LEN]; /* routing entries based on AID */
+ uint8_t aid_info[NFA_EE_MAX_AID_ENTRIES]; /* route/vs info for this AID
+ entry */
#endif
uint8_t aid_entries; /* The number of AID entries in aid_cfg */
uint8_t nfcee_id; /* ID for this NFCEE */
@@ -371,7 +374,7 @@
uint8_t* p_aid;
tNFA_EE_PWR_STATE power_state;
#if (NXP_EXTNS == TRUE)
- uint8_t vs_info;
+ uint8_t aid_info;
#endif
} tNFA_EE_API_ADD_AID;