From 23cf3b374bad47ecf4f3f43ac60c2456e62a4943 Mon Sep 17 00:00:00 2001 From: preble Date: Mon, 14 Jun 2010 01:02:49 -0400 Subject: [PATCH] Minor improvements. Fixed PRSleep() on POSIX platforms. --- Makefile | 4 ++-- src/PRDevice.cpp | 9 +++++---- src/PRHardware.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 09c3e4f..146ab29 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,8 @@ AR = ar ARFLAGS = rc RANLIB = ranlib RM = rm -f -CFLAGS=$(ARCH) -c -Wall -Iinclude -LDFLAGS=$(ARCH) +CFLAGS=$(ARCH) $(OTHER_CFLAGS) -c -Wall -Iinclude +LDFLAGS=$(ARCH) $(OTHER_LDFLAGS) LIBPINPROC = bin/libpinproc.a SRCS = src/pinproc.cpp src/PRDevice.cpp src/PRHardware.cpp diff --git a/src/PRDevice.cpp b/src/PRDevice.cpp index dac605a..41b57b2 100644 --- a/src/PRDevice.cpp +++ b/src/PRDevice.cpp @@ -566,7 +566,7 @@ PRResult PRDevice::SwitchUpdateConfig(PRSwitchConfig *switchConfig) this->switchConfig = *switchConfig; CreateSwitchUpdateConfigBurst(burst, switchConfig); - DEBUG(PRLog(kPRLogInfo, "Configuring Switch Logic")); + DEBUG(PRLog(kPRLogInfo, "Configuring Switch Logic\n")); DEBUG(PRLog(kPRLogVerbose, "Words: %x %x\n",burst[0],burst[1])); rc = PrepareWriteData(burst, burstWords); @@ -760,7 +760,7 @@ int32_t PRDevice::DMDUpdateConfig(PRDMDConfig *dmdConfig) this->dmdConfig = *dmdConfig; CreateDMDUpdateConfigBurst(burst, dmdConfig); - DEBUG(PRLog(kPRLogInfo, "Configuring DMD")); + DEBUG(PRLog(kPRLogInfo, "Configuring DMD\n")); DEBUG(PRLog(kPRLogVerbose, "Words: %x %x %x %x %x %x %x\n",burst[0],burst[1],burst[2],burst[3], burst[4],burst[5],burst[6])); @@ -963,20 +963,21 @@ PRResult PRDevice::VerifyChipID() uint32_t buffer[bufferWords]; //uint32_t temp_word; uint32_t max_count, i; + const uint32_t max_count_limit = 10; //std::cout << "Requesting FPGA Chip ID: "; rc = RequestData(P_ROC_MANAGER_SELECT, P_ROC_REG_CHIP_ID_ADDR, 4); max_count = 0; // Wait for data to return. Give it 10 loops before giving up. - while (requestedDataQueue.size() < 5 && max_count++ < 10) + while (requestedDataQueue.size() < 5 && max_count++ < max_count_limit) { PRSleep (10); // 10 milliseconds should be plenty of time. if (SortReturningData() != kPRSuccess) return kPRFailure; } - if (max_count != 11) { + if (max_count != max_count_limit+1) { if (requestedDataQueue.size() == 5) { for (i = 0; i < bufferWords; i++) { diff --git a/src/PRHardware.h b/src/PRHardware.h index 2e12297..94f5388 100644 --- a/src/PRHardware.h +++ b/src/PRHardware.h @@ -33,7 +33,7 @@ #include #define PRSleep(milliseconds) Sleep(milliseconds) #else - #define PRSleep(milliseconds) sleep(milliseconds/1000) + #define PRSleep(milliseconds) usleep(milliseconds*1000) #endif const int32_t FTDI_VENDOR_ID = 0x0403;