diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2013-04-01 00:46:05 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2013-04-01 00:46:05 +0000 |
commit | 52b6e9dc546d1c0958e03634eff47c71f460f8ac (patch) | |
tree | 4ef6131df647e4c9fc9f5c312e583c2882afefde /serprog.c | |
parent | f966cc48107d924f430dbd763bf470ee2ebaf0d1 (diff) | |
download | flashrom-52b6e9dc546d1c0958e03634eff47c71f460f8ac.tar.gz flashrom-52b6e9dc546d1c0958e03634eff47c71f460f8ac.tar.bz2 flashrom-52b6e9dc546d1c0958e03634eff47c71f460f8ac.zip |
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
Corresponding to flashrom svn r1665.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Signed-off-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Diffstat (limited to 'serprog.c')
-rw-r--r-- | serprog.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -20,21 +20,23 @@ */ #include <stdio.h> +#ifndef _WIN32 /* stuff (presumably) needed for sockets only */ #include <stdlib.h> #include <unistd.h> -#include <strings.h> -#include <string.h> -#include <ctype.h> #include <fcntl.h> #include <sys/socket.h> #include <arpa/inet.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <netdb.h> -#include <sys/stat.h> -#include <errno.h> -#include <inttypes.h> +#endif +#ifdef _WIN32 +#include <conio.h> +#else #include <termios.h> +#endif +#include <string.h> +#include <errno.h> #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; |