Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing DEBUG_PRINT like statements. Part of: #1708 #3140

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions Drv/LinuxI2cDriver/LinuxI2cDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <linux/i2c-dev.h> // required for constant definitions
#include <cerrno>

#define DEBUG_PRINT 0

namespace Drv {

Expand Down Expand Up @@ -72,30 +71,16 @@ namespace Drv {
return I2cStatus::I2C_OPEN_ERR;
}

#if DEBUG_PRINT
Fw::Logger::log("I2c addr: 0x%02X\n",addr);
for (U32 byte = 0; byte < serBuffer.getSize(); byte++) {
Fw::Logger::log("0x%02X ",serBuffer.getData()[byte]);

}
Fw::Logger::log("\n");
#endif
// select slave address
int stat = ioctl(this->m_fd, I2C_SLAVE, addr);
if (stat == -1) {
#if DEBUG_PRINT
Fw::Logger::log("Status: %d Errno: %d\n", stat, errno);
#endif
return I2cStatus::I2C_ADDRESS_ERR;
}
// make sure it isn't a null pointer
FW_ASSERT(serBuffer.getData());
// write data
stat = static_cast<int>(write(this->m_fd, serBuffer.getData(), serBuffer.getSize()));
if (stat == -1) {
#if DEBUG_PRINT
Fw::Logger::log("Status: %d Errno: %d\n", stat, errno);
#endif
return I2cStatus::I2C_WRITE_ERR;
}
return I2cStatus::I2C_OK;
Expand All @@ -113,34 +98,18 @@ namespace Drv {
return I2cStatus::I2C_OPEN_ERR;
}

#if DEBUG_PRINT
Fw::Logger::log("I2c addr: 0x%02X\n",addr);
#endif
// select slave address
int stat = ioctl(this->m_fd, I2C_SLAVE, addr);
if (stat == -1) {
#if DEBUG_PRINT
Fw::Logger::log("Status: %d Errno: %d\n", stat, errno);
#endif
return I2cStatus::I2C_ADDRESS_ERR;
}
// make sure it isn't a null pointer
FW_ASSERT(serBuffer.getData());
// read data
stat = static_cast<int>(read(this->m_fd, serBuffer.getData(), serBuffer.getSize()));
if (stat == -1) {
#if DEBUG_PRINT
Fw::Logger::log("Status: %d Errno: %d\n", stat, errno);
#endif
return I2cStatus::I2C_READ_ERR;
}
#if DEBUG_PRINT
for (U32 byte = 0; byte < serBuffer.getSize(); byte++) {
Fw::Logger::log("0x%02X ",serBuffer.getData()[byte]);

}
Fw::Logger::log("\n");
#endif
return I2cStatus::I2C_OK;
}

