1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#ifndef __MTD_NFTL_H__
21#define __MTD_NFTL_H__
22
23#include <linux/mtd/mtd.h>
24#include <linux/mtd/blktrans.h>
25
26#include <mtd/nftl-user.h>
27
28
29#define BLOCK_NIL 0xffff
30#define BLOCK_FREE 0xfffe
31#define BLOCK_NOTEXPLORED 0xfffd
32#define BLOCK_RESERVED 0xfffc
33
34struct NFTLrecord {
35 struct mtd_blktrans_dev mbd;
36 __u16 MediaUnit, SpareMediaUnit;
37 __u32 EraseSize;
38 struct NFTLMediaHeader MediaHdr;
39 int usecount;
40 unsigned char heads;
41 unsigned char sectors;
42 unsigned short cylinders;
43 __u16 numvunits;
44 __u16 lastEUN;
45 __u16 numfreeEUNs;
46 __u16 LastFreeEUN;
47 int head,sect,cyl;
48 __u16 *EUNtable;
49 __u16 *ReplUnitTable;
50 unsigned int nb_blocks;
51 unsigned int nb_boot_blocks;
52 struct erase_info instr;
53 struct nand_ecclayout oobinfo;
54};
55
56int NFTL_mount(struct NFTLrecord *s);
57int NFTL_formatblock(struct NFTLrecord *s, int block);
58
59int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
60 size_t *retlen, uint8_t *buf);
61int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
62 size_t *retlen, uint8_t *buf);
63
64#ifndef NFTL_MAJOR
65#define NFTL_MAJOR 93
66#endif
67
68#define MAX_NFTLS 16
69#define MAX_SECTORS_PER_UNIT 64
70#define NFTL_PARTN_BITS 4
71
72#endif
73