aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2009-11-17 11:00:02 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2009-11-17 15:04:17 +0100
commit741cd3c3ab172e6231fc5ed2d099993d59315f74 (patch)
treef4cb5775328081b6ef516b3593d61179060365a9 /src
parentca32f25638408df8a9c18522da43f6e8adcdb5cb (diff)
zy1000: revC UART forwarding
Name of serial device differs between revB/C. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src')
-rw-r--r--src/ecosboard.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/ecosboard.c b/src/ecosboard.c
index 0cbba3e0..120b3f91 100644
--- a/src/ecosboard.c
+++ b/src/ecosboard.c
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2007-2008 by Øyvind Harboe *
+ * Copyright (C) 2007-2009 by Øyvind Harboe *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -81,6 +81,14 @@
#include <stdio.h>
+#ifdef CYGPKG_HAL_NIOS2
+#define ZY1000_SER_DEV "/dev/uart_0"
+#else
+#define ZY1000_SER_DEV "/dev/ser0"
+
+#endif
+
+
#define MAX_IFS 64
#if defined(CYGPKG_NET_FREEBSD_STACK)
#include <tftp_support.h>
@@ -684,7 +692,7 @@ static void zylinjtag_uart(cyg_addrword_t data)
int oldopts = fcntl(session, F_GETFL, 0);
fcntl(session, F_SETFL, oldopts | O_NONBLOCK); //
- int serHandle = open("/dev/ser0", O_RDWR | O_NONBLOCK);
+ int serHandle = open(ZY1000_SER_DEV, O_RDWR | O_NONBLOCK);
if (serHandle < 0)
{
close(session);
@@ -886,10 +894,10 @@ int handle_uart_command(struct command_context *cmd_ctx, char *cmd,
int err;
cyg_io_handle_t serial_handle;
- err = cyg_io_lookup("/dev/ser0", &serial_handle);
+ err = cyg_io_lookup(ZY1000_SER_DEV, &serial_handle);
if (err != ENOERR)
{
- LOG_ERROR("/dev/ser0 not found\n");
+ LOG_ERROR("Could not open serial port\n");
return ERROR_FAIL;
}