}\r
else\r
{\r
- command_print(cmd_ctx, "usage: at91sam7 gpnvm <num> <bit> <set|clear>");\r
- return ERROR_OK;\r
+ return ERROR_COMMAND_SYNTAX_ERROR;
}\r
\r
/* Configure the flash controller timing */\r
int i;\r
working_area_t *download_area;\r
\r
- if (bank->target->state != TARGET_HALTED)\r
- {\r
- return ERROR_TARGET_NOT_HALTED;\r
- }\r
- \r
/* allocate a working area */\r
if (target_alloc_working_area(target, lpc2000_info->cmd51_max_buffer, &download_area) != ERROR_OK)\r
{\r
\r
if (argc < 1)\r
{\r
- command_print(cmd_ctx, "usage: lpc2000 part_id <num>");\r
- return ERROR_OK;\r
+ return ERROR_COMMAND_SYNTAX_ERROR;
}\r
\r
bank = get_flash_bank_by_num(strtoul(args[0], NULL, 0));\r
static size_t num_script_dirs;\r
static char** script_search_dirs;\r
\r
-int configuration_output_handler(struct command_context_s *context, char* line)\r
-{\r
- INFO(line);\r
- \r
- return ERROR_OK;\r
-}\r
\r
void add_script_search_dir (const char *dir)\r
{\r
};\r
\r
\r
+\r
+int configuration_output_handler(struct command_context_s *context, char* line)\r
+{\r
+ INFO(line);\r
+\r
+ return ERROR_OK;\r
+}\r
+\r
+\r
int parse_cmdline_args(struct command_context_s *cmd_ctx, int argc, char *argv[])\r
{\r
int c;\r
if (argc < 1)
{
- command_print(cmd_ctx, "usage: endstate <tap_state>");
+ return ERROR_COMMAND_SYNTAX_ERROR;\r
}
else
{
{
int trst = -1;
int srst = -1;
- char *usage = "usage: jtag_reset <trst> <srst>";
int retval;
if (argc < 1)
{
- command_print(cmd_ctx, usage);
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;\r
+\r
}
if (args[0][0] == '1')
trst = 0;
else
{
- command_print(cmd_ctx, usage);
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;\r
}
if (args[1][0] == '1')
srst = 0;
else
{
- command_print(cmd_ctx, usage);
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;\r
}
if ((retval = jtag_add_reset(trst, srst)) != ERROR_OK)
{
if (argc < 1)
{
- command_print(cmd_ctx, "usage: runtest <num_cycles>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;\r
}
jtag_add_runtest(strtol(args[0], NULL, 0), -1);
if ((argc < 2) || (argc % 2))
{
- command_print(cmd_ctx, "usage: irscan <device> <instr> [dev2] [instr2] ...");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;\r
}
fields = malloc(sizeof(scan_field_t) * argc / 2);
if ((argc < 2) || (argc % 2))
{
- command_print(cmd_ctx, "usage: drscan <device> <var> [dev2] [var2]");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;\r
}
for (i = 0; i < argc; i+=2)
int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
- if (argc == 0)
- {
- command_print(cmd_ctx, "verify Capture-IR is %s", (jtag_verify_capture_ir) ? "enabled": "disabled");
- return ERROR_OK;
- }
-
- if (strcmp(args[0], "enable") == 0)
+ if (argc == 1)\r
{
- jtag_verify_capture_ir = 1;
- }
- else if (strcmp(args[0], "disable") == 0)
- {
- jtag_verify_capture_ir = 0;
- }
+ if (strcmp(args[0], "enable") == 0)
+ {
+ jtag_verify_capture_ir = 1;
+ }
+ else if (strcmp(args[0], "disable") == 0)
+ {
+ jtag_verify_capture_ir = 0;
+ } else\r
+ {\r
+ return ERROR_COMMAND_SYNTAX_ERROR;\r
+ }
+ } else if (argc != 0)\r
+ {\r
+ return ERROR_COMMAND_SYNTAX_ERROR;\r
+ }\r
+ \r
+ command_print(cmd_ctx, "verify Capture-IR is %s", (jtag_verify_capture_ir) ? "enabled": "disabled");\r
return ERROR_OK;
}
FD_SET(fileno(stdin), &read_fds);
#endif
- if ((retval = select(fd_max + 1, &read_fds, NULL, NULL, &tv)) == -1)
+ retval = select(fd_max + 1, &read_fds, NULL, NULL, &tv);
+
+ if (retval == -1)
{
#ifdef _WIN32
#else
if (errno == EINTR)
+ {\r
FD_ZERO(&read_fds);
+ }\r
else
{
ERROR("error during select: %s", strerror(errno));
/* do regular tasks after at most 100ms */
tv.tv_sec = 0;
tv.tv_usec = 10000;
+ FD_ZERO(&read_fds); /* eCos leaves read_fds unchanged in this case! */\r
}
for (service = services; service; service = service->next)
&& (FD_ISSET(service->fd, &read_fds)))
{
if (service->max_connections > 0)
+ {\r
add_connection(service, command_context);
+ }
else
{
struct sockaddr_in sin;
switch (event)
{
case TARGET_EVENT_HALTED:
- command_print(cmd_ctx, "Target %i halted", get_num_by_target(target));
target_arch_state(target);
if (!t_con->suppress_prompt)
telnet_prompt(connection);
break;
case TARGET_EVENT_RESUMED:
- command_print(cmd_ctx, "Target %i resumed", get_num_by_target(target));
if (!t_con->suppress_prompt)
telnet_prompt(connection);
break;
int cli_target_callback_event_handler(struct target_s *target, enum target_event event, void *priv);
-int handle_arch_state_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_daemon_startup_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
register_command(cmd_ctx, NULL, "run_and_halt_time", handle_run_and_halt_time_command, COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "working_area", handle_working_area_command, COMMAND_ANY, "working_area <target#> <address> <size> <'backup'|'nobackup'> [virtual address]");
register_command(cmd_ctx, NULL, "virt2phys", handle_virt2phys_command, COMMAND_ANY, "virt2phys <virtual address>");
- register_command(cmd_ctx, NULL, "arch_state", handle_arch_state_command, COMMAND_ANY, "prints CPU state information");
return ERROR_OK;
}
if (argc == 0)
{
target->type->poll(target);
- command_print(cmd_ctx, "target state: %s", target_state_strings[target->state]);
- if (target->state == TARGET_HALTED)
- {
target_arch_state(target);
- }
}
else
{
gettimeofday(&timeout, NULL);
timeval_add_time(&timeout, 0, ms * 1000);
- command_print(cmd_ctx, "waiting for target %s...", target_state_strings[state]);
target_t *target = get_current_target(cmd_ctx);
for (;;)
target_call_timer_callbacks();
if (target->state == state)
{
- command_print(cmd_ctx, "target %s", target_state_strings[state]);
break;
}
+ command_print(cmd_ctx, "waiting for target %s...", target_state_strings[state]);
gettimeofday(&now, NULL);
if ((now.tv_sec > timeout.tv_sec) || ((now.tv_sec == timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec)))
int retval;
target_t *target = get_current_target(cmd_ctx);
- DEBUG("-");
-
if (argc == 0)
retval = target->type->resume(target, 1, 0, 1, 0); /* current pc, addr = 0, handle breakpoints, not debugging */
else if (argc == 1)
retval = target->type->resume(target, 0, strtoul(args[0], NULL, 0), 1, 0); /* addr = args[0], handle breakpoints, not debugging */
else
{
- command_print(cmd_ctx, "usage: resume [address]");
- return ERROR_OK;
- }
-
- if (retval != ERROR_OK)
- {
- switch (retval)
- {
- case ERROR_TARGET_NOT_HALTED:
- command_print(cmd_ctx, "target not halted");
- break;
- default:
- command_print(cmd_ctx, "unknown error... shutting down");
- exit(-1);
- }
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
target_process_events(cmd_ctx);
- return ERROR_OK;
+ target_arch_state(target);
+
+ return retval;
}
int handle_step_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
}
return retval;
}
-int handle_arch_state_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc)
-{
- int retval;
- if (argc!=0)
- return ERROR_COMMAND_SYNTAX_ERROR;
-
- target_t *target = get_target_by_num(cmd_ctx->current_target);
- retval=target_arch_state(target);
- return retval;
-}