1/*
2 * ftl.h 1.8 2000/06/12 21:55:40
3 *
4 * The contents of this file are subject to the Mozilla Public License
5 * Version 1.1 (the "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy of the License
7 * at http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS"
10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11 * the License for the specific language governing rights and
12 * limitations under the License.
13 *
14 * The initial developer of the original code is David A. Hinds
15 * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
16 * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
17 *
18 * Alternatively, the contents of this file may be used under the
19 * terms of the GNU General Public License version 2 (the "GPL"), in which
20 * case the provisions of the GPL are applicable instead of the
21 * above.  If you wish to allow the use of your version of this file
22 * only under the terms of the GPL and not to allow others to use
23 * your version of this file under the MPL, indicate your decision by
24 * deleting the provisions above and replace them with the notice and
25 * other provisions required by the GPL.  If you do not delete the
26 * provisions above, a recipient may use your version of this file
27 * under either the MPL or the GPL.
28 */
29
30#ifndef _LINUX_FTL_H
31#define _LINUX_FTL_H
32
33typedef struct erase_unit_header_t {
34    u_char	LinkTargetTuple[5];
35    u_char	DataOrgTuple[10];
36    u_char	NumTransferUnits;
37    u_int	EraseCount;
38    u_short	LogicalEUN;
39    u_char	BlockSize;
40    u_char	EraseUnitSize;
41    u_short	FirstPhysicalEUN;
42    u_short	NumEraseUnits;
43    u_int	FormattedSize;
44    u_int	FirstVMAddress;
45    u_short	NumVMPages;
46    u_char	Flags;
47    u_char	Code;
48    u_int	SerialNumber;
49    u_int	AltEUHOffset;
50    u_int	BAMOffset;
51    u_char	Reserved[12];
52    u_char	EndTuple[2];
53} erase_unit_header_t;
54
55/* Flags in erase_unit_header_t */
56#define HIDDEN_AREA		0x01
57#define REVERSE_POLARITY	0x02
58#define DOUBLE_BAI		0x04
59
60/* Definitions for block allocation information */
61
62#define BLOCK_FREE(b)		((b) == 0xffffffff)
63#define BLOCK_DELETED(b)	(((b) == 0) || ((b) == 0xfffffffe))
64
65#define BLOCK_TYPE(b)		((b) & 0x7f)
66#define BLOCK_ADDRESS(b)	((b) & ~0x7f)
67#define BLOCK_NUMBER(b)		((b) >> 9)
68#define BLOCK_CONTROL		0x30
69#define BLOCK_DATA		0x40
70#define BLOCK_REPLACEMENT	0x60
71#define BLOCK_BAD		0x70
72
73#endif /* _LINUX_FTL_H */
74