STM32L: Added flash driver and target
[fw/openocd] / src / flash / nand / arm_io.c
index cc565dcbc023592214c2f61d7d686878e4012157..7a6ceb39916145b3f1ed8c78fd21ec60a6ebe798 100644 (file)
 #include "config.h"
 #endif
 
+#include "core.h"
 #include "arm_io.h"
-#include <target/armv4_5.h>
+#include <helper/binarybuffer.h>
+#include <target/arm.h>
 #include <target/algorithm.h>
 
+
 /**
  * Copies code to a working area.  This will allocate room for the code plus the
  * additional amount requested if the working area pointer is null.
@@ -40,7 +43,7 @@
  * @param area Pointer to a pointer to a working area to copy code to
  * @return Success or failure of the operation
  */
-int arm_code_to_working_area(struct target *target,
+static int arm_code_to_working_area(struct target *target,
                const uint32_t *code, unsigned code_size,
                unsigned additional, struct working_area **area)
 {
@@ -97,7 +100,7 @@ int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size)
        struct arm              *armv4_5 = target->arch_info;
        struct reg_param        reg_params[3];
        uint32_t                target_buf;
-       uint32_t                exit = 0;
+       uint32_t                exit_var = 0;
        int                     retval;
 
        /* Inputs:
@@ -150,11 +153,11 @@ int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size)
 
        /* armv4 must exit using a hardware breakpoint */
        if (armv4_5->is_armv4)
-               exit = nand->copy_area->address + sizeof(code) - 4;
+               exit_var = nand->copy_area->address + sizeof(code) - 4;
 
        /* use alg to write data from work area to NAND chip */
        retval = target_run_algorithm(target, 0, NULL, 3, reg_params,
-                       nand->copy_area->address, exit, 1000, &algo);
+                       nand->copy_area->address, exit_var, 1000, &algo);
        if (retval != ERROR_OK)
                LOG_ERROR("error executing hosted NAND write");
 
@@ -181,7 +184,7 @@ int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size)
        struct arm *armv4_5 = target->arch_info;
        struct reg_param reg_params[3];
        uint32_t target_buf;
-       uint32_t exit = 0;
+       uint32_t exit_var = 0;
        int retval;
 
        /* Inputs:
@@ -226,11 +229,11 @@ int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size)
 
        /* armv4 must exit using a hardware breakpoint */
        if (armv4_5->is_armv4)
-               exit = nand->copy_area->address + sizeof(code) - 4;
+               exit_var = nand->copy_area->address + sizeof(code) - 4;
 
        /* use alg to write data from NAND chip to work area */
        retval = target_run_algorithm(target, 0, NULL, 3, reg_params,
-                       nand->copy_area->address, exit, 1000, &algo);
+                       nand->copy_area->address, exit_var, 1000, &algo);
        if (retval != ERROR_OK)
                LOG_ERROR("error executing hosted NAND read");