#include <unistd.h>
#include <time.h>
-#define YNORSIM_FNAME "ynorsimdata"
+#define YNORSIM_FNAME "emfile-nor"
/* Set YNORSIM_BIT_CHANGES to a a value from 1..30 to
*simulate bit flipping as the programming happens.
*/
//#define YNORSIM_BIT_CHANGES 15
-#define YNORSIM_BIT_CHANGES 1
+#define YNORSIM_BIT_CHANGES 2
#if 0
/* Simulate 32MB of flash in 256k byte blocks.
static __u32 word[YNORSIM_DEV_SIZE_U32];
extern int random_seed;
+extern int simulate_power_failure;
static void NorError(void)
{
static int remaining_ops;
static int nops_so_far;
+int ops_multiplier = 500;
+
static void ynorsim_MaybePowerFail(void)
{
remaining_ops--;
- if(remaining_ops < 1){
+ if(simulate_power_failure &&
+ remaining_ops < 1){
printf("Simulated power failure after %d operations\n",nops_so_far);
ynorsim_PowerFail();
}
return;
srand(random_seed);
remaining_ops = 1000000000;
- remaining_ops = (rand() % 10000) * 3000 * YNORSIM_BIT_CHANGES;
+ remaining_ops = (rand() % 10000) * ops_multiplier * YNORSIM_BIT_CHANGES;
ynorsim_RestoreImage();
}