inftl.h 1.5 KB

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