]> git.sur5r.net Git - openocd/blobdiff - src/target/arm11.c
fixed gaffe: disable interrupts reset init script
[openocd] / src / target / arm11.c
index 59b6c4fe7c85032515b3da368ffe7ebf5558e46d..f962cde2bb6a4aa54e5728f921942c14b846261b 100644 (file)
@@ -1,6 +1,6 @@
 /***************************************************************************
  *   Copyright (C) 2008 digenius technology GmbH.                          *
- *   
+ *                                                                         *
  *   Copyright (C) 2008 Oyvind Harboe oyvind.harboe@zylin.com              *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -92,7 +92,7 @@ target_type_t arm11_target =
     ARM11_HANDLER(run_algorithm),
        
     ARM11_HANDLER(register_commands),
-    ARM11_HANDLER(target_command),
+    ARM11_HANDLER(target_create),
     ARM11_HANDLER(init_target),
     ARM11_HANDLER(examine),
     ARM11_HANDLER(quit),
@@ -726,7 +726,8 @@ int arm11_halt(struct target_s *target)
 
     arm11_common_t * arm11 = target->arch_info;
 
-    LOG_DEBUG("target->state: %s", target_state_strings[target->state]);
+    LOG_DEBUG("target->state: %s", 
+             Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
 
     if (target->state == TARGET_UNKNOWN)
     {
@@ -782,7 +783,9 @@ int arm11_resume(struct target_s *target, int current, u32 address, int handle_b
 
     arm11_common_t * arm11 = target->arch_info;
 
-    LOG_DEBUG("target->state: %s", target_state_strings[target->state]);
+    LOG_DEBUG("target->state: %s", 
+             Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
+
 
     if (target->state != TARGET_HALTED)
        {
@@ -877,7 +880,8 @@ int arm11_step(struct target_s *target, int current, u32 address, int handle_bre
 {
     FNC_INFO;
 
-    LOG_DEBUG("target->state: %s", target_state_strings[target->state]);
+    LOG_DEBUG("target->state: %s", 
+             Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
 
     if (target->state != TARGET_HALTED)
     {
@@ -1012,7 +1016,9 @@ int arm11_deassert_reset(struct target_s *target)
     FNC_INFO;
 
 #if 0
-    LOG_DEBUG("target->state: %s", target_state_strings[target->state]);
+    LOG_DEBUG("target->state: %s", 
+             Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
+
 
     /* deassert reset lines */
     jtag_add_reset(0, 0);
@@ -1345,28 +1351,21 @@ int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t
     return ERROR_OK;
 }
 
-int arm11_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target)
+int arm11_target_create(struct target_s *target, Jim_Interp *interp)
 {
     FNC_INFO;
 
-    if (argc < 4)
-    {
-       return ERROR_COMMAND_SYNTAX_ERROR;
-    }
-
-    int chain_pos = strtoul(args[3], NULL, 0);
-
     NEW(arm11_common_t, arm11, 1);
 
     arm11->target = target;
 
     /* prepare JTAG information for the new target */
-    arm11->jtag_info.chain_pos = chain_pos;
+    arm11->jtag_info.chain_pos = target->chain_position;
     arm11->jtag_info.scann_size        = 5;
 
     arm_jtag_setup_connection(&arm11->jtag_info);
 
-    jtag_device_t *device = jtag_get_device(chain_pos);
+    jtag_device_t *device = jtag_get_device(target->chain_position);
 
     if (device->ir_length != 5)
     {
@@ -1389,6 +1388,7 @@ int arm11_init_target(struct command_context_s *cmd_ctx, struct target_s *target
 int arm11_examine(struct target_s *target)
 {
     FNC_INFO;
+    int retval;
 
     arm11_common_t * arm11 = target->arch_info;
 
@@ -1415,7 +1415,8 @@ int arm11_examine(struct target_s *target)
 
     arm11_add_dr_scan_vc(asizeof(chain0_fields), chain0_fields, TAP_RTI);
 
-    jtag_execute_queue();
+    if ((retval=jtag_execute_queue())!=ERROR_OK) 
+       return retval;
 
 
     switch (arm11->device_id & 0x0FFFF000)
@@ -1462,6 +1463,8 @@ int arm11_examine(struct target_s *target)
 
     arm11_check_init(arm11, NULL);
 
+    target->type->examined = 1;
+    
     return ERROR_OK;
 }
 
@@ -1665,7 +1668,7 @@ arm11_common_t * arm11_find_target(const char * arg)
     size_t jtag_target         = strtoul(arg, NULL, 0);
 
     {target_t * t;
-    for (t = targets; t; t = t->next)
+    for (t = all_targets; t; t = t->next)
     {
        if (t->type != &arm11_target)
            continue;