1
0
mirror of https://github.com/preble/libpinproc synced 2026-02-24 18:25:23 +01:00

Resolved a number of build issues with WIN32 builds

This commit is contained in:
gstellenberg
2009-06-12 09:47:43 -05:00
parent 419269a60d
commit 789ac049db
4 changed files with 17 additions and 4 deletions

View File

@@ -39,7 +39,9 @@
#if defined(PR_BUILDING_PR) #if defined(PR_BUILDING_PR)
#define PR_EXPORT __declspec(dllexport) extern #define PR_EXPORT __declspec(dllexport) extern
#else #else
#define PR_EXPORT __declspec(dllimport) extern // TODO: Decide what to do here:
//#define PR_EXPORT __declspec(dllimport) extern
#define PR_EXPORT
#endif #endif
#endif #endif

View File

@@ -525,7 +525,7 @@ PRResult PRDevice::SwitchGetStates( PREventType * switchStates, uint16_t numSwit
// Wait for data to return. Give it 10 loops before giving up. // Wait for data to return. Give it 10 loops before giving up.
while (requestedDataQueue.size() < numWords && i++ < 10) while (requestedDataQueue.size() < numWords && i++ < 10)
{ {
sleep (.01); // 10 milliseconds should be plenty of time. PRSleep (10); // 10 milliseconds should be plenty of time.
SortReturningData(); SortReturningData();
} }
@@ -677,7 +677,7 @@ PRResult PRDevice::VerifyChipID()
max_count = 0; max_count = 0;
//std::cout << "Waiting for read data "; //std::cout << "Waiting for read data ";
while (num_collected_bytes < (bufferWords*4) && max_count < 10) { while (num_collected_bytes < (bufferWords*4) && max_count < 10) {
sleep(.01); PRSleep(10);
//std::cout << ". "; //std::cout << ". ";
rc = CollectReadData(); rc = CollectReadData();
max_count++; max_count++;
@@ -809,7 +809,7 @@ PRResult PRDevice::ReadDataRaw(uint32_t moduleSelect, uint32_t startingAddr, int
// Expect numReadWords + 1 word with the address. // Expect numReadWords + 1 word with the address.
while (requestedDataQueue.size() < (numReadWords + 1) && i++ < 10) while (requestedDataQueue.size() < (numReadWords + 1) && i++ < 10)
{ {
sleep (.01); // 10 milliseconds should be plenty of time. PRSleep (10); // 10 milliseconds should be plenty of time.
SortReturningData(); SortReturningData();
} }

View File

@@ -29,6 +29,13 @@
#include <stdint.h> #include <stdint.h>
#include "../include/pinproc.h" #include "../include/pinproc.h"
#if defined(__WIN32__)
#include <windows.h>
#define PRSleep(milliseconds) Sleep(milliseconds)
#else
#define PRSleep(milliseconds) sleep(milliseconds/1000)
#endif
const int32_t FTDI_VENDOR_ID = 0x0403; const int32_t FTDI_VENDOR_ID = 0x0403;
const int32_t FTDI_FT245RL_PRODUCT_ID = 0x6001; const int32_t FTDI_FT245RL_PRODUCT_ID = 0x6001;

View File

@@ -31,6 +31,10 @@
#include "../include/pinproc.h" #include "../include/pinproc.h"
#include "PRDevice.h" #include "PRDevice.h"
#if defined(__WIN32__)
#include <stardg.h>
#endif
#define MAX_TEXT (1024) #define MAX_TEXT (1024)
typedef void (*PRLogCallback)(PRLogLevel level, const char *text); typedef void (*PRLogCallback)(PRLogLevel level, const char *text);