pipes: add documentation for pipes
[fw/openocd] / src / ecosboard.c
index de2a42ccaab25924d86bf8b1bab75e4a61d2a4f9..f6e040fac3a26961059a5fca828c9db9cadd0134 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2007-2009 by Øyvind Harboe                              *
+ *   Copyright (C) 2007-2010 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  *
@@ -24,6 +24,7 @@
 #include <helper/types.h>
 #include <jtag/jtag.h>
 #include <helper/ioutil.h>
+#include <helper/util.h>
 #include <helper/configuration.h>
 
 #include <server/server.h>
@@ -99,10 +100,6 @@ static bool writeLog = true;
 
 char hwaddr[512];
 
-
-extern struct flash_driver *flash_drivers[];
-extern struct target_type *target_types[];
-
 #ifdef CYGPKG_PROFILE_GPROF
 #include <cyg/profile/profile.h>
 
@@ -847,7 +844,7 @@ static int zylinjtag_Jim_Command_uart(Jim_Interp *interp, int argc,
        static int current_baud = 38400;
        if (argc == 1)
        {
-               command_print(cmd_ctx, "%d", current_baud);
+               Jim_SetResult(interp, Jim_NewIntObj(interp, current_baud));
                return JIM_OK;
        }
        else if (argc != 2)
@@ -883,8 +880,8 @@ static int zylinjtag_Jim_Command_uart(Jim_Interp *interp, int argc,
                baud = CYGNUM_SERIAL_BAUD_230400;
                break;
        default:
-               command_print(cmd_ctx, "unsupported baudrate");
-               return ERROR_INVALID_ARGUMENTS;
+               Jim_SetResult(interp, Jim_NewStringObj(interp, "unsupported baudrate", -1));
+               return JIM_ERR;
        }
 
        cyg_serial_info_t buf;
@@ -897,7 +894,7 @@ static int zylinjtag_Jim_Command_uart(Jim_Interp *interp, int argc,
        err = cyg_io_lookup(ZY1000_SER_DEV, &serial_handle);
        if (err != ENOERR)
        {
-               LOG_ERROR("Could not open serial port\n");
+               Jim_SetResult(interp, Jim_NewStringObj(interp, "Could not open serial port", -1));
                return JIM_ERR;
        }
 
@@ -907,7 +904,7 @@ static int zylinjtag_Jim_Command_uart(Jim_Interp *interp, int argc,
                        &len);
        if (err != ENOERR)
        {
-               LOG_ERROR("Failed to get serial port settings %d", err);
+               Jim_SetResult(interp, Jim_NewStringObj(interp, "Failed to get serial port settings", -1));
                return JIM_ERR;
        }
        buf.baud = baud;
@@ -916,7 +913,7 @@ static int zylinjtag_Jim_Command_uart(Jim_Interp *interp, int argc,
                        &len);
        if (err != ENOERR)
        {
-               LOG_ERROR("Failed to set serial port settings %d", err);
+               Jim_SetResult(interp, Jim_NewStringObj(interp, "Failed to set serial port settings", -1));
                return JIM_ERR;
        }
 
@@ -956,7 +953,11 @@ int main(int argc, char *argv[])
 
        diag_init_putc(_zylinjtag_diag_write_char);
        // We want this in the log.
-       diag_printf("Zylin ZY1000.\n");
+#ifdef CYGPKG_HAL_NIOS2
+       diag_printf("Zylin ZY1000 PCB revc.\n");
+#else
+       diag_printf("Zylin ZY1000 PCB revb.\n");
+#endif
 
        err = mount("", "/ram", "ramfs");
        if (err < 0)
@@ -1089,6 +1090,9 @@ int main(int argc, char *argv[])
        command_set_output_handler(cmd_ctx, configuration_output_handler, NULL);
        command_context_mode(cmd_ctx, COMMAND_CONFIG);
 
+       if (util_init(cmd_ctx) != ERROR_OK)
+               return EXIT_FAILURE;
+
        if (ioutil_init(cmd_ctx) != ERROR_OK)
                return EXIT_FAILURE;