2 * inftl.h -- defines to support the Inverse NAND Flash Translation Layer
4 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
6 * $Id: inftl.h,v 1.3 2003/05/23 11:35:34 dwmw2 Exp $
9 #ifndef __MTD_INFTL_H__
10 #define __MTD_INFTL_H__
12 #include <linux/mtd/blktrans.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/nftl.h>
16 #define OSAK_VERSION 0x5120
17 #define PERCENTUSED 98
19 #define SECTORSIZE 512
22 #define INFTL_MAJOR 93 /* FIXME */
24 #define INFTL_PARTN_BITS 4
26 /* Block Control Information */
32 } __attribute__((packed));
34 struct inftl_unithead1 {
41 } __attribute__((packed));
43 struct inftl_unithead2 {
50 } __attribute__((packed));
52 struct inftl_unittail {
56 } __attribute__((packed));
59 struct inftl_unithead1 a;
60 struct inftl_unithead2 b;
61 struct inftl_unittail c;
70 /* INFTL Media Header */
72 struct INFTLPartition {
80 } __attribute__((packed));
82 struct INFTLMediaHeader {
84 __u32 NoOfBootImageBlocks;
85 __u32 NoOfBinaryPartitions;
86 __u32 NoOfBDTLPartitions;
87 __u32 BlockMultiplierBits;
91 struct INFTLPartition Partitions[4];
92 } __attribute__((packed));
94 /* Partition flag types */
95 #define INFTL_BINARY 0x20000000
96 #define INFTL_BDTL 0x40000000
97 #define INFTL_LAST 0x80000000
103 struct mtd_blktrans_dev mbd;
104 __u16 MediaUnit, SpareMediaUnit;
106 struct INFTLMediaHeader MediaHdr;
109 unsigned char sectors;
110 unsigned short cylinders;
115 __u16 LastFreeEUN; /* To speed up finding a free EUN */
117 __u16 *PUtable; /* Physical Unit Table */
118 __u16 *VUtable; /* Virtual Unit Table */
119 unsigned int nb_blocks; /* number of physical blocks */
120 unsigned int nb_boot_blocks; /* number of blocks used by the bios */
121 struct erase_info instr;
124 int INFTL_mount(struct INFTLrecord *s);
125 int INFTL_formatblock(struct INFTLrecord *s, int block);
127 #endif /* __KERNEL__ */
129 #endif /* __MTD_INFTL_H__ */