spi wiretapping

This commit is contained in:
Robin Müller 2021-04-01 16:33:08 +02:00
parent c62cdbebcb
commit 2fb50360ef
1 changed files with 11 additions and 11 deletions

View File

@ -16,12 +16,9 @@
#include <cerrno>
#include <cstring>
#ifndef SPI_SEND_WIRETAPPING
#define SPI_SEND_WIRETAPPING 0
#endif
#ifndef SPI_RECV_WIRETAPPING
#define SPI_RECV_WIRETAPPING 0
/* Can be used for low-level debugging of the SPI bus */
#ifndef FSFW_HAL_LINUX_SPI_WIRETAPPING
#define FSFW_HAL_LINUX_SPI_WIRETAPPING 1
#endif
SpiComIF::SpiComIF(object_id_t objectId, GpioIF* gpioComIF): SystemObject(objectId),
@ -197,17 +194,20 @@ ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, s
utility::handleIoctlError("SpiComIF::sendMessage: ioctl error.");
result = FULL_DUPLEX_TRANSFER_FAILED;
}
#if FSFW_LINUX_SPI_WIRETAPPING == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Sent SPI data: " << std::endl;
#if FSFW_HAL_LINUX_SPI_WIRETAPPING == 1
size_t dataLen = spiCookie->getTransferStructHandle()->len;
uint8_t* dataPtr = reinterpret_cast<uint8_t*>(spiCookie->getTransferStructHandle()->tx_buf);
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Sent SPI data: " << std::endl;
arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false);
sif::info << "Received SPI data: " << std::endl;
#else
sif::printInfo("Sent SPI data: \n");
arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false);
sif::printInfo("Received SPI data: \n");
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
dataPtr = reinterpret_cast<uint8_t*>(spiCookie->getTransferStructHandle()->rx_buf);
arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false);
#else
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */
}
else {