Mercurial > yaffs-ecoscentric-gpl
annotate yaffs_mtdif.c @ 394:bedc7047de18
Add more test scripts to automate running tests.
| author | Charles Manning <cdhmanning@gmail.com> |
|---|---|
| date | Thu, 25 Mar 2010 13:48:41 +1300 |
| parents | 05cd3ca9ab0a |
| children | b5309c9b6d7f |
| rev | line source |
|---|---|
| 7 | 1 /* |
| 168 | 2 * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. |
| 7 | 3 * |
| 168 | 4 * Copyright (C) 2002-2007 Aleph One Ltd. |
| 7 | 5 * for Toby Churchill Ltd and Brightstar Engineering |
| 6 * | |
| 7 * Created by Charles Manning <charles@aleph1.co.uk> | |
| 8 * | |
| 9 * This program is free software; you can redistribute it and/or modify | |
| 10 * it under the terms of the GNU General Public License version 2 as | |
| 11 * published by the Free Software Foundation. | |
| 12 */ | |
| 13 | |
| 76 | 14 const char *yaffs_mtdif_c_version = |
| 360 | 15 "$Id: yaffs_mtdif.c,v 1.25 2010-02-19 01:06:31 charles Exp $"; |
| 76 | 16 |
|
45
1f2f55618d63
If kernel/config.h is included in yportenv.h, then yportenv.h must be
marty <marty>
parents:
43
diff
changeset
|
17 #include "yportenv.h" |
| 7 | 18 |
| 19 | |
| 20 #include "yaffs_mtdif.h" | |
| 21 | |
| 22 #include "linux/mtd/mtd.h" | |
| 23 #include "linux/types.h" | |
| 24 #include "linux/time.h" | |
| 25 #include "linux/mtd/nand.h" | |
| 26 | |
|
356
7ee0cc4ba753
Rationalise context and parameter handling
charles <charles>
parents:
271
diff
changeset
|
27 #include "yaffs_linux.h" |
|
7ee0cc4ba753
Rationalise context and parameter handling
charles <charles>
parents:
271
diff
changeset
|
28 |
|
271
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
29 int nandmtd_EraseBlockInNAND(yaffs_Device *dev, int blockNumber) |
| 7 | 30 { |
|
356
7ee0cc4ba753
Rationalise context and parameter handling
charles <charles>
parents:
271
diff
changeset
|
31 struct mtd_info *mtd = yaffs_DeviceToContext(dev)->mtd; |
| 76 | 32 __u32 addr = |
|
358
7c3694ed38db
Fix mtdif erasing to work properly for inband tags
charles <charles>
parents:
356
diff
changeset
|
33 ((loff_t) blockNumber) * dev->param.totalBytesPerChunk |
|
356
7ee0cc4ba753
Rationalise context and parameter handling
charles <charles>
parents:
271
diff
changeset
|
34 * dev->param.nChunksPerBlock; |
| 7 | 35 struct erase_info ei; |
|
356
7ee0cc4ba753
Rationalise context and parameter handling
charles <charles>
parents:
271
diff
changeset
|
36 |
| 76 | 37 int retval = 0; |
| 38 | |
| 7 | 39 ei.mtd = mtd; |
| 40 ei.addr = addr; | |
|
358
7c3694ed38db
Fix mtdif erasing to work properly for inband tags
charles <charles>
parents:
356
diff
changeset
|
41 ei.len = dev->param.totalBytesPerChunk * dev->param.nChunksPerBlock; |
| 7 | 42 ei.time = 1000; |
| 43 ei.retries = 2; | |
| 44 ei.callback = NULL; | |
| 76 | 45 ei.priv = (u_long) dev; |
| 46 | |
| 47 retval = mtd->erase(mtd, &ei); | |
| 7 | 48 |
| 76 | 49 if (retval == 0) |
| 50 return YAFFS_OK; | |
| 51 else | |
| 52 return YAFFS_FAIL; | |
| 7 | 53 } |
| 54 | |
|
271
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
55 int nandmtd_InitialiseNAND(yaffs_Device *dev) |
| 7 | 56 { |
| 57 return YAFFS_OK; | |
| 58 } | |
| 59 |
