X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fecosboard.c;h=2a9950d6c9f9d4ec504f007b27009f7b311e2ccf;hb=646ce814b4fb678b7d8d341afe0694c266112426;hp=58520c33bfebb4a902470ed68e1d0fc7091b3671;hpb=5c4a73d0d89989b7fbe260ed4fa00a8259e01b03;p=openocd diff --git a/src/ecosboard.c b/src/ecosboard.c index 58520c33..2a9950d6 100644 --- a/src/ecosboard.c +++ b/src/ecosboard.c @@ -21,20 +21,17 @@ #include "config.h" #endif -#include "types.h" -#include "jtag.h" -#include "configuration.h" -#include "xsvf.h" -#include "svf.h" -#include "nand.h" -#include "pld.h" - -#include "server.h" -#include "telnet_server.h" -#include "gdb_server.h" -#include "openocd.h" - -#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include #include #include #include @@ -80,6 +77,7 @@ #include #include +#include #ifdef CYGPKG_HAL_NIOS2 #define ZY1000_SER_DEV "/dev/uart_0" @@ -251,11 +249,21 @@ int zy1000_configuration_output_handler_log(struct command_context *context, } #ifdef CYGPKG_PROFILE_GPROF +//extern int64_t totaltime; -int eCosBoard_handle_eCosBoard_profile_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc) +static int zylinjtag_Jim_Command_profile(Jim_Interp *interp, int argc, + Jim_Obj * const *argv) { - command_print(cmd_ctx, "Profiling started"); - start_profile(); + if ((argc == 2) && (strcmp(Jim_GetString(argv[1], NULL), "stats")==0)) + { +// profile_off(); + //LOG_USER("Stats %dms sleeping in select()", (int)totaltime); + } else + { + LOG_USER("Profiling started"); + start_profile(); + //totaltime = 0; + } return ERROR_OK; } @@ -505,8 +513,6 @@ static void zylinjtag_startNetwork(void) cyg_httpd_init_tcl_interpreter(); - interp = httpstate.jim_interp; - Jim_CreateCommand(httpstate.jim_interp, "log", zylinjtag_Jim_Command_log, NULL, NULL); Jim_CreateCommand(httpstate.jim_interp, "zy1000_reboot", @@ -933,8 +939,6 @@ bool logAllToSerial = false; int boolParam(char *var); -struct command_context *setup_command_handler(void); - static const char *zylin_config_dir="/config/settings"; static int add_default_dirs(void) @@ -945,8 +949,6 @@ static int add_default_dirs(void) return ERROR_OK; } -int ioutil_init(struct command_context *cmd_ctx); - int main(int argc, char *argv[]) { /* ramblockdevice will be the same address every time. The deflate app uses a buffer 16mBytes out, so we @@ -1078,33 +1080,23 @@ int main(int argc, char *argv[]) /* initialize commandline interface */ struct command_context * cmd_ctx; - cmd_ctx = setup_command_handler(); + struct command_context *setup_command_handler(Jim_Interp *interp); + cmd_ctx = setup_command_handler(httpstate.jim_interp); command_set_output_handler(cmd_ctx, configuration_output_handler, NULL); command_context_mode(cmd_ctx, COMMAND_CONFIG); -#if BUILD_IOUTIL if (ioutil_init(cmd_ctx) != ERROR_OK) - { return EXIT_FAILURE; - } -#endif - #ifdef CYGPKG_PROFILE_GPROF - register_command(cmd_ctx, NULL, "ecosboard_profile", eCosBoard_handle_eCosBoard_profile_command, - COMMAND_ANY, NULL); + Jim_CreateCommand(httpstate.jim_interp, "zy1000_profile", zylinjtag_Jim_Command_profile, + NULL, NULL); #endif - Jim_CreateCommand(interp, "uart", zylinjtag_Jim_Command_uart, NULL, NULL); + Jim_CreateCommand(httpstate.jim_interp, "uart", zylinjtag_Jim_Command_uart, NULL, NULL); - int errVal; - errVal = log_init(cmd_ctx); - if (errVal != ERROR_OK) - { - diag_printf("log_init() failed %d\n", errVal); - exit(-1); - } + log_init(); set_log_output(cmd_ctx, log); @@ -1121,6 +1113,11 @@ int main(int argc, char *argv[]) command_run_linef(cmd_ctx, "script /rom/openocd.cfg"); + int ret; + ret = server_init(cmd_ctx); + if (ERROR_OK != ret) + return EXIT_FAILURE; + /* we MUST always run the init command as it will launch telnet sessions */ command_run_line(cmd_ctx, "init");