#include "malloc.h"
#endif
-unsigned yaffs_traceMask = 0xFFFFFFFF;
+unsigned yaffs_traceMask = 0x0; /* Disable logging */
static int yaffs_errno = 0;
void yaffsfs_SetError(int err)
// NB Though /boot and /flash occupy the same physical device they
// are still disticnt "yaffs_Devices. You may think of these as "partitions"
// using non-overlapping areas in the same device.
-//
+//
#include "yaffs_ramdisk.h"
#include "yaffs_flashif.h"
yaffs_Device *flashDev = calloc(1, sizeof(yaffs_Device));
yaffsfs_config[0].dev = flashDev;
+ /* store the mtd device for later use */
+ flashDev->genericDevice = mtd;
+
// Stuff to configure YAFFS
// Stuff to initialise anything special (eg lock semaphore).
yaffsfs_LocalInitialisation();
-
+
// Set up devices
/* XXX U-BOOT XXX */
ramDev.nChunksPerBlock = 32;
ramDev.nReservedBlocks = 2; // Set this smaller for RAM
ramDev.startBlock = 1; // Can't use block 0
- ramDev.endBlock = 127; // Last block in 2MB.
+ ramDev.endBlock = 127; // Last block in 2MB.
ramDev.useNANDECC = 1;
ramDev.nShortOpCaches = 0; // Disable caching on this device.
ramDev.genericDevice = (void *) 0; // Used to identify the device in fstat.
bootDev.nChunksPerBlock = 32;
bootDev.nReservedBlocks = 5;
bootDev.startBlock = 1; // Can't use block 0
- bootDev.endBlock = 127; // Last block in 2MB.
+ bootDev.endBlock = 127; // Last block in 2MB.
bootDev.useNANDECC = 0; // use YAFFS's ECC
bootDev.nShortOpCaches = 10; // Use caches
bootDev.genericDevice = (void *) 1; // Used to identify the device in fstat.
flashDev->nChunksPerBlock = YAFFS_CHUNKS_PER_BLOCK;
flashDev->nDataBytesPerChunk = YAFFS_BYTES_PER_CHUNK;
}
-
+
/* ... and common functions */
flashDev->eraseBlockInNAND = nandmtd_EraseBlockInNAND;
flashDev->initialiseNAND = nandmtd_InitialiseNAND;
yaffs_initialise(yaffsfs_config);
-
+
return 0;
}
printf("Error opening file: %d\n", outh);
return;
}
-
+
memset(buffer,bval,100);
-
+
do{
i = sizeOfFile;
if(i > 100) i = 100;
sizeOfFile -= i;
-
+
yaffs_write(outh,buffer,i);
-
+
} while (sizeOfFile > 0);
-
-
+
+
yaffs_close(outh);
}
{
printf("%02x ",b);
i++;
- if(i > 32)
+ if(i > 32)
{
printf("\n");
i = 0;;
{
int h;
struct yaffs_stat s;
-
+
checkMount();
yaffs_stat(fn,&s);
printf("File not found\n");
return;
}
-
+
yaffs_read(h,addr,(int)s.st_size);
printf("\t[DONE]\n");
{
printf("Error opening file: %d\n", outh);
}
-
+
yaffs_write(outh,addr,size);
-
+
yaffs_close(outh);
}
checkMount();
int retval = yaffs_mkdir(dir, 0);
-
+
if ( retval < 0)
printf("yaffs_mkdir returning error: %d\n", retval);
}
checkMount();
int retval = yaffs_rmdir(dir);
-
+
if ( retval < 0)
printf("yaffs_rmdir returning error: %d\n", retval);
}
checkMount();
int retval = yaffs_unlink(path);
-
+
if ( retval < 0)
printf("yaffs_unlink returning error: %d\n", retval);
}
checkMount();
int retval = yaffs_rename(newPath, oldPath);
-
+
if ( retval < 0)
printf("yaffs_unlink returning error: %d\n", retval);
}