summaryrefslogtreecommitdiffstats
path: root/serprog.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2015-01-10 09:32:50 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2015-01-10 09:32:50 +0000
commitb0eee9b8d649efc3db9a6c5f333b0fff5204a979 (patch)
treefcba10fdf1451557f3bc58de6f39d669e5106c46 /serprog.c
parentbe62d3fc07194ec13f091aa06beff0a032f1a418 (diff)
downloadast2050-flashrom-b0eee9b8d649efc3db9a6c5f333b0fff5204a979.zip
ast2050-flashrom-b0eee9b8d649efc3db9a6c5f333b0fff5204a979.tar.gz
Unify target OS and CPU architecture checks
We do CPU architecture checks once for the makefile in arch.h and once for HW access abstraction in hwaccess.c. This patch unifies related files so that they can share the checks to improve maintainability and reduce the chance of inconsistencies. Furthermore, it refines some of the definitions, which - adds "support" for AARCH64 and PPC64, - adds big-endian handling on arm as well as LE handling on PPC64, - fixes compilation of internal.c on AARCH64 and PPC64. Additionally, this patch continues to unify all OS checks in flashrom by adding a new helper macro IS_WINDOWS. The old header file for architecture checking is renamed to platform.h to reflect its broader scope and all new macros are add in there. Corresponding to flashrom svn r1864. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Diffstat (limited to 'serprog.c')
-rw-r--r--serprog.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/serprog.c b/serprog.c
index e52c994..3de0182 100644
--- a/serprog.c
+++ b/serprog.c
@@ -19,8 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "platform.h"
+
#include <stdio.h>
-#ifndef _WIN32 /* stuff (presumably) needed for sockets only */
+#if ! IS_WINDOWS /* stuff (presumably) needed for sockets only */
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
@@ -30,7 +32,7 @@
#include <netinet/tcp.h>
#include <netdb.h>
#endif
-#ifdef _WIN32
+#if IS_WINDOWS
#include <conio.h>
#else
#include <termios.h>
@@ -83,7 +85,7 @@ static int sp_opbuf_usage = 0;
whether the command is supported before doing it */
static int sp_check_avail_automatic = 0;
-#ifndef WIN32
+#if ! IS_WINDOWS
static int sp_opensocket(char *ip, unsigned int port)
{
int flag = 1;
@@ -375,7 +377,7 @@ int serprog_init(void)
}
free(device);
-#ifndef _WIN32
+#if !IS_WINDOWS
device = extract_programmer_param("ip");
if (have_device && device) {
msg_perr("Error: Both host and device specified.\n"
OpenPOWER on IntegriCloud