Change return value on error.
[fw/openocd] / src / flash / nor / lpc288x.c
index 252a8133f7069eced7f35e37c9e8dc10ed26a7a6..d5fde9487e50f58a47d913018dcfa55613ceae6b 100644 (file)
@@ -31,7 +31,7 @@
 #include "config.h"
 #endif
 
-#include "lpc288x.h"
+#include "imp.h"
 #include <helper/binarybuffer.h>
 
 
 /* F_CLK_TIME */
 #define FCT_CLK_DIV_MASK    0x0FFF
 
+struct lpc288x_flash_bank
+{
+       uint32_t working_area;
+       uint32_t working_area_size;
+
+       /* chip id register */
+       uint32_t cidr;
+       const char * target_name;
+       uint32_t cclk;
+
+       uint32_t sector_size_break;
+};
+
 static uint32_t lpc288x_wait_status_busy(struct flash_bank *bank, int timeout);
 static void lpc288x_load_timer(int erase, struct target *target);
 static void lpc288x_set_flash_clk(struct flash_bank *bank);
@@ -171,8 +184,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc288x_flash_bank_command)
 
        if (CMD_ARGC < 6)
        {
-               LOG_WARNING("incomplete flash_bank LPC288x configuration");
-               return ERROR_FLASH_BANK_INVALID;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        lpc288x_info = malloc(sizeof(struct lpc288x_flash_bank));
@@ -472,14 +484,15 @@ static int lpc288x_protect(struct flash_bank *bank, int set, int first, int last
 }
 
 struct flash_driver lpc288x_flash = {
-               .name = "lpc288x",
-               .flash_bank_command = &lpc288x_flash_bank_command,
-               .erase = &lpc288x_erase,
-               .protect = &lpc288x_protect,
-               .write = &lpc288x_write,
-               .probe = &lpc288x_probe,
-               .auto_probe = &lpc288x_probe,
-               .erase_check = &lpc288x_erase_check,
-               .protect_check = &lpc288x_protect_check,
-               .info = &lpc288x_info,
-       };
+       .name = "lpc288x",
+       .flash_bank_command = lpc288x_flash_bank_command,
+       .erase = lpc288x_erase,
+       .protect = lpc288x_protect,
+       .write = lpc288x_write,
+       .read = default_flash_read,
+       .probe = lpc288x_probe,
+       .auto_probe = lpc288x_probe,
+       .erase_check = lpc288x_erase_check,
+       .protect_check = lpc288x_protect_check,
+       .info = lpc288x_info,
+};