* themselves. We want flash drivers and infrastructure to
* be able to rely on (non-invalidated) cached state.
*
+ * For now we require that algorithms provided by OpenOCD are
+ * used only by code which properly maintains that cached state.
+ * state
+ *
* REVISIT do the same for NAND ; maybe other flash flavors too...
*/
- nor_resume(target);
+ if (!target->running_alg)
+ nor_resume(target);
return retval;
}
goto done;
}
+ target->running_alg = true;
retval = target->type->run_algorithm(target,
num_mem_params, mem_params,
num_reg_params, reg_param,
entry_point, exit_point, timeout_ms, arch_info);
+ target->running_alg = false;
done:
return retval;
*/
bool examined;
+ /** true iff the target is currently running a downloaded
+ * "algorithm" instetad of arbitrary user code. OpenOCD code
+ * invoking algorithms is trusted to maintain correctness of
+ * any cached state (e.g. for flash status), which arbitrary
+ * code will have no reason to know about.
+ */
+ bool running_alg;
+
struct target_event_action *event_action;
int reset_halt; /* attempt resetting the CPU into the halted mode? */