inftl.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * inftl.h -- defines to support the Inverse NAND Flash Translation Layer
  4. *
  5. * (C) Copyright 2002, Greg Ungerer ([email protected])
  6. */
  7. #ifndef __MTD_INFTL_H__
  8. #define __MTD_INFTL_H__
  9. #ifndef __KERNEL__
  10. #error This is a kernel header. Perhaps include nftl-user.h instead?
  11. #endif
  12. #include <linux/mtd/blktrans.h>
  13. #include <linux/mtd/mtd.h>
  14. #include <linux/mtd/nftl.h>
  15. #include <mtd/inftl-user.h>
  16. #ifndef INFTL_MAJOR
  17. #define INFTL_MAJOR 96
  18. #endif
  19. #define INFTL_PARTN_BITS 4
  20. #ifdef __KERNEL__
  21. struct INFTLrecord {
  22. struct mtd_blktrans_dev mbd;
  23. __u16 MediaUnit;
  24. __u32 EraseSize;
  25. struct INFTLMediaHeader MediaHdr;
  26. int usecount;
  27. unsigned char heads;
  28. unsigned char sectors;
  29. unsigned short cylinders;
  30. __u16 numvunits;
  31. __u16 firstEUN;
  32. __u16 lastEUN;
  33. __u16 numfreeEUNs;
  34. __u16 LastFreeEUN; /* To speed up finding a free EUN */
  35. int head,sect,cyl;
  36. __u16 *PUtable; /* Physical Unit Table */
  37. __u16 *VUtable; /* Virtual Unit Table */
  38. unsigned int nb_blocks; /* number of physical blocks */
  39. unsigned int nb_boot_blocks; /* number of blocks used by the bios */
  40. struct erase_info instr;
  41. };
  42. int INFTL_mount(struct INFTLrecord *s);
  43. int INFTL_formatblock(struct INFTLrecord *s, int block);
  44. void INFTL_dumptables(struct INFTLrecord *s);
  45. void INFTL_dumpVUchains(struct INFTLrecord *s);
  46. int inftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
  47. size_t *retlen, uint8_t *buf);
  48. int inftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
  49. size_t *retlen, uint8_t *buf);
  50. #endif /* __KERNEL__ */
  51. #endif /* __MTD_INFTL_H__ */