APPLICATION
NOTE
AP-684
Understanding the Flash
Translation Layer
(FTL) Specification
Order Number: 297816-002
December 1998
Information in this document is provided in connection with Intel products. No license, express or implied, by estoppel or
otherwise, to any intellectual property rights is granted by this document. Except as provided in Intels Terms and Conditions of
Sale for such products, Intel assumes no liability whatsoever, and Intel disclaims any express or implied warranty, relating to
sale and/or use of Intel products including liability or warranties relating to fitness for a particular purpose, merchantability, or
infringement of any patent, copyright or other intellectual property right. Intel products are not intended for use in medical, life
saving, or life sustaining applications.
Intel may make changes to specifications and product descriptions at any time, without notice.
Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.
Copies of documents which have an ordering number and are referenced in this document, or other Intel literature, may be
obtained from:
Intel Corporation
P.O. Box 5937
Denver, CO 80217-9808
or call 1-800-858-4725
or visit Intels Website at http://www.intel.com
COPYRIGHT INTEL CORPORATION 1997, 1998
*Third-party brands and names are the property of their respective owners.
CG-041493
E AP-684
3
CONTENTS
PAGE
1.0 INTRODUCTION ...................................................................................................................................... 5
2.0 OVERVIEW OF FLASH TRANSLATION LAYER .................................................................................... 5
2.1 Virtual Block Device .............................................................................................................................. 5
2.2 Flash Technology.................................................................................................................................. 5
3.0 ERASE UNITS.......................................................................................................................................... 7
3.1 Erase Unit Header................................................................................................................................. 7
3.1.1 Flags .............................................................................................................................................. 7
3.2 Block Allocation Information.................................................................................................................. 9
3.3 Block Allocation Map............................................................................................................................. 9
4.0 VERIFY FTL PARTITION....................................................................................................................... 11
5.0 VIRTUAL BLOCK MAPVIRTUAL-TO-LOGICAL MAPPING................................................................ 12
5.1 First Virtual Mapped Address .............................................................................................................. 12
6.0 VIRTUAL PAGE MAPLOCATING THE VIRTUAL BLOCK MAP PAGES............................................ 13
6.1 Page Map Handling............................................................................................................................. 13
6.2 Replacement Pages............................................................................................................................ 13
6.2.1 Replacement Page Map............................................................................................................... 13
7.0 LOGICAL TO PHYSICAL MAPPING..................................................................................................... 14
8.0 READ ..................................................................................................................................................... 14
9.0 WRITE.................................................................................................................................................... 14
10.0 UNIT RECOVERY/RECLAIM............................................................................................................... 14
APPENDIX A: Glossary .............................................................................................................................. 15
APPENDIX B: Structures............................................................................................................................ 17
APPENDIX C: Availablility.......................................................................................................................... 19
APPENDIX D: Additional Information........................................................................................................ 20
AP-684 E
4
REVISION HISTORY
Number Description
-001 Original Version
-002 Document formerly referred to as a technical paper; assigned application note number.
Legal disclaimer updated.
E AP-684
5
1.0 INTRODUCTION
This document defines the interfaces and operation
behavior of the Flash Translation Layer, or FTL, as it
is more commonly known. For more information about
the FTL specification, contact PCMCIA for the full
FTL specification contained in the Media Storage
Formats Specification of the PCMCIA PC Card
Standard (see Appendix D).
2.0 OVERVIEW OF FLASH
TRANSLATION LAYER
Flash memory is valued in many applications as a
storage media due to its fast access speeds, low-power,
nonvolatile, and rugged operation. FTL is the driver
that works in conjunction with an existing operating
system (or, in some embedded applications, as the
operating system) to make linear flash memory appear
to the system like a disk drive. It does that be doing a
number of things. First, it creates virtual small blocks
of data, or sectors, out of flashs large erase blocks.
Next, it manages data on the flash so that it appears to
be write in place when in fact it is being stored in
different spots in the flash. Finally, FTL manages the
flash so there are clean/erased places to store data. How
FTL does these is described in detail in the following
sections.
2.1 Virtual Block Device
DOS block device drivers perform input and output in
structured pieces called blocks. Block devices include
all disk drives and other mass-storage devices on the
computer. FTL emulates a block device. The flash
media appears as a contiguous array of storage blocks
numbered from zero to one less than the total number
of blocks. FTL is a translation layer between the native
DOS BPB/FAT file system and flash. FTL remaps the
data to the physical location at which the data is to be
written. This allows the DOS file system to treat flash
like any other block storage device and remain
ignorant of flash device characteristics. FTL appears to
simply take the data from the file system and write it at
the specified location (sector). In reality, FTL places
the data at a free/erased location on the flash media and
notes the real location of the data. It also invalidates
the block that previously contained the blocks data (if
any). So when the file system asks for the data that was
written out, FTL finds and reads back the proper data.
2.2 Flash Technology
Flash media allows only two states: erased and non-
erased. In the erase state, a byte may be either all ones
(0xFF) or all zeroes (0x00) depending on the flash
device. A given bit of data may only be written when
the media is in an erase state. After it is written to, the
bit is considered dirty and unusable. In order to return
the bit to its erase state, a significantly larger block of
flash called an Erase Zone (also known as an erase
block) must be erased. Flash technology does not allow
the toggling of individual bits or bytes from a non-
erased state back to an erased state. FTL shields the file
system from these details and remaps the data passed to
it by writing to unused data areas in the flash media.
This presents the illusion to DOS that a data block is
simply overwritten when it is modifiedwhile in
reality, the new data has been written somewhere else
on the media. FTL also takes care of reclaiming the
discarded data blocks for reuse.
Although there are many types and manufacturers of
flash memory, the most common type is known as
NOR flash. NOR flash, such as that available from
Intel Corporation, operates in the following fashion:
Erased state is 1, programmed state is 0, a 0 cannot be
changed back to a 1 except by an erase, and an erase
must occur on a full erase block. Throughout the rest of
this document, the examples and bit states will be
based on the way NOR flash works.
Figure 2 shows some specific examples of flash
commands and the resulting content changes. In the
first three program sequences, a bit can be toggled
from a 1 to a 0 or left as a 1. However, a 0
may not be set to a 1. The only time a bit can be
restored to a 1 from a 0 is during an erase process,
as shown at the bottom of the figure.
AP-684 E
6
MAP
R/W
Block 1
Sec 12
R/W 2
Sec 6
R/W 3
Sec 19
R/W 4
Sec 65
R/W 5
free
R/W 6
Sec 0
R/W 7
deleted
R/W 21
Sec 14
MAP
etc.
FTL MAP
(VPM, VBM,
and BAM)
Example:
DOS requests
sector 14-FTL
map points to
R/W Block 21
for the data
DOS Sector Number Physical Location in Flash FTL MAP
7681
Figure 1. FTL Sector Relocation
1111 1111B (FFH)
0111 1111B (7FH)
0011 1111B (3FH)
0011 1111B (3FH)
Program
0111 1111B
Program
0011 1111B
Program
1111 1111B
Erase Block
0111 1111B (7FH)
0011 1111B (3FH)
0011 1111B (3FH)
1111 1111B (FFH)
Flash Contents Flash Command Resulting Contents
7816_02
Figure 2. Example of Flash Commands/Content Changes
E AP-684
7
Erase Unit
Erase Unit
Erase Unit
Erase Unit
Read/Write Block
Read/Write Block
Read/Write Block
Read/Write Block
Read/Write Block
Read/Write Block
7816_03
Figure 3. Erase Unit Divided into Read/Write Blocks. Each Read/Write Block Is the Same Size as a
Virtual Block (Sector) Used by the Software Layers above FTL.
3.0 ERASE UNITS
FTL divides the flash media into one or more Erase
Units of equal size. The size of an Erase Unit is
determined during FTL formatting but is also dependent
on the size of the devices flash Erase Block as well as
component interleaving. An Erase Unit consists of one
or more contiguous Erase Zones. An Erase Zone is the
smallest contiguous area that can be erased in a single
erase operation. If two 8-bit devices are interleaved to
form a 16-bit memory, the Erase Unit will consist of an
Erase Zone (or Erase Block) on each of the devices. For
this example, 1 Erase Unit = 2 Erase Zone (one from
each chip in the chip pair). An erase zone is the same as
an Erase Block of a flash chip (64-Kbyte typical for
current Intel