yaffs Fixed some problems with direct/timothy_tests/quick_tests
[yaffs2.git] / direct / yaffs_nandif.h
1 /*
2  * YAFFS: Yet another Flash File System . A NAND-flash specific file system. 
3  *
4  * Copyright (C) 2002-2010 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
16
17 #ifndef __YNANDIF_H__
18 #define __YNANDIF_H__
19
20 #include "yaffs_guts.h"
21
22
23 typedef struct {
24         unsigned start_block;
25         unsigned end_block;
26         unsigned dataSize;
27         unsigned spareSize;
28         unsigned pagesPerBlock;
29         unsigned hasECC;
30         unsigned inband_tags;
31         unsigned useYaffs2;
32
33         int (*initialise)(struct yaffs_dev *dev);
34         int (*deinitialise)(struct yaffs_dev *dev);
35
36         int (*readChunk) (struct yaffs_dev *dev,
37                                           unsigned pageId, 
38                                           unsigned char *data, unsigned dataLength,
39                                           unsigned char *spare, 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, unsigned dataLength,
46                                           const unsigned char *spare, unsigned spareLength);
47
48         int (*eraseBlock)(struct yaffs_dev *dev, unsigned blockId);
49
50         int (*checkBlockOk)(struct yaffs_dev *dev, unsigned blockId);
51         int (*markBlockBad)(struct yaffs_dev *dev, unsigned blockId);
52
53         void *privateData;
54
55 } ynandif_Geometry;
56
57 struct yaffs_dev * 
58         yaffs_add_dev_from_geometry(const YCHAR *name,
59                                         const ynandif_Geometry *geometry);
60
61 #if 0
62
63 int ynandif_WriteChunkWithTagsToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const struct yaffs_ext_tags *tags);
64 int ynandif_ReadChunkWithTagsFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaffs_ext_tags *tags);
65 int ynandif_EraseBlockInNAND(struct yaffs_dev *dev, int blockNumber);
66 int ynandif_InitialiseNAND(struct yaffs_dev *dev);
67 int ynandif_MarkNANDBlockBad(struct yaffs_dev *dev,int blockNumber);
68 int ynandif_QueryNANDBlock(struct yaffs_dev *dev, int block_no, enum yaffs_block_state *state, u32 *seq_number);
69 int ynandif_GetGeometry(struct yaffs_dev *dev, ynandif_Geometry *geometry);
70 #endif
71
72
73 #endif