X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Fynorsim.c;h=0c691a6a58c4418ee377ed4e8d76f16dbce535a0;hp=6936a9c874e2c9bffb4d995e8ab4d8e870c8fda6;hb=2334d4199580ecca3059056b773213fae4cbe01d;hpb=85530132e169794d9e7e9c1de1396a12bc650383 diff --git a/direct/ynorsim.c b/direct/ynorsim.c index 6936a9c..0c691a6 100644 --- a/direct/ynorsim.c +++ b/direct/ynorsim.c @@ -10,7 +10,7 @@ #include #include -#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. @@ -19,7 +19,7 @@ */ //#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. @@ -40,6 +40,7 @@ static __u32 word[YNORSIM_DEV_SIZE_U32]; extern int random_seed; +extern int simulate_power_failure; static void NorError(void) { @@ -73,6 +74,8 @@ static int initialised = 0; static int remaining_ops; static int nops_so_far; +int ops_multiplier = 500; + static void ynorsim_MaybePowerFail(void) { @@ -80,7 +83,8 @@ 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(); } @@ -92,7 +96,7 @@ static void ynorsim_Ready(void) 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(); }