Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *  inftl.h -- defines to support the Inverse NAND Flash Translation Layer
0004  *
0005  *  (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
0006  */
0007 
0008 #ifndef __MTD_INFTL_H__
0009 #define __MTD_INFTL_H__
0010 
0011 #ifndef __KERNEL__
0012 #error This is a kernel header. Perhaps include nftl-user.h instead?
0013 #endif
0014 
0015 #include <linux/mtd/blktrans.h>
0016 #include <linux/mtd/mtd.h>
0017 #include <linux/mtd/nftl.h>
0018 
0019 #include <mtd/inftl-user.h>
0020 
0021 #ifndef INFTL_MAJOR
0022 #define INFTL_MAJOR 96
0023 #endif
0024 #define INFTL_PARTN_BITS 4
0025 
0026 #ifdef __KERNEL__
0027 
0028 struct INFTLrecord {
0029     struct mtd_blktrans_dev mbd;
0030     __u16 MediaUnit;
0031     __u32 EraseSize;
0032     struct INFTLMediaHeader MediaHdr;
0033     int usecount;
0034     unsigned char heads;
0035     unsigned char sectors;
0036     unsigned short cylinders;
0037     __u16 numvunits;
0038     __u16 firstEUN;
0039     __u16 lastEUN;
0040     __u16 numfreeEUNs;
0041     __u16 LastFreeEUN;      /* To speed up finding a free EUN */
0042     int head,sect,cyl;
0043     __u16 *PUtable;         /* Physical Unit Table */
0044     __u16 *VUtable;         /* Virtual Unit Table */
0045     unsigned int nb_blocks;     /* number of physical blocks */
0046     unsigned int nb_boot_blocks;    /* number of blocks used by the bios */
0047     struct erase_info instr;
0048 };
0049 
0050 int INFTL_mount(struct INFTLrecord *s);
0051 int INFTL_formatblock(struct INFTLrecord *s, int block);
0052 
0053 void INFTL_dumptables(struct INFTLrecord *s);
0054 void INFTL_dumpVUchains(struct INFTLrecord *s);
0055 
0056 int inftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
0057            size_t *retlen, uint8_t *buf);
0058 int inftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
0059             size_t *retlen, uint8_t *buf);
0060 
0061 #endif /* __KERNEL__ */
0062 
0063 #endif /* __MTD_INFTL_H__ */