diff --git a/CMakeLists.txt b/CMakeLists.txt index 933b871..0f8a6c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,6 +122,11 @@ target_link_libraries(openFPGALoader ${LIBFTDI_LIBRARIES} ) +if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + # winsock provides ntohs + target_link_libraries(openFPGALoader ws2_32) +endif() + # libusb_attach_kernel_driver is only available on Linux. if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_definitions(-DATTACH_KERNEL) diff --git a/src/bitparser.cpp b/src/bitparser.cpp index 42172a9..58a44a7 100644 --- a/src/bitparser.cpp +++ b/src/bitparser.cpp @@ -5,12 +5,8 @@ #ifndef _WIN32 #include #else -// WARNING: this will be incorrect on ARM-based windows platforms -// that are big-endian, but the rest of this code has not been tested for -// those platforms anyway. -uint16_t ntohs(uint16_t netshort) { - return ((netshort & 0xFF) << 8) | ((netshort & 0xFF00) >> 8); -} +//for ntohs +#include #endif using namespace std; diff --git a/src/gowin.cpp b/src/gowin.cpp index 1f2e641..f194f58 100644 --- a/src/gowin.cpp +++ b/src/gowin.cpp @@ -32,6 +32,11 @@ using namespace std; +#ifdef STATUS_TIMEOUT +// defined in the Windows headers included by libftdi.h +#undef STATUS_TIMEOUT +#endif + #define NOOP 0x02 #define ERASE_SRAM 0x05 #define READ_SRAM 0x03