Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Thomas Gleixner | e4f0648 | 2005-11-07 11:15:37 +0000 | [diff] [blame^] | 2 | * $Id: nftl-user.h,v 1.2 2005/11/07 11:14:56 gleixner Exp $ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
Thomas Gleixner | e4f0648 | 2005-11-07 11:15:37 +0000 | [diff] [blame^] | 4 | * Parts of NFTL headers shared with userspace |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __MTD_NFTL_USER_H__ |
| 9 | #define __MTD_NFTL_USER_H__ |
| 10 | |
| 11 | /* Block Control Information */ |
| 12 | |
| 13 | struct nftl_bci { |
| 14 | unsigned char ECCSig[6]; |
| 15 | uint8_t Status; |
| 16 | uint8_t Status1; |
| 17 | }__attribute__((packed)); |
| 18 | |
| 19 | /* Unit Control Information */ |
| 20 | |
| 21 | struct nftl_uci0 { |
| 22 | uint16_t VirtUnitNum; |
| 23 | uint16_t ReplUnitNum; |
| 24 | uint16_t SpareVirtUnitNum; |
| 25 | uint16_t SpareReplUnitNum; |
| 26 | } __attribute__((packed)); |
| 27 | |
| 28 | struct nftl_uci1 { |
| 29 | uint32_t WearInfo; |
| 30 | uint16_t EraseMark; |
| 31 | uint16_t EraseMark1; |
| 32 | } __attribute__((packed)); |
| 33 | |
| 34 | struct nftl_uci2 { |
| 35 | uint16_t FoldMark; |
| 36 | uint16_t FoldMark1; |
| 37 | uint32_t unused; |
| 38 | } __attribute__((packed)); |
| 39 | |
| 40 | union nftl_uci { |
| 41 | struct nftl_uci0 a; |
| 42 | struct nftl_uci1 b; |
| 43 | struct nftl_uci2 c; |
| 44 | }; |
| 45 | |
| 46 | struct nftl_oob { |
| 47 | struct nftl_bci b; |
| 48 | union nftl_uci u; |
| 49 | }; |
| 50 | |
| 51 | /* NFTL Media Header */ |
| 52 | |
| 53 | struct NFTLMediaHeader { |
| 54 | char DataOrgID[6]; |
| 55 | uint16_t NumEraseUnits; |
| 56 | uint16_t FirstPhysicalEUN; |
| 57 | uint32_t FormattedSize; |
| 58 | unsigned char UnitSizeFactor; |
| 59 | } __attribute__((packed)); |
| 60 | |
| 61 | #define MAX_ERASE_ZONES (8192 - 512) |
| 62 | |
| 63 | #define ERASE_MARK 0x3c69 |
| 64 | #define SECTOR_FREE 0xff |
| 65 | #define SECTOR_USED 0x55 |
| 66 | #define SECTOR_IGNORE 0x11 |
| 67 | #define SECTOR_DELETED 0x00 |
| 68 | |
| 69 | #define FOLD_MARK_IN_PROGRESS 0x5555 |
| 70 | |
| 71 | #define ZONE_GOOD 0xff |
| 72 | #define ZONE_BAD_ORIGINAL 0 |
| 73 | #define ZONE_BAD_MARKED 7 |
| 74 | |
| 75 | |
| 76 | #endif /* __MTD_NFTL_USER_H__ */ |