From e056a53f200e421ad4623081509417ab41b49aff Mon Sep 17 00:00:00 2001 From: stefanct Date: Mon, 1 Apr 2013 00:46:05 +0000 Subject: Enable serprog on Windows. Sockets are not ported (yet). Tested on Windows 7 with my Atmega32U2 serprog implementation. http://paste.flashrom.org/view.php?id=1566 Signed-off-by: Stefan Tauner Signed-off-by: Idwer Vollering Acked-by: Stefan Tauner git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1665 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- Makefile | 8 +------- serprog.c | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 07fefc0..805290c 100644 --- a/Makefile +++ b/Makefile @@ -143,12 +143,6 @@ FLASHROM_CFLAGS += -Dffs=__builtin_ffs # libusb-win32/libftdi stuff is usually installed in /usr/local. CPPFLAGS += -I/usr/local/include LDFLAGS += -L/usr/local/lib -# Serprog is not supported under Windows/MinGW (missing sockets support). -ifeq ($(CONFIG_SERPROG), yes) -UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes -else -override CONFIG_SERPROG = no -endif # For now we disable all PCI-based programmers on Windows/MinGW (no libpci). ifeq ($(CONFIG_INTERNAL), yes) UNSUPPORTED_FEATURES += CONFIG_INTERNAL=yes @@ -334,7 +328,7 @@ SVNDEF := -D'FLASHROM_VERSION="$(VERSION)"' # Always enable internal/onboard support for now. CONFIG_INTERNAL ?= yes -# Always enable serprog for now. Needs to be disabled on Windows. +# Always enable serprog for now. CONFIG_SERPROG ?= yes # RayeR SPIPGM hardware support diff --git a/serprog.c b/serprog.c index b68fc49..24f5726 100644 --- a/serprog.c +++ b/serprog.c @@ -20,21 +20,23 @@ */ #include +#ifndef _WIN32 /* stuff (presumably) needed for sockets only */ #include #include -#include -#include -#include #include #include #include #include #include #include -#include -#include -#include +#endif +#ifdef _WIN32 +#include +#else #include +#endif +#include +#include #include "flash.h" #include "programmer.h" #include "chipdrivers.h" @@ -81,6 +83,7 @@ static int sp_opbuf_usage = 0; whether the command is supported before doing it */ static int sp_check_avail_automatic = 0; +#ifndef WIN32 static int sp_opensocket(char *ip, unsigned int port) { int flag = 1; @@ -114,6 +117,7 @@ static int sp_opensocket(char *ip, unsigned int port) setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int)); return sock; } +#endif /* Synchronize: a bit tricky algorithm that tries to (and in my tests has * * always succeeded in) bring the serial protocol to known waiting-for- * @@ -351,6 +355,7 @@ int serprog_init(void) } free(device); +#ifndef _WIN32 device = extract_programmer_param("ip"); if (have_device && device) { msg_perr("Error: Both host and device specified.\n" @@ -394,6 +399,7 @@ int serprog_init(void) "flashrom -p serprog:ip=ipaddr:port\n"); return 1; } +#endif if (register_shutdown(serprog_shutdown, NULL)) return 1; -- cgit v1.2.1