]> git.sur5r.net Git - openocd/blobdiff - src/target/mips32.c
flash/nor: Add erased_value to drivers and pass it to targets
[openocd] / src / target / mips32.c
index 8c77986496fc4554586837fa3be23ad3fe4f1533..27caebee19d7c2b5c9514aa9b4aa0d11c04924c2 100644 (file)
@@ -771,9 +771,9 @@ int mips32_checksum_memory(struct target *target, uint32_t address,
        return retval;
 }
 
-/** Checks whether a memory region is zeroed. */
+/** Checks whether a memory region is erased. */
 int mips32_blank_check_memory(struct target *target,
-               uint32_t address, uint32_t count, uint32_t *blank)
+               uint32_t address, uint32_t count, uint32_t *blank, uint8_t erased_value)
 {
        struct working_area *erase_check_algorithm;
        struct reg_param reg_params[3];
@@ -789,6 +789,12 @@ int mips32_blank_check_memory(struct target *target,
                0x7000003F              /* sdbbp */
        };
 
+       if (erased_value != 0xff) {
+               LOG_ERROR("Erase value 0x%02" PRIx8 " not yet supported for MIPS32",
+                       erased_value);
+               return ERROR_FAIL;
+       }
+
        /* make sure we have a working area */
        if (target_alloc_working_area(target, sizeof(erase_check_code), &erase_check_algorithm) != ERROR_OK)
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
@@ -810,7 +816,7 @@ int mips32_blank_check_memory(struct target *target,
        buf_set_u32(reg_params[1].value, 0, 32, count);
 
        init_reg_param(&reg_params[2], "r6", 32, PARAM_IN_OUT);
-       buf_set_u32(reg_params[2].value, 0, 32, 0xff);
+       buf_set_u32(reg_params[2].value, 0, 32, erased_value);
 
        int retval = target_run_algorithm(target, 0, NULL, 3, reg_params,
                        erase_check_algorithm->address,