From 0643263d68bcddc56eaa7e3678b7502798410711 Mon Sep 17 00:00:00 2001
From: zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Date: Mon, 11 May 2009 04:28:24 +0000
Subject: [PATCH] Audit and eliminate redundant #include directives in
 src/flash headers.

git-svn-id: svn://svn.berlios.de/openocd/trunk@1711 b42882b7-edfa-0310-969c-e2dbd0fdcd60
---
 src/flash/at91sam7.h     |  1 -
 src/flash/avrf.h         |  2 ++
 src/flash/cfi.h          |  1 -
 src/flash/flash.h        | 12 +++++++-----
 src/flash/lpc2000.h      |  1 -
 src/flash/lpc288x.h      |  1 -
 src/flash/mflash.h       |  2 ++
 src/flash/non_cfi.h      |  2 +-
 src/flash/pic32mx.h      |  1 -
 src/flash/s3c24xx_nand.h |  2 +-
 src/flash/stellaris.h    |  1 -
 src/flash/stm32x.h       |  1 -
 src/flash/str7x.h        |  1 -
 src/flash/str9x.h        |  1 -
 src/flash/str9xpec.h     |  1 -
 15 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/src/flash/at91sam7.h b/src/flash/at91sam7.h
index f57f36ec8..5e652bf06 100644
--- a/src/flash/at91sam7.h
+++ b/src/flash/at91sam7.h
@@ -24,7 +24,6 @@
 #define AT91SAM7_H
 
 #include "flash.h"
