summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJizhou Liao <Jizhou.Liao@nxp.com>2016-05-31 10:21:02 -0700
committerJizhou Liao <Jizhou.Liao@nxp.com>2016-05-31 10:31:11 -0700
commit7217c70249fac7b3852c0c3a428985e78cd416d4 (patch)
treee6df6e833be5b8a7a5a8a5dcdcf6d9c5044c3a54
parentc0e3e1e612e0ec448c28e3e4fd0e8e26b91e2876 (diff)
downloadlibnfc-nci-7217c70249fac7b3852c0c3a428985e78cd416d4.tar.gz
Fix the syncronization issue between read thread and write thread
NFC stack hang if Read Interrupt is notified even before the write callback is notified. Add 2ms delay to give priority to write thread if it is busy.
-rw-r--r--halimpl/pn54x/tml/phTmlNfc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/halimpl/pn54x/tml/phTmlNfc.c b/halimpl/pn54x/tml/phTmlNfc.c
index e50b49e..3d402df 100644
--- a/halimpl/pn54x/tml/phTmlNfc.c
+++ b/halimpl/pn54x/tml/phTmlNfc.c
@@ -394,6 +394,11 @@ static void phTmlNfc_TmlThread(void *pParam)
gpphTmlNfc_Context->bWriteCbInvoked = FALSE;
}
}
+ if (gpphTmlNfc_Context->tWriteInfo.bThreadBusy)
+ {
+ NXPLOG_TML_D ("Delay Read if write thread is busy");
+ usleep (2000); /*2ms delay to give prio to write complete */
+ }
/* Update the actual number of bytes read including header */
gpphTmlNfc_Context->tReadInfo.wLength = (uint16_t) (dwNoBytesWrRd);
phNxpNciHal_print_packet("RECV", gpphTmlNfc_Context->tReadInfo.pBuffer,