* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
- *
*/
/*
YAFFS_TRACE_SCAN |
YAFFS_TRACE_GC | YAFFS_TRACE_GC_DETAIL |
- YAFFS_TRACE_WRITE | YAFFS_TRACE_ERASE |
+ YAFFS_TRACE_ERASE |
YAFFS_TRACE_TRACING |
YAFFS_TRACE_ALLOCATE |
YAFFS_TRACE_CHECKPOINT |
YAFFS_TRACE_BAD_BLOCKS |
-// (~0) |
0;
+static int yaffsfs_lastError;
void yaffsfs_SetError(int err)
{
//Do whatever to set error
- errno = err;
+ yaffsfs_lastError = err;
+}
+
+
+int yaffsfs_GetLastError(void)
+{
+ return yaffsfs_lastError;
}
void yaffsfs_Lock(void)
return 0;
}
+
+static int yaffs_kill_alloc = 0;
+static size_t total_malloced = 0;
+static size_t malloc_limit = 0 & 6000000;
+
+void *yaffs_malloc(size_t size)
+{
+ void * this;
+ if(yaffs_kill_alloc)
+ return NULL;
+ if(malloc_limit && malloc_limit <(total_malloced + size) )
+ return NULL;
+
+ this = malloc(size);
+ if(this)
+ total_malloced += size;
+ return this;
+}
+
+void yaffs_free(void *ptr)
+{
+ free(ptr);
+}
+
void yaffsfs_LocalInitialisation(void)
{
// Define locking semaphore.
{ "/flash/boot", &bootDev},
{ "/flash/flash", &flashDev},
{ "/ram2k", &ram2kDev},
+ { "/flash/bigblock", &flashDev},
{(void *)0,(void *)0} /* Null entry to terminate list */
#endif
};
// Set up devices
// /ram
memset(&ramDev,0,sizeof(ramDev));
- ramDev.nDataBytesPerChunk = 512;
+ ramDev.totalBytesPerChunk = 512;
ramDev.nChunksPerBlock = 32;
ramDev.nReservedBlocks = 2; // Set this smaller for RAM
ramDev.startBlock = 0; // Can use block 0
// /boot
memset(&bootDev,0,sizeof(bootDev));
- bootDev.nDataBytesPerChunk = 512;
+ bootDev.totalBytesPerChunk = 512;
bootDev.nChunksPerBlock = 32;
bootDev.nReservedBlocks = 5;
bootDev.startBlock = 0; // Can use block 0
// 2kpage/64chunk per block/128MB device
memset(&flashDev,0,sizeof(flashDev));
- flashDev.nDataBytesPerChunk = 2048;
+ flashDev.totalBytesPerChunk = 512;
flashDev.nChunksPerBlock = 64;
flashDev.nReservedBlocks = 5;
- flashDev.nCheckpointReservedBlocks = 5;
+ flashDev.inbandTags = 1;
//flashDev.checkpointStartBlock = 1;
//flashDev.checkpointEndBlock = 20;
flashDev.startBlock = 0;
// 2kpage/64chunk per block/128MB device
memset(&ram2kDev,0,sizeof(ram2kDev));
- ram2kDev.nDataBytesPerChunk = nandemul2k_GetBytesPerChunk();
+ ram2kDev.totalBytesPerChunk = nandemul2k_GetBytesPerChunk();
ram2kDev.nChunksPerBlock = nandemul2k_GetChunksPerBlock();
ram2kDev.nReservedBlocks = 5;
ram2kDev.startBlock = 0; // First block after /boot
void SetCheckpointReservedBlocks(int n)
{
- flashDev.nCheckpointReservedBlocks = n;
+// flashDev.nCheckpointReservedBlocks = n;
}