return target_call_timer_callbacks_check_time(0);
}
-int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area)
+int target_alloc_working_area_try(struct target *target, uint32_t size, struct working_area **area)
{
struct working_area *c = target->working_areas;
struct working_area *new_wa = NULL;
if (free_size < size)
{
- LOG_WARNING("not enough working area available(requested %u, free %u)",
- (unsigned)(size), (unsigned)(free_size));
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
return ERROR_OK;
}
+int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area)
+{
+ int retval;
+
+ retval = target_alloc_working_area_try(target, size, area);
+ if (retval == ERROR_TARGET_RESOURCE_NOT_AVAILABLE)
+ {
+ LOG_WARNING("not enough working area available(requested %u)", (unsigned)(size));
+ }
+ return retval;
+
+}
+
static int target_free_working_area_restore(struct target *target, struct working_area *area, int restore)
{
if (area->free)
*/
int target_alloc_working_area(struct target *target,
uint32_t size, struct working_area **area);
+/* Same as target_alloc_working_area, except that no error is logged
+ * when ERROR_TARGET_RESOURCE_NOT_AVAILABLE is returned.
+ *
+ * This allows the calling code to *try* to allocate target memory
+ * and have a fallback to another behavior(slower?).
+ */
+int target_alloc_working_area_try(struct target *target,
+ uint32_t size, struct working_area **area);
int target_free_working_area(struct target *target, struct working_area *area);
void target_free_all_working_areas(struct target *target);