From 4313b64bbe27024ab4238bbd18e4b6624a1c8bca Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Sun, 22 Mar 2015 22:18:17 -0700 Subject: [PATCH] Add a flash_done target method. --- src/gdb_main.c | 2 +- src/include/target.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gdb_main.c b/src/gdb_main.c index 750dfe2..961a1d9 100644 --- a/src/gdb_main.c +++ b/src/gdb_main.c @@ -424,7 +424,7 @@ handle_v_packet(char *packet, int plen) } else if (!strcmp(packet, "vFlashDone")) { /* Commit flash operations. */ - gdb_putpacketz("OK"); + gdb_putpacketz(target_flash_done(cur_target) ? "EFF" : "OK"); flash_mode = 0; } else { diff --git a/src/include/target.h b/src/include/target.h index 34f26eb..92703b7 100644 --- a/src/include/target.h +++ b/src/include/target.h @@ -107,6 +107,9 @@ target *target_attach(target *t, target_destroy_callback destroy_cb); #define target_flash_write(target, dest, src, len) \ (target)->flash_write((target), (dest), (src), (len)) +#define target_flash_done(target) \ + ((target)->flash_done ? (target)->flash_done(target) : 0) + /* Host I/O */ #define target_hostio_reply(target, recode, errcode) \ (target)->hostio_reply((target), (retcode), (errcode)) @@ -159,6 +162,7 @@ struct target_s { int (*flash_erase)(target *t, uint32_t addr, size_t len); int (*flash_write)(target *t, uint32_t dest, const uint8_t *src, size_t len); + int (*flash_done)(target *t); /* Host I/O support */ void (*hostio_reply)(target *t, int32_t retcode, uint32_t errcode);