#include "mflash.h"
#include "server.h"
-#include "telnet_server.h"
#include "gdb_server.h"
-#include "tcl_server.h"
#include "httpd.h"
#ifdef HAVE_STRINGS_H
return ERROR_FAIL;
LOG_DEBUG("pld init complete");
- /* initialize tcp server */
- server_init();
-
/* initialize telnet subsystem */
- telnet_init("Open On-Chip Debugger");
gdb_target_add_all(all_targets);
- tcl_init(); /* allows tcl to just connect without going thru telnet */
target_register_event_callback(log_target_callback_event_handler, CMD_CTX);
register_commands(cmd_ctx, NULL, openocd_command_handlers);
/* register subsystem commands */
server_register_commands(cmd_ctx);
- telnet_register_commands(cmd_ctx);
gdb_register_commands(cmd_ctx);
- tcl_register_commands(cmd_ctx); /* tcl server commands */
log_register_commands(cmd_ctx);
jtag_register_commands(cmd_ctx);
xsvf_register_commands(cmd_ctx);
return EXIT_FAILURE;
ret = parse_config_file(cmd_ctx);
- if ((ret != ERROR_OK) && (ret != ERROR_COMMAND_CLOSE_CONNECTION))
+ if (ret != ERROR_OK)
return EXIT_FAILURE;
#if BUILD_HTTPD
return EXIT_FAILURE;
#endif
- if (ret != ERROR_COMMAND_CLOSE_CONNECTION)
+ ret = server_init();
+ if (ERROR_OK != ret)
+ return EXIT_FAILURE;
+
+ if (1)
{
- if (command_run_line(cmd_ctx, "init") != ERROR_OK)
- return EXIT_FAILURE;
+ ret = command_run_line(cmd_ctx, "init");
+ if (ERROR_OK != ret)
+ ret = EXIT_FAILURE;
+ }
- /* handle network connections */
+ /* handle network connections */
+ if (ERROR_OK == ret)
server_loop(cmd_ctx);
- }
- /* shut server down */
server_quit();
#if BUILD_HTTPD
/* free commandline interface */
command_done(cmd_ctx);
-
- return EXIT_SUCCESS;
+ return ret;
}
#include "server.h"
#include "target.h"
#include "openocd.h"
+#include "tcl_server.h"
+#include "telnet_server.h"
#include <signal.h>
signal(SIGABRT, sig_handler);
#endif
- return ERROR_OK;
+ int ret = tcl_init();
+ if (ERROR_OK != ret)
+ return ret;
+
+ return telnet_init("Open On-Chip Debugger");
}
int server_quit(void)
int server_register_commands(struct command_context *cmd_ctx)
{
+ int retval = telnet_register_commands(cmd_ctx);
+ if (ERROR_OK != retval)
+ return retval;
+
+ retval = tcl_register_commands(cmd_ctx);
+ if (ERROR_OK != retval)
+ return retval;
+
return register_commands(cmd_ctx, NULL, server_command_handlers);
}