projects
/
yaffs
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix unmounting flag
[yaffs/.git]
/
yaffs_ramem.c
diff --git
a/yaffs_ramem.c
b/yaffs_ramem.c
index 7143dffee677df1df58b0245f6099dff9a0b564b..1a82ae5de13fee3190d32964411f139b0135cabf 100644
(file)
--- a/
yaffs_ramem.c
+++ b/
yaffs_ramem.c
@@
-15,7
+15,13
@@
//yaffs_ramem.c
// Since this creates the RAM block at start up it is pretty useless for testing the scanner.
//yaffs_ramem.c
// Since this creates the RAM block at start up it is pretty useless for testing the scanner.
-#ifdef YAFFS_RAM_ENABLED
+const char *yaffs_ramem_c_version = "$Id: yaffs_ramem.c,v 1.6 2002-11-26 01:15:37 charles Exp $";
+
+#ifndef __KERNEL__
+#define CONFIG_YAFFS_RAM_ENABLED
+#endif
+
+#ifdef CONFIG_YAFFS_RAM_ENABLED
#include "yportenv.h"
#include "yportenv.h"
@@
-32,7
+38,7
@@
#define FILE_SIZE_IN_BLOCKS (FILE_SIZE_IN_MEG * BLOCKS_PER_MEG)
#define FILE_SIZE_IN_BYTES (FILE_SIZE_IN_BLOCKS * BLOCK_SIZE)
#define FILE_SIZE_IN_BLOCKS (FILE_SIZE_IN_MEG * BLOCKS_PER_MEG)
#define FILE_SIZE_IN_BYTES (FILE_SIZE_IN_BLOCKS * BLOCK_SIZE)
-#define T(x) YPRINTF(x)
+
#define DEFAULT_SIZE_IN_MB 2
#define DEFAULT_SIZE_IN_MB 2
@@
-64,6
+70,15
@@
static nandemul_Device ned;
int sizeInMB = DEFAULT_SIZE_IN_MB;
int sizeInMB = DEFAULT_SIZE_IN_MB;
+static void nandemul_yield(int n)
+{
+#ifdef __KERNEL__
+ if(n > 0) schedule_timeout(n);
+#endif
+
+}
+
+
static void nandemul_ReallyEraseBlock(int blockNumber)
{
int i;
static void nandemul_ReallyEraseBlock(int blockNumber)
{
int i;
@@
-77,6
+92,7
@@
static void nandemul_ReallyEraseBlock(int blockNumber)
theBlock->page[i].count[1] = 0;
theBlock->page[i].count[2] = 0;
theBlock->page[i].empty = 1;
theBlock->page[i].count[1] = 0;
theBlock->page[i].count[2] = 0;
theBlock->page[i].empty = 1;
+ nandemul_yield(2);
}
}
}
}
@@
-150,7
+166,7
@@
static int CheckInit(void)
}
YFREE(ned.block);
}
YFREE(ned.block);
- T(("Allocation failed, could only allocate %dMB of %dMB requested.\n",
+ T(
YAFFS_TRACE_ALWAYS,
("Allocation failed, could only allocate %dMB of %dMB requested.\n",
nAllocated/64,sizeInMB));
return 0;
}
nAllocated/64,sizeInMB));
return 0;
}
@@
-204,6
+220,11
@@
int nandemul_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data
}
ned.block[blk]->page[pg].count[2]++;
}
}
ned.block[blk]->page[pg].count[2]++;
}
+
+ if(spare || data)
+ {
+ nandemul_yield(1);
+ }
return YAFFS_OK;
}
return YAFFS_OK;
}
@@
-268,11
+289,11
@@
int nandemul_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
if(blockNumber < 0 || blockNumber >= ned.nBlocks)
{
if(blockNumber < 0 || blockNumber >= ned.nBlocks)
{
- T(("Attempt to erase non-existant block %d\n",blockNumber));
+ T(
YAFFS_TRACE_ALWAYS,
("Attempt to erase non-existant block %d\n",blockNumber));
}
else if(ned.block[blockNumber]->damaged)
{
}
else if(ned.block[blockNumber]->damaged)
{
- T(("Attempt to erase damaged block %d\n",blockNumber));
+ T(
YAFFS_TRACE_ALWAYS,
("Attempt to erase damaged block %d\n",blockNumber));
}
else
{
}
else
{