-int target_free_working_area(struct target_s *target, struct working_area *area);
-int target_free_working_area_restore(struct target_s *target,
- struct working_area *area, int restore);
-void target_free_all_working_areas(struct target_s *target);
-void target_free_all_working_areas_restore(struct target_s *target, int restore);
-
-extern target_t *all_targets;
-
-extern struct target_event_callback *target_event_callbacks;
-extern struct target_timer_callback *target_timer_callbacks;
-
-uint32_t target_buffer_get_u32(target_t *target, const uint8_t *buffer);
-uint16_t target_buffer_get_u16(target_t *target, const uint8_t *buffer);
-uint8_t target_buffer_get_u8 (target_t *target, const uint8_t *buffer);
-void target_buffer_set_u32(target_t *target, uint8_t *buffer, uint32_t value);
-void target_buffer_set_u16(target_t *target, uint8_t *buffer, uint16_t value);
-void target_buffer_set_u8 (target_t *target, uint8_t *buffer, uint8_t value);
-
-int target_read_u32(struct target_s *target, uint32_t address, uint32_t *value);
-int target_read_u16(struct target_s *target, uint32_t address, uint16_t *value);
-int target_read_u8(struct target_s *target, uint32_t address, uint8_t *value);
-int target_write_u32(struct target_s *target, uint32_t address, uint32_t value);
-int target_write_u16(struct target_s *target, uint32_t address, uint16_t value);
-int target_write_u8(struct target_s *target, uint32_t address, uint8_t value);
+/* 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 behaviour(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);
+uint32_t target_get_working_area_avail(struct target *target);
+
+extern struct target *all_targets;
+
+uint32_t target_buffer_get_u32(struct target *target, const uint8_t *buffer);
+uint32_t target_buffer_get_u24(struct target *target, const uint8_t *buffer);
+uint16_t target_buffer_get_u16(struct target *target, const uint8_t *buffer);
+void target_buffer_set_u32(struct target *target, uint8_t *buffer, uint32_t value);
+void target_buffer_set_u24(struct target *target, uint8_t *buffer, uint32_t value);
+void target_buffer_set_u16(struct target *target, uint8_t *buffer, uint16_t value);
+
+void target_buffer_get_u32_array(struct target *target, const uint8_t *buffer, uint32_t count, uint32_t *dstbuf);
+void target_buffer_get_u16_array(struct target *target, const uint8_t *buffer, uint32_t count, uint16_t *dstbuf);
+void target_buffer_set_u32_array(struct target *target, uint8_t *buffer, uint32_t count, uint32_t *srcbuf);
+void target_buffer_set_u16_array(struct target *target, uint8_t *buffer, uint32_t count, uint16_t *srcbuf);
+
+int target_read_u32(struct target *target, uint32_t address, uint32_t *value);
+int target_read_u16(struct target *target, uint32_t address, uint16_t *value);
+int target_read_u8(struct target *target, uint32_t address, uint8_t *value);
+int target_write_u32(struct target *target, uint32_t address, uint32_t value);
+int target_write_u16(struct target *target, uint32_t address, uint16_t value);
+int target_write_u8(struct target *target, uint32_t address, uint8_t value);