#include "target.h"
#include "target_type.h"
#include "target_request.h"
+#include "breakpoints.h"
#include "time_support.h"
#include "register.h"
#include "trace.h"
return NULL;
}
-struct target* get_current_target(command_context_t *cmd_ctx)
+struct target* get_current_target(struct command_context *cmd_ctx)
{
struct target *target = get_target_by_num(cmd_ctx->current_target);
return retval;
}
-int target_process_reset(struct command_context_s *cmd_ctx, enum target_reset_mode reset_mode)
+int target_process_reset(struct command_context *cmd_ctx, enum target_reset_mode reset_mode)
{
char buf[100];
int retval;
entry_point, exit_point, timeout_ms, arch_info);
}
-/// @returns @c true if the target has been examined.
-bool target_was_examined(struct target *target)
-{
- return target->type->examined;
-}
-/// Sets the @c examined flag for the given target.
-void target_set_examined(struct target *target)
-{
- target->type->examined = true;
-}
-// Reset the @c examined flag for the given target.
-void target_reset_examined(struct target *target)
+/**
+ * Reset the @c examined flag for the given target.
+ * Pure paranoia -- targets are zeroed on allocation.
+ */
+static void target_reset_examined(struct target *target)
{
- target->type->examined = false;
+ target->examined = false;
}
return ERROR_FAIL;
}
-int target_init(struct command_context_s *cmd_ctx)
+int target_init(struct command_context *cmd_ctx)
{
struct target *target;
int retval;
return target->type->step(target, current_pc, addr, 1);
}
-static void handle_md_output(struct command_context_s *cmd_ctx,
+static void handle_md_output(struct command_context *cmd_ctx,
struct target *target, uint32_t address, unsigned size,
unsigned count, const uint8_t *buffer)
{
return ERROR_COMMAND_SYNTAX_ERROR;
unsigned size = 0;
- switch (CMD_NAME[2]) {
+ const char *cmd_name = CMD_NAME;
+ switch (cmd_name[6]) {
case 'w': size = 4; break;
case 'h': size = 2; break;
case 'b': size = 1; break;
bool physical=strcmp(args[0], "phys")==0;
int (*fn)(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
+ const char *cmd_name = CMD_NAME;
if (physical)
{
argc--;
struct target *target = get_current_target(cmd_ctx);
unsigned wordsize;
uint8_t value_buf[4];
- switch (CMD_NAME[2])
+ switch (cmd_name[6])
{
case 'w':
wordsize = 4;
return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 0);
}
-static int handle_bp_command_list(struct command_context_s *cmd_ctx)
+static int handle_bp_command_list(struct command_context *cmd_ctx)
{
struct target *target = get_current_target(cmd_ctx);
struct breakpoint *breakpoint = target->breakpoints;
return ERROR_OK;
}
-static int handle_bp_command_set(struct command_context_s *cmd_ctx,
+static int handle_bp_command_set(struct command_context *cmd_ctx,
uint32_t addr, uint32_t length, int hw)
{
struct target *target = get_current_target(cmd_ctx);
while (watchpoint)
{
- command_print(cmd_ctx,
- "address: 0x%8.8" PRIx32 ", len: 0x%8.8x, r/w/a: %i, value: 0x%8.8" PRIx32 ", mask: 0x%8.8" PRIx32 "",
- watchpoint->address,
- watchpoint->length,
- (int)(watchpoint->rw),
- watchpoint->value,
- watchpoint->mask);
+ command_print(cmd_ctx, "address: 0x%8.8" PRIx32
+ ", len: 0x%8.8" PRIx32
+ ", r/w/a: %i, value: 0x%8.8" PRIx32
+ ", mask: 0x%8.8" PRIx32,
+ watchpoint->address,
+ watchpoint->length,
+ (int)watchpoint->rw,
+ watchpoint->value,
+ watchpoint->mask);
watchpoint = watchpoint->next;
}
return ERROR_OK;
static int jim_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
- command_context_t *context;
+ struct command_context *context;
struct target *target;
context = Jim_GetAssocData(interp, "context");
static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
- command_context_t *context;
+ struct command_context *context;
struct target *target;
context = Jim_GetAssocData(interp, "context");
uint8_t target_buf[32];
Jim_Nvp *n;
struct target *target;
- struct command_context_s *cmd_ctx;
+ struct command_context *cmd_ctx;
int e;
enum {
int e;
int x;
struct target *target;
- struct command_context_s *cmd_ctx;
+ struct command_context *cmd_ctx;
cmd_ctx = Jim_GetAssocData(goi->interp, "context");
if (goi->argc < 3) {
{
int x,r,e;
jim_wide w;
- struct command_context_s *cmd_ctx;
+ struct command_context *cmd_ctx;
struct target *target;
Jim_GetOptInfo goi;
enum tcmd {
static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
- command_context_t *context;
+ struct command_context *context;
struct target *target;
int retval;
return JIM_OK;
}
-int target_register_commands(struct command_context_s *cmd_ctx)
+int target_register_commands(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "targets",
return ERROR_OK;
}
-int target_register_user_commands(struct command_context_s *cmd_ctx)
+int target_register_user_commands(struct command_context *cmd_ctx)
{
int retval = ERROR_OK;
if ((retval = target_request_register_commands(cmd_ctx)) != ERROR_OK)