-// NAND Simulator for testing YAFFS
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
+ *
+ * Copyright (C) 2002-2010 Aleph One Ltd.
+ * for Toby Churchill Ltd and Brightstar Engineering
+ *
+ * Created by Charles Manning <charles@aleph1.co.uk>
+ *
+ * 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.
+ */
+
+/*
+ * NAND Simulator for testing YAFFS
+ */
#include <string.h>
SimData *simDevs[N_RAM_SIM_DEVS];
-static SimData *DevToSim(yaffs_Device *dev)
+static SimData *DevToSim(struct yaffs_dev *dev)
{
- ynandif_Geometry *geom = (ynandif_Geometry *)(dev->driverContext);
+ ynandif_Geometry *geom = (ynandif_Geometry *)(dev->driver_context);
SimData * sim = (SimData*)(geom->privateData);
return sim;
}
-static int yramsim_initialise(yaffs_Device *dev)
+static int yramsim_initialise(struct yaffs_dev *dev)
{
SimData *sim = DevToSim(dev);
Block **blockList = sim->blockList;
}
-static int yramsim_deinitialise(yaffs_Device *dev)
+static int yramsim_deinitialise(struct yaffs_dev *dev)
{
return 1;
}
-static int yramsim_rd_chunk (yaffs_Device *dev, unsigned pageId,
+static int yramsim_rd_chunk (struct yaffs_dev *dev, unsigned pageId,
unsigned char *data, unsigned dataLength,
unsigned char *spare, unsigned spareLength,
int *eccStatus)
return 1;
}
-static int yramsim_wr_chunk (yaffs_Device *dev,unsigned pageId,
+static int yramsim_wr_chunk (struct yaffs_dev *dev,unsigned pageId,
const unsigned char *data, unsigned dataLength,
const unsigned char *spare, unsigned spareLength)
{
}
-static int yramsim_erase(yaffs_Device *dev,unsigned blockId)
+static int yramsim_erase(struct yaffs_dev *dev,unsigned blockId)
{
SimData *sim = DevToSim(dev);
return yramsim_erase_internal(sim,blockId,0);
}
-static int yramsim_check_block_ok(yaffs_Device *dev,unsigned blockId)
+static int yramsim_check_block_ok(struct yaffs_dev *dev,unsigned blockId)
{
SimData *sim = DevToSim(dev);
Block **blockList = sim->blockList;
return blockList[blockId]->blockOk ? 1 : 0;
}
-static int yramsim_mark_block_bad(yaffs_Device *dev,unsigned blockId)
+static int yramsim_mark_block_bad(struct yaffs_dev *dev,unsigned blockId)
{
SimData *sim = DevToSim(dev);
Block **blockList = sim->blockList;
}
-static SimData *yramsim_alloc_sim_data(__u32 devId, __u32 nBlocks)
+static SimData *yramsim_alloc_sim_data(u32 devId, u32 nBlocks)
{
int ok = 1;
Block **blockList;
SimData *sim;
Block *b;
- __u32 i;
+ u32 i;
if(devId >= N_RAM_SIM_DEVS)
return NULL;
}
-struct yaffs_DeviceStruct *yramsim_CreateRamSim(const YCHAR *name,
- __u32 devId, __u32 nBlocks,
- __u32 startBlock, __u32 endBlock)
+struct yaffs_dev *yramsim_CreateRamSim(const YCHAR *name,
+ u32 devId, u32 nBlocks,
+ u32 start_block, u32 end_block)
{
SimData *sim;
ynandif_Geometry *g;
return NULL;
}
- if(startBlock >= sim->nBlocks)
- startBlock = 0;
- if(endBlock == 0 || endBlock >= sim->nBlocks)
- endBlock = sim->nBlocks - 1;
+ if(start_block >= sim->nBlocks)
+ start_block = 0;
+ if(end_block == 0 || end_block >= sim->nBlocks)
+ end_block = sim->nBlocks - 1;
memset(g,0,sizeof(ynandif_Geometry));
- g->startBlock = startBlock;
- g->endBlock = endBlock;
+ g->start_block = start_block;
+ g->end_block = end_block;
g->dataSize = DATA_SIZE;
g->spareSize= SPARE_SIZE;
g->pagesPerBlock = PAGES_PER_BLOCK;
g->hasECC = 1;
- g->inbandTags = 0;
+ g->inband_tags = 0;
g->useYaffs2 = 1;
g->initialise = yramsim_initialise;
g->deinitialise = yramsim_deinitialise;