Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Derived from (and probably identical to):
0003  * ftl.h 1.7 1999/10/25 20:23:17
0004  *
0005  * The contents of this file are subject to the Mozilla Public License
0006  * Version 1.1 (the "License"); you may not use this file except in
0007  * compliance with the License. You may obtain a copy of the License
0008  * at http://www.mozilla.org/MPL/
0009  *
0010  * Software distributed under the License is distributed on an "AS IS"
0011  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
0012  * the License for the specific language governing rights and
0013  * limitations under the License.
0014  *
0015  * The initial developer of the original code is David A. Hinds
0016  * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
0017  * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
0018  *
0019  * Alternatively, the contents of this file may be used under the
0020  * terms of the GNU General Public License version 2 (the "GPL"), in
0021  * which case the provisions of the GPL are applicable instead of the
0022  * above.  If you wish to allow the use of your version of this file
0023  * only under the terms of the GPL and not to allow others to use
0024  * your version of this file under the MPL, indicate your decision by
0025  * deleting the provisions above and replace them with the notice and
0026  * other provisions required by the GPL.  If you do not delete the
0027  * provisions above, a recipient may use your version of this file
0028  * under either the MPL or the GPL.
0029  */
0030 
0031 #ifndef _LINUX_FTL_H
0032 #define _LINUX_FTL_H
0033 
0034 typedef struct erase_unit_header_t {
0035     uint8_t LinkTargetTuple[5];
0036     uint8_t DataOrgTuple[10];
0037     uint8_t NumTransferUnits;
0038     uint32_t    EraseCount;
0039     uint16_t    LogicalEUN;
0040     uint8_t BlockSize;
0041     uint8_t EraseUnitSize;
0042     uint16_t    FirstPhysicalEUN;
0043     uint16_t    NumEraseUnits;
0044     uint32_t    FormattedSize;
0045     uint32_t    FirstVMAddress;
0046     uint16_t    NumVMPages;
0047     uint8_t Flags;
0048     uint8_t Code;
0049     uint32_t    SerialNumber;
0050     uint32_t    AltEUHOffset;
0051     uint32_t    BAMOffset;
0052     uint8_t Reserved[12];
0053     uint8_t EndTuple[2];
0054 } erase_unit_header_t;
0055 
0056 /* Flags in erase_unit_header_t */
0057 #define HIDDEN_AREA     0x01
0058 #define REVERSE_POLARITY    0x02
0059 #define DOUBLE_BAI      0x04
0060 
0061 /* Definitions for block allocation information */
0062 
0063 #define BLOCK_FREE(b)       ((b) == 0xffffffff)
0064 #define BLOCK_DELETED(b)    (((b) == 0) || ((b) == 0xfffffffe))
0065 
0066 #define BLOCK_TYPE(b)       ((b) & 0x7f)
0067 #define BLOCK_ADDRESS(b)    ((b) & ~0x7f)
0068 #define BLOCK_NUMBER(b)     ((b) >> 9)
0069 #define BLOCK_CONTROL       0x30
0070 #define BLOCK_DATA      0x40
0071 #define BLOCK_REPLACEMENT   0x60
0072 #define BLOCK_BAD       0x70
0073 
0074 #endif /* _LINUX_FTL_H */