projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean up yaffs_FindNiceObject to be thread safe and simpler. Fix code that does a...
[yaffs2.git]
/
direct
/
ynorsim.c
diff --git
a/direct/ynorsim.c
b/direct/ynorsim.c
index 569e0ded1e9e40746de4da50ee2d551e6da2074e..0c691a6a58c4418ee377ed4e8d76f16dbce535a0 100644
(file)
--- a/
direct/ynorsim.c
+++ b/
direct/ynorsim.c
@@
-10,7
+10,7
@@
#include <unistd.h>
#include <time.h>
#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.
/* Set YNORSIM_BIT_CHANGES to a a value from 1..30 to
*simulate bit flipping as the programming happens.
@@
-19,17
+19,28
@@
*/
//#define YNORSIM_BIT_CHANGES 15
*/
//#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.
* This stuff is x32.
*/
#define YNORSIM_BLOCK_SIZE_U32 (256*1024/4)
#define YNORSIM_DEV_SIZE_U32 (32*1024 * 1024/4)
/* Simulate 32MB of flash in 256k byte blocks.
* This stuff is x32.
*/
#define YNORSIM_BLOCK_SIZE_U32 (256*1024/4)
#define YNORSIM_DEV_SIZE_U32 (32*1024 * 1024/4)
+#else
+/* Simulate 8MB of flash in 256k byte blocks.
+ * This stuff is x32.
+ */
+
+#define YNORSIM_BLOCK_SIZE_U32 (256*1024/4)
+#define YNORSIM_DEV_SIZE_U32 (8*1024 * 1024/4)
+#endif
static __u32 word[YNORSIM_DEV_SIZE_U32];
static __u32 word[YNORSIM_DEV_SIZE_U32];
+extern int random_seed;
+extern int simulate_power_failure;
static void NorError(void)
{
static void NorError(void)
{
@@
-63,6
+74,8
@@
static int initialised = 0;
static int remaining_ops;
static int nops_so_far;
static int remaining_ops;
static int nops_so_far;
+int ops_multiplier = 500;
+
static void ynorsim_MaybePowerFail(void)
{
static void ynorsim_MaybePowerFail(void)
{
@@
-70,7
+83,8
@@
static void ynorsim_MaybePowerFail(void)
remaining_ops--;
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();
}
printf("Simulated power failure after %d operations\n",nops_so_far);
ynorsim_PowerFail();
}
@@
-80,9
+94,9
@@
static void ynorsim_Ready(void)
{
if(initialised)
return;
{
if(initialised)
return;
- srand(
time(NULL)
);
+ srand(
random_seed
);
remaining_ops = 1000000000;
remaining_ops = 1000000000;
- remaining_ops = (rand() % 10000) *
10000
;
+ remaining_ops = (rand() % 10000) *
ops_multiplier * YNORSIM_BIT_CHANGES
;
ynorsim_RestoreImage();
}
ynorsim_RestoreImage();
}