-#include "target.h"
 
 typedef struct at91sam7_flash_bank_s
 {
diff --git a/src/flash/avrf.h b/src/flash/avrf.h
index 6c5868c4d..12ef8bdb6 100644
--- a/src/flash/avrf.h
+++ b/src/flash/avrf.h
@@ -20,6 +20,8 @@
 #ifndef AVRF_H
 #define AVRF_H
 
+#include "types.h"
+
 typedef struct avrf_type_s
 {
 	char name[15];
diff --git a/src/flash/cfi.h b/src/flash/cfi.h
index dc43dd18b..49fbad497 100644
--- a/src/flash/cfi.h
+++ b/src/flash/cfi.h
@@ -21,7 +21,6 @@
 #define CFI_H
 
 #include "flash.h"
-#include "target.h"
 
 #define CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7 0xE0 /* DQ5..DQ7 */
 #define CFI_STATUS_POLL_MASK_DQ6_DQ7     0xC0 /* DQ6..DQ7 */
diff --git a/src/flash/flash.h b/src/flash/flash.h
index 817c60628..1a98286cc 100644
--- a/src/flash/flash.h
+++ b/src/flash/flash.h
@@ -27,7 +27,9 @@
 #define FLASH_H
 
 #include "target.h"
-#include "image.h"
+#include "log.h"
+
+struct image_s;
 
 #define FLASH_MAX_ERROR_STR	(128)
 
@@ -65,7 +67,7 @@ typedef struct flash_driver_s
 
 typedef struct flash_bank_s
 {
-	target_t *target;
+	struct target_s *target;
 	flash_driver_t *driver;
 	void *driver_priv;
 	int bank_number;
@@ -81,8 +83,8 @@ typedef struct flash_bank_s
 extern int flash_register_commands(struct command_context_s *cmd_ctx);
 extern int flash_init_drivers(struct command_context_s *cmd_ctx);
 
-extern int flash_erase_address_range(target_t *target, u32 addr, u32 length);
-extern int flash_write(target_t *target, image_t *image, u32 *written, int erase);
+extern int flash_erase_address_range(struct target_s *target, u32 addr, u32 length);
+extern int flash_write(struct target_s *target, struct image_s *image, u32 *written, int erase);
 extern void flash_set_dirty(void);
 extern int flash_get_bank_count(void);
 extern int default_flash_blank_check(struct flash_bank_s *bank);
@@ -90,7 +92,7 @@ extern int default_flash_mem_blank_check(struct flash_bank_s *bank);
 
 extern flash_bank_t *get_flash_bank_by_num(int num);
 extern flash_bank_t *get_flash_bank_by_num_noprobe(int num);
-extern flash_bank_t *get_flash_bank_by_addr(target_t *target, u32 addr);
+extern flash_bank_t *get_flash_bank_by_addr(struct target_s *target, u32 addr);
 
 #define ERROR_FLASH_BANK_INVALID			(-900)
 #define ERROR_FLASH_SECTOR_INVALID			(-901)
diff --git a/src/flash/lpc2000.h b/src/flash/lpc2000.h
index c527588cd..a047381fb 100644
--- a/src/flash/lpc2000.h
+++ b/src/flash/lpc2000.h
@@ -21,7 +21,6 @@
 #define LPC2000_H
 
 #include "flash.h"
-#include "target.h"
 
 typedef struct lpc2000_flash_bank_s
 {
diff --git a/src/flash/lpc288x.h b/src/flash/lpc288x.h
index d9f99dd44..522d0eb49 100644
--- a/src/flash/lpc288x.h
+++ b/src/flash/lpc288x.h
@@ -22,7 +22,6 @@
 #define lpc288x_H
 
 #include "flash.h"
-#include "target.h"
 
 typedef struct lpc288x_flash_bank_s
 {
diff --git a/src/flash/mflash.h b/src/flash/mflash.h
index 4f9e0a003..e78f24864 100644
--- a/src/flash/mflash.h
+++ b/src/flash/mflash.h
@@ -20,6 +20,8 @@
 #ifndef _MFLASH_H
 #define _MFLASH_H
 
+#include "target.h"
+
 typedef unsigned long mg_io_uint32;
 typedef unsigned short mg_io_uint16;
 typedef unsigned char mg_io_uint8;
diff --git a/src/flash/non_cfi.h b/src/flash/non_cfi.h
index e4b33d403..3950e21b9 100644
--- a/src/flash/non_cfi.h
+++ b/src/flash/non_cfi.h
@@ -20,7 +20,7 @@
 #ifndef NON_CFI_H
 #define NON_CFI_H
 
-#include "types.h"
+#include "flash.h"
 
 typedef struct non_cfi_s
 {
diff --git a/src/flash/pic32mx.h b/src/flash/pic32mx.h
index f799a467b..da102c071 100644
--- a/src/flash/pic32mx.h
+++ b/src/flash/pic32mx.h
@@ -27,7 +27,6 @@
 #define PIC32MX_H
 
 #include "flash.h"
-#include "target.h"
 
 typedef struct pic32mx_flash_bank_s
 {
diff --git a/src/flash/s3c24xx_nand.h b/src/flash/s3c24xx_nand.h
index d77bafe55..8f96f2d27 100644
--- a/src/flash/s3c24xx_nand.h
+++ b/src/flash/s3c24xx_nand.h
@@ -24,7 +24,7 @@
  * Many thanks to Simtec Electronics for sponsoring this work.
  */
 
-#include "target.h"
+#include "nand.h"
 #include "s3c24xx_regs_nand.h"
 
 typedef struct s3c24xx_nand_controller_s
diff --git a/src/flash/stellaris.h b/src/flash/stellaris.h
index 2bf4aa6c2..317309a63 100644
--- a/src/flash/stellaris.h
+++ b/src/flash/stellaris.h
@@ -21,7 +21,6 @@
 #define STELLARIS_FLASH_H
 
 #include "flash.h"
-#include "target.h"
 
 typedef struct stellaris_flash_bank_s
 {
diff --git a/src/flash/stm32x.h b/src/flash/stm32x.h
index 1357162c8..587f97f7f 100644
--- a/src/flash/stm32x.h
+++ b/src/flash/stm32x.h
@@ -24,7 +24,6 @@
 #define STM32X_H
 
 #include "flash.h"
-#include "target.h"
 
 typedef struct stm32x_options_s
 {
diff --git a/src/flash/str7x.h b/src/flash/str7x.h
index b602498cd..5d0b1824a 100644
--- a/src/flash/str7x.h
+++ b/src/flash/str7x.h
@@ -24,7 +24,6 @@
 #define STR7X_H
 
 #include "flash.h"
-#include "target.h"
 
 typedef struct str7x_flash_bank_s
 {
diff --git a/src/flash/str9x.h b/src/flash/str9x.h
index 5e36e48de..b5e569d0e 100644
--- a/src/flash/str9x.h
+++ b/src/flash/str9x.h
@@ -24,7 +24,6 @@
 #define STR9X_H
 
 #include "flash.h"
-#include "target.h"
 
 typedef struct str9x_flash_bank_s
 {
diff --git a/src/flash/str9xpec.h b/src/flash/str9xpec.h
index 7796026f7..250e251b5 100644
--- a/src/flash/str9xpec.h
+++ b/src/flash/str9xpec.h
@@ -24,7 +24,6 @@
 #define STR9XPEC_H
 
 #include "flash.h"
-#include "target.h"
 #include "jtag.h"
 
 typedef struct str9xpec_flash_controller_s
-- 
GitLab