diff options
-rw-r--r-- | Android.mk | 4 | ||||
-rw-r--r-- | Linux_x86/phDal4Nfc.c | 6 | ||||
-rw-r--r-- | Linux_x86/phOsalNfc.c | 23 | ||||
-rw-r--r-- | src/phOsalNfc.h | 13 |
4 files changed, 46 insertions, 0 deletions
@@ -105,7 +105,11 @@ 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 +# 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) 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 |