aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorGareth McMullin2012-06-24 16:53:13 +1200
committerGareth McMullin2012-06-24 19:08:49 +1200
commita16123997b77a5d3a137fcd80e6bf4134b7a4a23 (patch)
treefdef5d9e21fca06a0b9d06764d4c8545d78842f4 /src/include
parent8872315e82c6ab92864020f2a05490c5f6df91cd (diff)
Added target.c for common target routines.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/target.h20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/include/target.h b/src/include/target.h
index 37a712a..5f3a5ab 100644
--- a/src/include/target.h
+++ b/src/include/target.h
@@ -25,6 +25,11 @@
#ifndef __TARGET_H
#define __TARGET_H
+typedef struct target_s target;
+
+target *target_new(unsigned size);
+void target_list_free(void);
+
/* Halt/resume functions */
#define target_attach(target) \
(target)->attach(target)
@@ -106,18 +111,7 @@
#define target_flash_write(target, dest, src, len) \
(target)->flash_write((target), (dest), (src), (len))
-
-#define TARGET_LIST_FREE() { \
- while(target_list) { \
- target *t = target_list->next; \
- free(target_list); \
- target_list = t; \
- } \
- last_target = cur_target = NULL; \
-}
-
-
-typedef struct target_s {
+struct target_s {
/* Attach/Detach funcitons */
void (*attach)(struct target_s *target);
void (*detach)(struct target_s *target);
@@ -173,7 +167,7 @@ typedef struct target_s {
int size;
struct target_s *next;
-} target;
+};
extern target *target_list, *cur_target, *last_target;