Buspiratespi support on mingw

Corresponding to flashrom svn r832.

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
diff --git a/flash.h b/flash.h
index b47dcbc..b7b9aed 100644
--- a/flash.h
+++ b/flash.h
@@ -28,6 +28,11 @@
 #include <stdint.h>
 #include <stdio.h>
 #include "hwaccess.h"
+#ifdef _WIN32
+#include <windows.h>
+#undef min
+#undef max
+#endif
 
 typedef unsigned long chipaddr;
 
@@ -591,10 +596,16 @@
 void serprog_delay(int delay);
 
 /* serial.c */
+#if _WIN32
+typedef HANDLE fdtype;
+#else
+typedef int fdtype;
+#endif
+
 void sp_flush_incoming(void);
-int sp_openserport(char *dev, unsigned int baud);
+fdtype sp_openserport(char *dev, unsigned int baud);
 void __attribute__((noreturn)) sp_die(char *msg);
-extern int sp_fd;
+extern fdtype sp_fd;
 int serialport_shutdown(void);
 int serialport_write(unsigned char *buf, unsigned int writecnt);
 int serialport_read(unsigned char *buf, unsigned int readcnt);