Introduce FLASHPROG_FLAG_NON_VOLATILE_WRSR
Add a new flag to our flash context that tells us if we should use
volatile or non-volatile status-register writes by default. Use it
in the write-protection API. The logic to disable block protection
automatically stays as is for now, until we have established tools
to manually control the protection.
Change-Id: Ie9a41b6404991075e2bf76bcffbd4e9887c62c79
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/193
diff --git a/libflashprog.c b/libflashprog.c
index 2b389d1..5256657 100644
--- a/libflashprog.c
+++ b/libflashprog.c
@@ -309,6 +309,7 @@
case FLASHPROG_FLAG_FORCE_BOARDMISMATCH: flashctx->flags.force_boardmismatch = value; break;
case FLASHPROG_FLAG_VERIFY_AFTER_WRITE: flashctx->flags.verify_after_write = value; break;
case FLASHPROG_FLAG_VERIFY_WHOLE_CHIP: flashctx->flags.verify_whole_chip = value; break;
+ case FLASHPROG_FLAG_NON_VOLATILE_WRSR: flashctx->flags.non_volatile_wrsr = value; break;
}
}
@@ -326,6 +327,7 @@
case FLASHPROG_FLAG_FORCE_BOARDMISMATCH: return flashctx->flags.force_boardmismatch;
case FLASHPROG_FLAG_VERIFY_AFTER_WRITE: return flashctx->flags.verify_after_write;
case FLASHPROG_FLAG_VERIFY_WHOLE_CHIP: return flashctx->flags.verify_whole_chip;
+ case FLASHPROG_FLAG_NON_VOLATILE_WRSR: return flashctx->flags.non_volatile_wrsr;
default: return false;
}
}