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.
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 @@
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,