summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJizhou Liao <Jizhou.Liao@nxp.com>2016-02-17 13:15:35 -0800
committerMartijn Coenen <maco@google.com>2016-02-22 10:39:16 +0100
commit8dfb5021d981bb09092754a351fdec8af91351d3 (patch)
treeaeb5fbd030f3d83e501100c6a3db4b754e9bf29d
parentf9b4ac20fb456d2b6879adf7c5012e18411404af (diff)
downloadlibnfc-nci-8dfb5021d981bb09092754a351fdec8af91351d3.tar.gz
Swap LF_T3T_FLAGS bytes for PN548
PN548 firmware implements LF_T3T_FLAGS in big endian. As NCI spec required, it should present as little endian. This patch is a workaround to swap LF_T3T_FLAGS byte from little endian to big endian. Bug: 22379408
-rw-r--r--halimpl/pn54x/hal/phNxpNciHal_ext.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/halimpl/pn54x/hal/phNxpNciHal_ext.c b/halimpl/pn54x/hal/phNxpNciHal_ext.c
index 2e28efb..8957e44 100644
--- a/halimpl/pn54x/hal/phNxpNciHal_ext.c
+++ b/halimpl/pn54x/hal/phNxpNciHal_ext.c
@@ -924,6 +924,37 @@ NFCSTATUS phNxpNciHal_write_ext(uint16_t *cmd_len, uint8_t *p_cmd_data,
// NXPLOG_NCIHAL_D("> Going - core init optimization - END");
}
}
+
+#if(NFC_NXP_CHIP_TYPE == PN548C2)
+ if (p_cmd_data[0] == 0x20 && p_cmd_data[1] == 0x02)
+ {
+ uint8_t temp;
+ uint8_t *p = p_cmd_data + 4;
+ uint8_t *end = p_cmd_data + *cmd_len;
+ while (p < end)
+ {
+ if (*p == 0x53) //LF_T3T_FLAGS
+ {
+ NXPLOG_NCIHAL_D ("> Going through workaround - LF_T3T_FLAGS swap");
+ temp = *(p + 3);
+ *(p + 3) = *(p + 2);
+ *(p + 2) = temp;
+ NXPLOG_NCIHAL_D ("> Going through workaround - LF_T3T_FLAGS - End");
+ status = NFCSTATUS_SUCCESS;
+ break;
+ }
+ if (*p == 0xA0)
+ {
+ p += *(p + 2) + 3;
+ }
+ else
+ {
+ p += *(p + 1) + 2;
+ }
+ }
+ }
+#endif
+
return status;
}