Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 1 | /* |
| 2 | * YAFFS: Yet another Flash File System . A NAND-flash specific file system. |
| 3 | * |
| 4 | * Copyright (C) 2002-2011 Aleph One Ltd. |
| 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 Lesser General Public License version 2.1 as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. |
| 14 | */ |
| 15 | |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 16 | #ifndef __YNANDIF_H__ |
| 17 | #define __YNANDIF_H__ |
| 18 | |
| 19 | #include "yaffs_guts.h" |
| 20 | |
| 21 | struct ynandif_Geometry { |
| 22 | unsigned start_block; |
| 23 | unsigned end_block; |
| 24 | unsigned dataSize; |
| 25 | unsigned spareSize; |
| 26 | unsigned pagesPerBlock; |
| 27 | unsigned hasECC; |
| 28 | unsigned inband_tags; |
| 29 | unsigned useYaffs2; |
| 30 | |
| 31 | int (*initialise)(struct yaffs_dev *dev); |
| 32 | int (*deinitialise)(struct yaffs_dev *dev); |
| 33 | |
| 34 | int (*readChunk) (struct yaffs_dev *dev, |
| 35 | unsigned pageId, |
| 36 | unsigned char *data, |
| 37 | unsigned dataLength, |
| 38 | unsigned char *spare, |
| 39 | unsigned spareLength, |
| 40 | int *eccStatus); |
| 41 | /* ECC status is set to 0 for OK, 1 for fixed, -1 for unfixed. */ |
| 42 | |
| 43 | int (*writeChunk)(struct yaffs_dev *dev, |
| 44 | unsigned pageId, |
| 45 | const unsigned char *data, |
| 46 | unsigned dataLength, |
| 47 | const unsigned char *spare, |
| 48 | unsigned spareLength); |
| 49 | |
| 50 | int (*eraseBlock)(struct yaffs_dev *dev, unsigned blockId); |
| 51 | |
| 52 | int (*checkBlockOk)(struct yaffs_dev *dev, unsigned blockId); |
| 53 | int (*markBlockBad)(struct yaffs_dev *dev, unsigned blockId); |
| 54 | |
| 55 | void *privateData; |
| 56 | |
| 57 | }; |
| 58 | |
| 59 | struct yaffs_dev * |
| 60 | yaffs_add_dev_from_geometry(const YCHAR *name, |
| 61 | const struct ynandif_Geometry *geometry); |
| 62 | |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 63 | #endif |