diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-29 14:04:21 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-30 16:29:24 -0800 |
commit | 64653b0bbb0b2ac87de83d867f241360087b7588 (patch) | |
tree | b35650fb22ca24328193704f156a1d7b9e2f5174 /src/server | |
parent | ec6c1962c2398a574a5c413b41483370347b9f5b (diff) | |
download | riscv-openocd-64653b0bbb0b2ac87de83d867f241360087b7588.zip riscv-openocd-64653b0bbb0b2ac87de83d867f241360087b7588.tar.gz riscv-openocd-64653b0bbb0b2ac87de83d867f241360087b7588.tar.bz2 |
move server_init() to openocd_main()
Moves the telnet and TCL server startup to server_init(), moving their
respective command registration in to server_register_commands().
Adds proper error checking for these particular startup processes.
Moves the core server startup to openocd_main(), improving related error
checking and preparing to defer 'init'.
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/server.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/server/server.c b/src/server/server.c index 3ba433e..256c590 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -30,6 +30,8 @@ #include "server.h" #include "target.h" #include "openocd.h" +#include "tcl_server.h" +#include "telnet_server.h" #include <signal.h> @@ -516,7 +518,11 @@ int server_init(void) 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) @@ -551,6 +557,14 @@ static const struct command_registration server_command_handlers[] = { 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); } |