+/**
+ * Get the target type name.
+ *
+ * This routine is a wrapper for the target->type->name field.
+ * Note that this is not an instance-specific name for his target.
+ */
+const char *target_type_name(struct target *target);
+
+/**
+ * Examine the specified @a target, letting it perform any
+ * Initialisation that requires JTAG access.
+ *
+ * This routine is a wrapper for target->type->examine.
+ */
+int target_examine_one(struct target *target);
+
+/** @returns @c true if target_set_examined() has been called. */
+static inline bool target_was_examined(struct target *target)
+{
+ return target->examined;
+}
+
+/** Sets the @c examined flag for the given target. */
+/** Use in target->type->examine() after one-time setup is done. */
+static inline void target_set_examined(struct target *target)
+{
+ target->examined = true;
+}
+
+/**
+ * Add the @a breakpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->add_breakpoint.
+ */
+int target_add_breakpoint(struct target *target,
+ struct breakpoint *breakpoint);
+/**
+ * Add the @a ContextID breakpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->add_context_breakpoint.
+ */
+int target_add_context_breakpoint(struct target *target,
+ struct breakpoint *breakpoint);
+/**
+ * Add the @a ContextID & IVA breakpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->add_hybrid_breakpoint.
+ */
+int target_add_hybrid_breakpoint(struct target *target,
+ struct breakpoint *breakpoint);
+/**
+ * Remove the @a breakpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->remove_breakpoint.
+ */
+
+int target_remove_breakpoint(struct target *target,
+ struct breakpoint *breakpoint);
+/**
+ * Add the @a watchpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->add_watchpoint.
+ */
+int target_add_watchpoint(struct target *target,
+ struct watchpoint *watchpoint);
+/**
+ * Remove the @a watchpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->remove_watchpoint.
+ */
+int target_remove_watchpoint(struct target *target,
+ struct watchpoint *watchpoint);
+
+/**
+ * Obtain the registers for GDB.
+ *
+ * This routine is a wrapper for target->type->get_gdb_reg_list.
+ */
+int target_get_gdb_reg_list(struct target *target,
+ struct reg **reg_list[], int *reg_list_size);
+
+/**
+ * Step the target.
+ *
+ * This routine is a wrapper for target->type->step.
+ */
+int target_step(struct target *target,
+ int current, uint32_t address, int handle_breakpoints);
+/**
+ * Run an algorithm on the @a target given.
+ *
+ * This routine is a wrapper for target->type->run_algorithm.
+ */
+int target_run_algorithm(struct target *target,
+ int num_mem_params, struct mem_param *mem_params,
+ int num_reg_params, struct reg_param *reg_param,
+ uint32_t entry_point, uint32_t exit_point,
+ int timeout_ms, void *arch_info);
+
+/**
+ * Starts an algorithm in the background on the @a target given.
+ *
+ * This routine is a wrapper for target->type->start_algorithm.
+ */
+int target_start_algorithm(struct target *target,
+ int num_mem_params, struct mem_param *mem_params,
+ int num_reg_params, struct reg_param *reg_params,
+ uint32_t entry_point, uint32_t exit_point,
+ void *arch_info);
+
+/**
+ * Wait for an algorithm on the @a target given.
+ *
+ * This routine is a wrapper for target->type->wait_algorithm.
+ */
+int target_wait_algorithm(struct target *target,
+ int num_mem_params, struct mem_param *mem_params,
+ int num_reg_params, struct reg_param *reg_params,
+ uint32_t exit_point, int timeout_ms,
+ void *arch_info);
+
+/**
+ * This routine is a wrapper for asynchronous algorithms.
+ *
+ */
+int target_run_flash_async_algorithm(struct target *target,
+ uint8_t *buffer, uint32_t count, int block_size,
+ int num_mem_params, struct mem_param *mem_params,
+ int num_reg_params, struct reg_param *reg_params,
+ uint32_t buffer_start, uint32_t buffer_size,
+ uint32_t entry_point, uint32_t exit_point,
+ void *arch_info);
+
+/**
+ * Read @a count items of @a size bytes from the memory of @a target at
+ * the @a address given.
+ *
+ * This routine is a wrapper for target->type->read_memory.
+ */
+int target_read_memory(struct target *target,
+ uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
+/**
+ * Write @a count items of @a size bytes to the memory of @a target at
+ * the @a address given. @a address must be aligned to @a size
+ * in target memory.
+ *
+ * The endianness is the same in the host and target memory for this
+ * function.
+ *
+ * \todo TODO:
+ * Really @a buffer should have been defined as "const void *" and
+ * @a buffer should have been aligned to @a size in the host memory.
+ *
+ * This is not enforced via e.g. assert's today and e.g. the
+ * target_write_buffer fn breaks this assumption.
+ *
+ * This routine is wrapper for target->type->write_memory.
+ */
+int target_write_memory(struct target *target,
+ uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
+
+/**
+ * Write @a count items of 4 bytes to the memory of @a target at
+ * the @a address given. Because it operates only on whole words,
+ * this should be faster than target_write_memory().
+ *
+ * This routine is wrapper for target->type->bulk_write_memory.
+ */
+int target_bulk_write_memory(struct target *target,
+ uint32_t address, uint32_t count, const uint8_t *buffer);
+
+/*
+ * Write to target memory using the virtual address.
+ *
+ * Note that this fn is used to implement software breakpoints. Targets
+ * can implement support for software breakpoints to memory marked as read
+ * only by making this fn write to ram even if it is read only(MMU or
+ * MPUs).
+ *
+ * It is sufficient to implement for writing a single word(16 or 32 in
+ * ARM32/16 bit case) to write the breakpoint to ram.
+ *
+ * The target should also take care of "other things" to make sure that
+ * software breakpoints can be written using this function. E.g.
+ * when there is a separate instruction and data cache, this fn must
+ * make sure that the instruction cache is synced up to the potential
+ * code change that can happen as a result of the memory write(typically
+ * by invalidating the cache).
+ *
+ * The high level wrapper fn in target.c will break down this memory write
+ * request to multiple write requests to the target driver to e.g. guarantee
+ * that writing 4 bytes to an aligned address happens with a single 32 bit
+ * write operation, thus making this fn suitable to e.g. write to special
+ * peripheral registers which do not support byte operations.
+ */
+int target_write_buffer(struct target *target,
+ uint32_t address, uint32_t size, const uint8_t *buffer);
+int target_read_buffer(struct target *target,
+ uint32_t address, uint32_t size, uint8_t *buffer);
+int target_checksum_memory(struct target *target,
+ uint32_t address, uint32_t size, uint32_t *crc);
+int target_blank_check_memory(struct target *target,
+ uint32_t address, uint32_t size, uint32_t *blank);
+int target_wait_state(struct target *target, enum target_state state, int ms);
+
+/** Return the *name* of this targets current state */
+const char *target_state_name(struct target *target);