xref: /haiku/headers/os/drivers/pcmcia/ftl.h (revision 893988af824e65e49e55f517b157db8386e8002b)
1 /*
2  * ftl.h 1.5 1999/07/20 16:07:58
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  * <dhinds@hyper.stanford.edu>.  Portions created by David A. Hinds
16  * are Copyright (C) 1998 David A. Hinds.  All Rights Reserved.
17  */
18 
19 #ifndef _LINUX_FTL_H
20 #define _LINUX_FTL_H
21 
22 typedef struct erase_unit_header_t {
23     u_char	LinkTargetTuple[5];
24     u_char	DataOrgTuple[10];
25     u_char	NumTransferUnits;
26     u_int	EraseCount;
27     u_short	LogicalEUN;
28     u_char	BlockSize;
29     u_char	EraseUnitSize;
30     u_short	FirstPhysicalEUN;
31     u_short	NumEraseUnits;
32     u_int	FormattedSize;
33     u_int	FirstVMAddress;
34     u_short	NumVMPages;
35     u_char	Flags;
36     u_char	Code;
37     u_int	SerialNumber;
38     u_int	AltEUHOffset;
39     u_int	BAMOffset;
40     u_char	Reserved[12];
41     u_char	EndTuple[2];
42 } erase_unit_header_t;
43 
44 /* Flags in erase_unit_header_t */
45 #define HIDDEN_AREA		0x01
46 #define REVERSE_POLARITY	0x02
47 #define DOUBLE_BAI		0x04
48 
49 /* Definitions for block allocation information */
50 
51 #define BLOCK_FREE(b)		((b) == 0xffffffff)
52 #define BLOCK_DELETED(b)	(((b) == 0) || ((b) == 0xfffffffe))
53 
54 #define BLOCK_TYPE(b)		((b) & 0x7f)
55 #define BLOCK_ADDRESS(b)	((b) & ~0x7f)
56 #define BLOCK_NUMBER(b)		((b) >> 9)
57 #define BLOCK_CONTROL		0x30
58 #define BLOCK_DATA		0x40
59 #define BLOCK_REPLACEMENT	0x60
60 #define BLOCK_BAD		0x70
61 
62 #endif /* _LINUX_FTL_H */
63