Expand All @@ -162,10 +131,6 @@ namespace Drv {
FW_ASSERT(writeBuffer.getData());
FW_ASSERT(readBuffer.getData());

#if DEBUG_PRINT
Fw::Logger::log("I2c addr: 0x%02X\n",addr);
#endif

struct i2c_msg rdwr_msgs[2];

// Start address
Expand All @@ -188,28 +153,10 @@ namespace Drv {
NATIVE_INT_TYPE stat = ioctl(this->m_fd, I2C_RDWR, &rdwr_data);

if(stat == -1){
#if DEBUG_PRINT
Fw::Logger::log("Status: %d Errno: %d\n", stat, errno);
#endif
//Because we're using ioctl to perform the transaction we dont know exactly the type of error that occurred
return I2cStatus::I2C_OTHER_ERR;
}

#if DEBUG_PRINT
Fw::Logger::log("Wrote:\n");
for (U32 byte = 0; byte < writeBuffer.getSize(); byte++) {
Fw::Logger::log("0x%02X ",writeBuffer.getData()[byte]);

}
Fw::Logger::log("\n");
Fw::Logger::log("Read:\n");
for (U32 byte = 0; byte < readBuffer.getSize(); byte++) {
Fw::Logger::log("0x%02X ",readBuffer.getData()[byte]);

}
Fw::Logger::log("\n");
#endif

return I2cStatus::I2C_OK;
}

Expand Down
2 changes: 0 additions & 2 deletions Drv/LinuxI2cDriver/LinuxI2cDriverStub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include <FpConfig.hpp>
#include <Drv/LinuxI2cDriver/LinuxI2cDriver.hpp>

#define DEBUG_PRINT 0

namespace Drv {

// ----------------------------------------------------------------------
Expand Down
28 changes: 0 additions & 28 deletions Drv/LinuxSpiDriver/LinuxSpiDriverComponentImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#include <linux/spi/spidev.h>
#include <cerrno>

//#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(...)

namespace Drv {

// ----------------------------------------------------------------------
Expand All @@ -41,8 +38,6 @@ namespace Drv {
return;
}

DEBUG_PRINT("Writing %d bytes to SPI\n",writeBuffer.getSize());

spi_ioc_transfer tr;
// Zero for unused fields:
memset(&tr, 0, sizeof(tr));
Expand Down Expand Up @@ -83,15 +78,11 @@ namespace Drv {
snprintf(devName,sizeof(devName),"/dev/spidev%d.%d",device,select);
// null terminate
devName[sizeof(devName)-1] = 0;
DEBUG_PRINT("Opening SPI device %s\n",devName);

fd = ::open(devName, O_RDWR);
if (fd == -1) {
DEBUG_PRINT("open SPI device %d.%d failed. %d\n",device,select,errno);
this->log_WARNING_HI_SPI_OpenError(device,select,fd);
return false;
} else {
DEBUG_PRINT("Successfully opened SPI device %s fd %d\n",devName,fd);
}

this->m_fd = fd;
Expand Down Expand Up @@ -123,20 +114,14 @@ namespace Drv {

ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_WR_MODE fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return false;
} else {
DEBUG_PRINT("SPI fd %d WR mode successfully configured to %d\n",fd,mode);
}

ret = ioctl(fd, SPI_IOC_RD_MODE, &mode);
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_RD_MODE fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return false;
} else {
DEBUG_PRINT("SPI fd %d RD mode successfully configured to %d\n",fd,mode);
}

/*
Expand All @@ -145,49 +130,36 @@ namespace Drv {
U8 bits = 8;
ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_WR_BITS_PER_WORD fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return false;
} else {
DEBUG_PRINT("SPI fd %d WR bits per word successfully configured to %d\n",fd,bits);
}

ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_RD_BITS_PER_WORD fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return false;
} else {
DEBUG_PRINT("SPI fd %d RD bits per word successfully configured to %d\n",fd,bits);
}

/*
* Max speed in Hz
*/
ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &clock);
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_WR_MAX_SPEED_HZ fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return false;
} else {
DEBUG_PRINT("SPI fd %d WR freq successfully configured to %d\n",fd,clock);
}

ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &clock);
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_RD_MAX_SPEED_HZ fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return false;
} else {
DEBUG_PRINT("SPI fd %d RD freq successfully configured to %d\n",fd,clock);
}

return true;

}

LinuxSpiDriverComponentImpl::~LinuxSpiDriverComponentImpl() {
DEBUG_PRINT("Closing SPI device %d\n",this->m_fd);
(void) close(this->m_fd);
}

Expand Down
26 changes: 0 additions & 26 deletions Drv/LinuxUartDriver/LinuxUartDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
#include <termios.h>
#include <cerrno>

//#include <cstdlib>
//#include <cstdio>
//#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(...)

