Make SonarQube happy

This commit is contained in:
Uwe Seimet 2023-11-14 17:02:15 +01:00
parent 7b8ae25005
commit 3bf0a06ead
2 changed files with 5 additions and 4 deletions

View File

@ -54,7 +54,7 @@ const static int SCSI_DELAY_FAST_NEGATION_PERIOD_NS = 30;
// The DaynaPort SCSI Link do a short delay in the middle of transfering
// a packet. This is the number of uS that will be delayed between the
// header and the actual data.
const static int SCSI_DELAY_SEND_DATA_DAYNAPORT_US = 100;
const static int SCSI_DELAY_SEND_DATA_DAYNAPORT_NS = 100'000;
class bus_exception : public runtime_error

View File

@ -14,7 +14,7 @@
#include <spdlog/spdlog.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <time.h>
#ifdef __linux__
#include <sys/epoll.h>
#endif
@ -276,10 +276,11 @@ int GPIOBUS::SendHandShake(uint8_t *buf, int count, int delay_after_bytes)
if (actmode == mode_e::TARGET) {
for (i = 0; i < count; i++) {
if (i == delay_after_bytes) {
spdlog::trace("DELAYING for " + to_string(SCSI_DELAY_SEND_DATA_DAYNAPORT_US) + " us after " +
spdlog::trace("DELAYING for " + to_string(SCSI_DELAY_SEND_DATA_DAYNAPORT_NS) + " ns after " +
to_string(delay_after_bytes) + " bytes");
EnableIRQ();
usleep(SCSI_DELAY_SEND_DATA_DAYNAPORT_US);
const timespec ts = { .tv_sec = 0, .tv_nsec = SCSI_DELAY_SEND_DATA_DAYNAPORT_NS};
nanosleep(&ts, nullptr);
DisableIRQ();
}