Add align/erased_val params per flash device

The previous c/rust ffi functions were hardcoding the values of align
and erased_val before each run through static globals. This adds new sim
flash functions that get the align/erased_val from the sim flash device
that is being run on, allowing that later multiple flash devices can
each use its own params.

Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/sim/mcuboot-sys/csupport/run.c b/sim/mcuboot-sys/csupport/run.c
index cb219fa..7e24692 100644
--- a/sim/mcuboot-sys/csupport/run.c
+++ b/sim/mcuboot-sys/csupport/run.c
@@ -34,6 +34,8 @@
         uint32_t size);
 extern int sim_flash_write(uint8_t flash_id, uint32_t offset, const uint8_t *src,
         uint32_t size);
+extern uint8_t sim_flash_align(uint8_t flash_id);
+extern uint8_t sim_flash_erased_val(uint8_t flash_id);
 
 static jmp_buf boot_jmpbuf;
 int flash_counter;
@@ -205,18 +207,14 @@
 #endif
 }
 
-uint8_t sim_flash_align = 1;
 uint8_t flash_area_align(const struct flash_area *area)
 {
-    (void)area;
-    return sim_flash_align;
+    return sim_flash_align(area->fa_device_id);
 }
 
-uint8_t sim_flash_erased_val = 0xff;
 uint8_t flash_area_erased_val(const struct flash_area *area)
 {
-    (void)area;
-    return sim_flash_erased_val;
+    return sim_flash_erased_val(area->fa_device_id);
 }
 
 struct area {
@@ -337,7 +335,7 @@
     }
 
     for (i = 0, u8dst = (uint8_t *)dst; i < len; i++) {
-        if (u8dst[i] != sim_flash_erased_val) {
+        if (u8dst[i] != sim_flash_erased_val(area->fa_device_id)) {
             return 0;
         }
     }