First step in hiding target_type_s from public interface:
[fw/openocd] / src / target / target.h
index 9674c473c150409869c4bb6a82ca964329721685..dc871bf20f6dfae6532d28d35b7b7f762014dcaf 100644 (file)
@@ -105,8 +105,13 @@ typedef struct working_area_s
        struct working_area_s *next;
 } working_area_t;
 
-typedef struct target_type_s
+#ifdef DEFINE_TARGET_TYPE_S
+struct target_type_s
 {
+       /**
+        * Name of the target.  Do @b not access this field directly, use
+        * target_get_name() instead.
+        */
        char *name;
 
        /**
@@ -151,7 +156,9 @@ typedef struct target_type_s
        int (*soft_reset_halt_imp)(struct target_s *target);
        int (*soft_reset_halt)(struct target_s *target);
 
-       /* target register access for gdb.
+       /**
+        * Target register access for GDB.  Do @b not call this function
+        * directly, use target_get_gdb_reg_list() instead.
         *
         * Danger! this function will succeed even if the target is running
         * and return a register list with dummy values.
@@ -252,7 +259,11 @@ typedef struct target_type_s
        int (*virt2phys)(struct target_s *target, u32 address, u32 *physical);
        int (*mmu)(struct target_s *target, int *enabled);
 
-} target_type_t;
+};
+#else
+struct target_type_s;
+#endif // DEFINE_TARGET_TYPE_S
+typedef struct target_type_s target_type_t;
 
 /* forward decloration */
 typedef struct target_event_action_s target_event_action_t;
@@ -393,6 +404,19 @@ extern target_t* get_current_target(struct command_context_s *cmd_ctx);
 extern int get_num_by_target(target_t *query_target);
 extern target_t *get_target(const char *id);
 
+/**
+ * Get the target name.
+ *
+ * This routine is a wrapper for the target->type->name field.
+ */
+extern const char *target_get_name(struct target_s *target);
+
+/**
+ * Examine the specified @a target.
+ *
+ * This routine is a wrapper for target->type->examine.
+ */
+extern int target_examine_one(struct target_s *target);
 /// @returns @c true if the target has been examined.
 extern bool target_was_examined(struct target_s *target);
 /// Sets the @c examined flag for the given target.
@@ -400,6 +424,51 @@ extern void target_set_examined(struct target_s *target);
 /// Reset the @c examined flag for the given target.
 extern void target_reset_examined(struct target_s *target);
 
+
+/**
+ * Add the @a breakpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->add_breakpoint.
+ */
+extern int target_add_breakpoint(struct target_s *target,
+               struct breakpoint_s *breakpoint);
+/**
+ * Remove the @a breakpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->remove_breakpoint.
+ */
+extern int target_remove_breakpoint(struct target_s *target,
+               struct breakpoint_s *breakpoint);
+/**
+ * Add the @a watchpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->add_watchpoint.
+ */
+extern int target_add_watchpoint(struct target_s *target,
+               struct watchpoint_s *watchpoint);
+/**
+ * Remove the @a watchpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->remove_watchpoint.
+ */
+extern int target_remove_watchpoint(struct target_s *target,
+               struct watchpoint_s *watchpoint);
+
+/**
+ * Obtain the registers for GDB.
+ *
+ * This routine is a wrapper for target->type->get_gdb_reg_list.
+ */
+extern int target_get_gdb_reg_list(struct target_s *target,
+               struct reg_s **reg_list[], int *reg_list_size);
+
+/**
+ * Step the target.
+ *
+ * This routine is a wrapper for target->type->step.
+ */
+int target_step(struct target_s *target,
+               int current, u32 address, int handle_breakpoints);
 /**
  * Run an algorithm on the @a target given.
  *