namespace Drv {

Expand All @@ -47,7 +43,6 @@ bool LinuxUartDriver::open(const char* const device,

this->m_device = device;

DEBUG_PRINT("Opening UART device %s\n", device);

/*
The O_NOCTTY flag tells UNIX that this program doesn't want to be the "controlling terminal" for that port. If you
Expand All @@ -58,13 +53,10 @@ bool LinuxUartDriver::open(const char* const device,
fd = ::open(device, O_RDWR | O_NOCTTY);

if (fd == -1) {
DEBUG_PRINT("open UART device %s failed.\n", device);
Fw::LogStringArg _arg = device;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_OpenError(_arg, this->m_fd, _err);
return false;
} else {
DEBUG_PRINT("Successfully opened UART device %s fd %d\n", device, fd);
}

this->m_fd = fd;
Expand All @@ -74,14 +66,11 @@ bool LinuxUartDriver::open(const char* const device,

stat = tcgetattr(fd, &cfg);
if (-1 == stat) {
DEBUG_PRINT("tcgetattr failed: (%d): %s\n", stat, strerror(errno));
close(fd);
Fw::LogStringArg _arg = device;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_OpenError(_arg, fd, _err);
return false;
} else {
DEBUG_PRINT("tcgetattr passed.\n");
}

/*
Expand All @@ -104,14 +93,11 @@ bool LinuxUartDriver::open(const char* const device,

stat = tcsetattr(fd, TCSANOW, &cfg);
if (-1 == stat) {
DEBUG_PRINT("tcsetattr failed: (%d): %s\n", stat, strerror(errno));
close(fd);
Fw::LogStringArg _arg = device;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_OpenError(_arg, fd, _err);
return false;
} else {
DEBUG_PRINT("tcsetattr passed.\n");
}

// Set flow control
Expand All @@ -120,7 +106,6 @@ bool LinuxUartDriver::open(const char* const device,

stat = tcgetattr(fd, &t);
if (-1 == stat) {
DEBUG_PRINT("tcgetattr UART fd %d failed\n", fd);
close(fd);
Fw::LogStringArg _arg = device;
Fw::LogStringArg _err = strerror(errno);
Expand All @@ -133,7 +118,6 @@ bool LinuxUartDriver::open(const char* const device,

stat = tcsetattr(fd, TCSANOW, &t);
if (-1 == stat) {
DEBUG_PRINT("tcsetattr UART fd %d failed\n", fd);
close(fd);
Fw::LogStringArg _arg = device;
Fw::LogStringArg _err = strerror(errno);
Expand Down Expand Up @@ -211,7 +195,6 @@ bool LinuxUartDriver::open(const char* const device,

stat = tcgetattr(fd, &newtio);
if (-1 == stat) {
DEBUG_PRINT("tcgetattr UART fd %d failed\n", fd);
close(fd);
Fw::LogStringArg _arg = device;
Fw::LogStringArg _err = strerror(errno);
Expand Down Expand Up @@ -254,7 +237,6 @@ bool LinuxUartDriver::open(const char* const device,
// Set baud rate:
stat = cfsetispeed(&newtio, static_cast<speed_t>(relayRate));
if (stat) {
DEBUG_PRINT("cfsetispeed failed\n");
close(fd);
Fw::LogStringArg _arg = device;
Fw::LogStringArg _err = strerror(errno);
Expand All @@ -263,7 +245,6 @@ bool LinuxUartDriver::open(const char* const device,
}
stat = cfsetospeed(&newtio, static_cast<speed_t>(relayRate));
if (stat) {
DEBUG_PRINT("cfsetospeed failed\n");
close(fd);
Fw::LogStringArg _arg = device;
Fw::LogStringArg _err = strerror(errno);
Expand All @@ -285,7 +266,6 @@ bool LinuxUartDriver::open(const char* const device,
// Set attributes:
stat = tcsetattr(fd, TCSANOW, &newtio);
if (-1 == stat) {
DEBUG_PRINT("tcsetattr UART fd %d failed\n", fd);
close(fd);
Fw::LogStringArg _arg = device;
Fw::LogStringArg _err = strerror(errno);
Expand All @@ -304,8 +284,6 @@ bool LinuxUartDriver::open(const char* const device,

LinuxUartDriver ::~LinuxUartDriver() {
if (this->m_fd != -1) {
DEBUG_PRINT("Closing UART device %d\n", this->m_fd);

(void)close(this->m_fd);
}
}
Expand Down Expand Up @@ -355,10 +333,6 @@ void LinuxUartDriver ::serialReadTaskEntry(void* ptr) {
continue;
}

// timespec stime;
// (void)clock_gettime(CLOCK_REALTIME,&stime);
// DEBUG_PRINT("<<< Calling dsp_relay_uart_relay_read() at %d %d\n", stime.tv_sec, stime.tv_nsec);

int stat = 0;

// Read until something is received or an error occurs. Only loop when
Expand Down
6 changes: 0 additions & 6 deletions Fw/Comp/ActiveComponentBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#include <Os/TaskString.hpp>
#include <cstdio>

//#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(...)

namespace Fw {

class ActiveComponentExitSerializableBuffer : public Fw::SerializeBufferBase {
Expand Down Expand Up @@ -35,7 +32,6 @@ namespace Fw {
}

ActiveComponentBase::~ActiveComponentBase() {
DEBUG_PRINT("ActiveComponent %s destructor.\n",this->getObjName());
}

void ActiveComponentBase::init(NATIVE_INT_TYPE instance) {
Expand Down Expand Up @@ -76,11 +72,9 @@ namespace Fw {
SerializeStatus stat = exitBuff.serialize(static_cast<I32>(ACTIVE_COMPONENT_EXIT));
FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast<NATIVE_INT_TYPE>(stat));
(void)this->m_queue.send(exitBuff,0,Os::Queue::BlockingType::NONBLOCKING);
DEBUG_PRINT("exit %s\n", this->getObjName());
}

Os::Task::Status ActiveComponentBase::join() {
DEBUG_PRINT("join %s\n", this->getObjName());
return this->m_task.join();
}

Expand Down
Loading
Loading