diff options
author | Daniel Tomas <dtomas.nxp@gmail.com> | 2011-04-21 14:11:28 -0700 |
---|---|---|
committer | Nick Pelly <npelly@google.com> | 2011-05-19 11:49:00 -0700 |
commit | c1f33130d9d2100e6232f8f3c782949c75205be6 (patch) | |
tree | df4ca2b3312e0f14b3e90eb0c06c3c4dd9a216c6 /Linux_x86 | |
parent | 651794422f331be5865ed8afcab6a56e3abe7521 (diff) | |
download | external_libnfc-nxp-c1f33130d9d2100e6232f8f3c782949c75205be6.zip external_libnfc-nxp-c1f33130d9d2100e6232f8f3c782949c75205be6.tar.gz external_libnfc-nxp-c1f33130d9d2100e6232f8f3c782949c75205be6.tar.bz2 |
Patch to enable low level traces.
This patch permit to display the NFC frames exchanged through the I2C line.
To enable that, you just need to enable LOW_LEVEL_TRACES macro.
Change-Id: Ica2ff2e6d111b76c056161ec557346f23d21ada0
Diffstat (limited to 'Linux_x86')
-rw-r--r-- | Linux_x86/phDal4Nfc.c | 6 | ||||
-rw-r--r-- | Linux_x86/phOsalNfc.c | 23 |
2 files changed, 29 insertions, 0 deletions
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); + } +} + |