summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2011-05-24 08:43:57 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-05-24 08:43:57 -0700
commit43779d274e8a5b042f6c1d01e97e2138f0df0b14 (patch)
treefd9ad3a065d7630cd15c5bd21cb43e70e6b79888
parent236ed5aa55ca5bb49d7f6838b32a7f91091eba5c (diff)
parentd9ebeefb70213172ecd329095570aaa5684094e0 (diff)
downloadexternal_libnfc-nxp-43779d274e8a5b042f6c1d01e97e2138f0df0b14.zip
external_libnfc-nxp-43779d274e8a5b042f6c1d01e97e2138f0df0b14.tar.gz
external_libnfc-nxp-43779d274e8a5b042f6c1d01e97e2138f0df0b14.tar.bz2
am d9ebeefb: am 944e51f4: Merge from gingerbread
* commit 'd9ebeefb70213172ecd329095570aaa5684094e0': Patch to enable low level traces.
-rw-r--r--Android.mk6
-rw-r--r--Linux_x86/phDal4Nfc.c6
-rw-r--r--Linux_x86/phOsalNfc.c23
-rw-r--r--src/phOsalNfc.h13
4 files changed, 48 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
index 17ca734..a83d35c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -105,6 +105,7 @@ LOCAL_SRC_FILES += Linux_x86/phDal4Nfc.c
LOCAL_SRC_FILES += Linux_x86/phDal4Nfc_i2c.c
LOCAL_SRC_FILES += Linux_x86/phDal4Nfc_messageQueueLib.c
+# Really verbose:
#LOCAL_CFLAGS += -DNXP_MESSAGING -DANDROID -DDEBUG -DDAL_TRACE -DINCLUDE_DALINIT_DEINIT -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -msoft-float -Uarm -fno-common -fpic
LOCAL_CFLAGS += -DNXP_MESSAGING -DANDROID -DINCLUDE_DALINIT_DEINIT -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -fpic
@@ -112,6 +113,11 @@ ifeq ($(TARGET_ARCH),arm)
LOCAL_CFLAGS += -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -msoft-float -Uarm -fno-common
endif
+# Just show I2C traffic:
+#LOCAL_CFLAGS += -DNXP_MESSAGING -DANDROID -DINCLUDE_DALINIT_DEINIT -DLOW_LEVEL_TRACES -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -msoft-float -Uarm -fno-common -fpic
+# Quiet:
+#LOCAL_CFLAGS += -DNXP_MESSAGING -DANDROID -DINCLUDE_DALINIT_DEINIT -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -msoft-float -Uarm -fno-common -fpic
+
ifeq ($(NFC_BUILD_VARIANT),debug)
LOCAL_CFLAGS += -DDEBUG -D_DEBUG
LOCAL_CFLAGS += -O0 -g
diff --git a/Linux_x86/phDal4Nfc.c b/Linux_x86/phDal4Nfc.c
index a39f062..bda22c5 100644
--- a/Linux_x86/phDal4Nfc.c
+++ b/Linux_x86/phDal4Nfc.c
@@ -707,6 +707,7 @@ retry:
else
{
i2c_error_count = 0;
+ phOsalNfc_PrintData("Received buffer", (uint16_t)gReadWriteContext.nNbOfBytesRead, gReadWriteContext.pReadBuffer);
DAL_DEBUG("Read ok. nbToRead=%d\n", gReadWriteContext.nNbOfBytesToRead);
DAL_DEBUG("NbReallyRead=%d\n", gReadWriteContext.nNbOfBytesRead);
DAL_PRINT("ReadBuff[]={ ");
@@ -847,6 +848,11 @@ void phDal4Nfc_DeferredCb (void *params)
break;
case PHDAL4NFC_WRITE_MESSAGE:
DAL_PRINT(" Dal deferred write called \n");
+
+#ifdef LOW_LEVEL_TRACES
+ phOsalNfc_PrintData("Send buffer", (uint16_t)gReadWriteContext.nNbOfBytesToWrite, gReadWriteContext.pWriteBuffer);
+#endif
+
/* DAL_DEBUG("dalMsg->transactInfo.length : %d\n", dalMsg->transactInfo.length); */
/* Make a Physical WRITE */
usleep(3000); /* Wait 3ms before issuing a Write */
diff --git a/Linux_x86/phOsalNfc.c b/Linux_x86/phOsalNfc.c
index 6149fc3..9765e2c 100644
--- a/Linux_x86/phOsalNfc.c
+++ b/Linux_x86/phOsalNfc.c
@@ -150,3 +150,26 @@ void phOsalNfc_RaiseException(phOsalNfc_ExceptionType_t eExceptionType, uint16_t
}
}
+/*!
+ * \brief display data bytes.
+ * This function displays data bytes for debug purpose
+ * \param[in] pString pointer to string to be displayed.
+ * \param[in] length number of bytes to be displayed.
+ * \param[in] pBuffer pointer to data bytes to be displayed.
+ *
+ */
+void phOsalNfc_PrintData(const char *pString, uint32_t length, uint8_t *pBuffer)
+{
+ char print_buffer[512]; // Max length 512 for the download mode
+ int i;
+
+ if(NULL!=pString && length > 1 && length < 34)
+ {
+ print_buffer[0] = '\0';
+ for (i = 0; i < length; i++) {
+ snprintf(&print_buffer[i*5], 6, " 0x%02X", pBuffer[i]);
+ }
+ LOGD("> NFC I2C %s: %s", pString,print_buffer);
+ }
+}
+
diff --git a/src/phOsalNfc.h b/src/phOsalNfc.h
index ad55066..246c2e6 100644
--- a/src/phOsalNfc.h
+++ b/src/phOsalNfc.h
@@ -154,6 +154,19 @@ void phOsalNfc_DbgTrace(uint8_t data[], uint32_t size);
*/
void phOsalNfc_DbgString(const char *pString);
+/*!
+ * \ingroup grp_osal_nfc
+ * \brief Print data buffer
+ *
+ * Outputs given string to debug port.
+ *
+ * \param[in] pString pointer to string to be displayed.
+ * \param[in] length number of bytes to be displayed.
+ * \param[in] pBuffer pointer to data bytes to be displayed.
+ *
+ * \retval None
+ */
+void phOsalNfc_PrintData(const char *pString, uint32_t length, uint8_t *pBuffer);
/*!
* \ingroup grp_osal_nfc