nftl-user.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Parts of NFTL headers shared with userspace
  3. *
  4. */
  5. #ifndef __MTD_NFTL_USER_H__
  6. #define __MTD_NFTL_USER_H__
  7. /* Block Control Information */
  8. struct nftl_bci {
  9. unsigned char ECCSig[6];
  10. uint8_t Status;
  11. uint8_t Status1;
  12. }__attribute__((packed));
  13. /* Unit Control Information */
  14. struct nftl_uci0 {
  15. uint16_t VirtUnitNum;
  16. uint16_t ReplUnitNum;
  17. uint16_t SpareVirtUnitNum;
  18. uint16_t SpareReplUnitNum;
  19. } __attribute__((packed));
  20. struct nftl_uci1 {
  21. uint32_t WearInfo;
  22. uint16_t EraseMark;
  23. uint16_t EraseMark1;
  24. } __attribute__((packed));
  25. struct nftl_uci2 {
  26. uint16_t FoldMark;
  27. uint16_t FoldMark1;
  28. uint32_t unused;
  29. } __attribute__((packed));
  30. union nftl_uci {
  31. struct nftl_uci0 a;
  32. struct nftl_uci1 b;
  33. struct nftl_uci2 c;
  34. };
  35. struct nftl_oob {
  36. struct nftl_bci b;
  37. union nftl_uci u;
  38. };
  39. /* NFTL Media Header */
  40. struct NFTLMediaHeader {
  41. char DataOrgID[6];
  42. uint16_t NumEraseUnits;
  43. uint16_t FirstPhysicalEUN;
  44. uint32_t FormattedSize;
  45. unsigned char UnitSizeFactor;
  46. } __attribute__((packed));
  47. #define MAX_ERASE_ZONES (8192 - 512)
  48. #define ERASE_MARK 0x3c69
  49. #define SECTOR_FREE 0xff
  50. #define SECTOR_USED 0x55
  51. #define SECTOR_IGNORE 0x11
  52. #define SECTOR_DELETED 0x00
  53. #define FOLD_MARK_IN_PROGRESS 0x5555
  54. #define ZONE_GOOD 0xff
  55. #define ZONE_BAD_ORIGINAL 0
  56. #define ZONE_BAD_MARKED 7
  57. #endif /* __MTD_NFTL_USER_H__ */