From 2fb50360ef8910ed785d31cc4da098a77c26fd81 Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Thu, 1 Apr 2021 16:33:08 +0200 Subject: [PATCH] spi wiretapping --- linux/spi/SpiComIF.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/linux/spi/SpiComIF.cpp b/linux/spi/SpiComIF.cpp index e0a55a5..d70f91a 100644 --- a/linux/spi/SpiComIF.cpp +++ b/linux/spi/SpiComIF.cpp @@ -16,12 +16,9 @@ #include #include -#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(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(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 {