Move OS-dependent serial code from buspirate_spi.c to serial.c

While at it, also rename a few functions to make it obvious
that they are generic and not specific to the Bus Pirate.

Corresponding to flashrom svn r830.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Patrick Georgi <patrick.georgi@coresystems.de>
diff --git a/flash.h b/flash.h
index e2e1e62..a80ec32 100644
--- a/flash.h
+++ b/flash.h
@@ -595,6 +595,10 @@
 int sp_openserport(char *dev, unsigned int baud);
 void __attribute__((noreturn)) sp_die(char *msg);
 extern int sp_fd;
+int serialport_shutdown(void);
+int serialport_write(unsigned char *buf, unsigned int writecnt);
+int serialport_read(unsigned char *buf, unsigned int readcnt);
+int serialport_discard_read(void);
 
 #include "chipdrivers.h"