July 2003
The following document refers to Spansion memory products that are now offered by both Advanced
Micro Devices and Fujitsu. Although the document is marked with the name of the company that orig-
inally developed the specification, these products will be offered to customers of both AMD and
Fujitsu.
Continuity of Specifications
There is no change to this document as a result of offering the device as a Spansion product. Any
changes that have been made are the result of normal documentation improvements and are noted
in the document revision summary, where supported. Future routine revisions will occur when appro-
priate, and changes will be noted in a revision summary.
Continuity of Ordering Part Numbers
AMD and Fujitsu continue to support existing part numbers beginning with “Am” and “MBM”. To order
these products, please use only the Ordering Part Numbers listed in this document.
For More Information
Please contact your local AMD or Fujitsu sales office for additional information about Spansion
memory solutions.
Data Management Software (DMS)
for AMD Simultaneous Read/Write
Flash Memory Devices
Technology Background
Publication Number 22274 Revision AAmendment 0 Issue Date November 1, 1998
TECHNOLOGY BACKGROUND
Data Ma nagement Software (DMS)
for AMD Simultaneous Read/Write
Flash Memor y Devices
2 DMS (Data Management Software) Technology Background
Introduction
A wide variety of applications use Flash memory to store embedded control code. Most of
these applications (including cellular phones, modems, and automobile engine control) have
traditionally utilized an EEPROM to store factory, system, and/or user data. Replacing
EEPROM with Flash memory simplifies hardware and software design, reduces board space
requirements, and decreases system cost. Removing EEPROM can also increase system
performance since Flash memory is both faster and more reliable than EEPROM.
Replacing an EEPROM with Flash memory presents a new set of problems, however. First,
comple x task management software will usually be needed, since most Flash devices can only
perform one operation at a time. Secondly, some form of data management software must be
de veloped to manipulate data within the sectors of Flash memory de vices.
Task Manag ers
When storing code and data in a tr aditional flash device, the system cannot read operating
code while data is being written or erased. This can cause unacceptable delays in syst em
operation while w aiting for the wri te to complete. To get around this limitation requires
complex task management soft ware . Thi s software must constantly monitor priorities of
operations, to suspend lo wer priority commands (such as erase and write) and activate higher
priority one s (lik e read syste m code). While this softwa r e solution enables EEPROM
replacement, it is very dif f icult to integra te the task management software with system
software. This software solution also results in signif icant system overhead that impacts
system performance, especially in real time applications.
The Am29DLxxx family of Simultaneous Read/Write Flash provides a unique performance
adva ntage over other flash products. The de vice can read data while it is performing a write or
erase operation. This simulta neous operation eli mina tes the need for complicated task
managers, resulting in simpler software and increased performance. However, data
manageme nt software is still required to manage data storage .
DMS (Data Managem ent Software ) Technolog y Backgro und 3
Data Manag ement Software
AMD pr ovi des Data Management S oftw are ( DMS) to work together with Simultaneous Read-
Write flash devices to make it easy for customers to store code and data in a single flash
device1. DMS takes advantage of the Simult a neous Read/Write devices by storing the system
software (including DMS) in one bank of the flash, and storing data in the other bank.
Partitioning the memory this way allows code to be read out of one ba nk while the system
updates and manages data in the other. Systems that use a traditional flash device must copy
code to RAM to run the s ystem while writing data to the flash memory.
DMS provides all the tools necessary to update data in a fl a sh device. The system software
only has to call one of se ve n functions to utilize DMS. Because the system only needs to
access these few functions, DMS requires as few as 20 hours of integration time. Other
solutions based on traditional flash devices require a minimum of 500 hours.
DMS stores and tr acks data as virtual cells and blocks within the physical boundaries of the
flash bank. Since a byte in flash may not be overwritten, an old occurrence of data is marked
“dirty” when the data is updated. DMS continues to store data until there is not enough
“clean” space in the bank t o write ne w records. At this point, DMS initiates a cleanup process,
saving the latest valid occurrence of each data in another sector, then erasing the old dirty
sector. System software can be greatly simplified because it doesn’t have to perform this
comple x bookkeeping. DMS so ftware even handles variable length parameter storage, which
allow s for data streaming applications like voice recording. With the introduction of DMS,
AMD offers a s imple and complete solution for data storage.
1. DMS als o su pport s non- sim ulta neo us de vic es if c ustomer s on ly wa nt to util i ze its dat a manag emen t ca pabil it ies. In
this case, DMS must execute from an external memory device other than the flash device storing the data, and will
require a user written task manager.
4 DMS (Data Management Software) Technology Background
DMS Overview
DMS is brok en up into four layers: the application layer , the cell layer , the block layer , and the
device layer. These layers interact with each other, maintaining a minimum level of coupling
and a maximum lev el of data abstraction. This simpli f ies the integration process by requiring
the system soft ware to only acces s one layer of DMS, hiding all complex data management
tasks in t he other layers of DMS. (See Figure 1.)
The applica tion inter face layer handles all
communication between the DMS libr ary and
the user’ s application. From an object oriented
perspe ctive this is the public interfac e to t he
DMS object. A vendor or integr ator can
perform all necessary DMS operations by
calling the routines in this layer.
The cell layer provides an interface to DMS
that is similar to an EEPROM. Each cell is
composed of one or more data blocks. The
data blocks are read from the data block layer
and combined to form a cell. To prevent cell
corr uption, a compile time switch is provide d
that assures cell integrity at the e xpense of
restrictions on cell si ze and fr ee s pace. If the c ompile time cell integrity switch is not utilize d,
cell data may be corrupted during a po wer outage. F or example, if po wer was lost during a cell
update operation, the cell may be corrupted. Half of the blocks in the cell may contain new
data, while the other half contain old data. While these blocks all contain va lid data, this
hy brid cell does not contain va lid cell data. (See Figure 2). When re-i nitializ ed (cell inte grity
switch acti ve), DMS detects the corrupted cell and reverts all data in the cell to old cell data.
The data block laye r is responsible for most of the f ile structure functionality of DMS. An ID
number uniquely identifies each data block. Cells consist of data blocks linked by ID
numbers. To increase performance, data block information is sorted upon initialization and
cached in an external memory table. If po wer is terminated while a data block is being written,
the data block will re vert to the previous v ersion of itself. To provide wear leveling of the
de vice , each data block is mo ved to a different location when written.
Figure 1. DMS Block Diagram
DMS (Data Managem ent Software ) Technolog y Backgro und 5
Figu re 2. Corru pt Gl ob a l Cel l Table
The device layer of DMS encapsulates the device interface, providing a generic interface that
does not depend on a specific processor or operating system. This approach allows other
layers to remain unchanged from one environment to another. Platform specific information,
such as memory mapping, is handled by a small sub-set of the device layer, the vendor
specific module. The v endor specific module is unique to each DMS platform.
The functions that reside in the vendor specific module integrate DMS and the hardware
platform. Therefore these are the only functions in DMS not necessarily written in ANSI C.
Each time DMS is ported to a new platform these functions need to be modified. Because this
module provides for rigid hardwar e abstraction, the remainder of DMS is not platform
dependent and thus is written in ANSI C.
The seven functions in the top layer (Application Interface Layer) are the only f unctions that
the system software needs to call. This layer abstracts the DMS into seven functions: Forma t,
Initialize, Write, Cleanup, Read, IsBusy, and Shutdown.
Cell 1 1
Valid
2
Valid
3
Valid
3
Valid
4
Valid
5
Valid
6
Valid
Available
Blocks
(index 0)
Cell 2
FF
Erased
FF
Erased
FF
Erased
FF
Erased
FF
Erased
FF
Erased
Cell 3
7
Valid
8
Valid
9
Valid
11
Valid
12
Valid
13
Valid
14
Valid
15
Valid
16
Valid
17
Valid
Cell 4 18
Valid
19
Valid
20
Valid
21
Valid
22
Valid
Cell 5 23
Valid
24
Valid
25
Valid
26
Valid
27
Valid
10
Valid
New Block
Old Block
Du
p
licate Blocks
6 DMS (Data Management Software) Technology Background
Format
Format allows users to choos e which sectors to manage with DM S. It then divides those
allocated sectors into cells, and in turn partitions those cells into blocks. The Format function
must be called before using DMS the fir st time, since it prepares the flash d evice for use by
DMS. It formats the areas of the flash allocated for use by DMS into the device layout
specified by the user. (See Figure 3.) First, Format erases all sect ors allocated for DMS
management. Then those sectors are partiti oned into the cell lengths according to the cell
structure the user specified. This is done on two levels, cell length and block length. In the
header file, the user specifies the cell length, while the blocks are set at a default length (for
e xample, 512 bytes). The cell is then brok en up into an integer number of these blocks. When
a sector is erased, Format must again be called to reformat tha t sector only.
Figu re 3. Form at ted FFS
Cells and blocks are managed via two different means: Sector Erase header, and Global Cell
Table. The Sector Erase header includes the following:
sector index
number of blocks that fit into the sector
number of cells stored in the device
number of blocks stored in the sector
Every time the global ce ll table is modified, the s ector header is modified accordingly.
DMS (Data Managem ent Software ) Technolog y Backgro und 7
Initialize
Initialize creates the Global Cell Table based upon the cell structure defined by the user to
manage data and track where data is physically located in the flash memory. Initialize should
be called when booting up the de vice. Each cell stored in the flash has a corresponding entry
in the Global Cell Table. Each entry consists of a number of nodes, which contain information
about the blocks that constitute the cell. This information (unique block number, status of
block (valid, invalid), and a pointer to the next block in the cell) is represented below in the
global cell table, where each numbered block is a node. The nodes are added to the correct
inde x ( based on t he Cell Number) in a s orted order based on the data block number withi n the
node.
After all of the cells are defined and all ocated in the flash, an integrity check is performed to
ensure that the Global Cell table only points to valid data.
Write
The Write function writes data to a cell, after format and initialize are comple te. Data is
copied from the user buff er and stored in the flash device. This function will only return to the
calling program a fter the write completes.
System soft wa re must send two paramete rs each time it calls the Write function. The firs t is
the cell number to be written. The second parameter is a pointer to the current location of the
data the user wants written to the de vice. Based upon the cell number sent, DMS will modify
or add an entry in the Global Cell Table. DMS then calls the Cleanup function to ensure there
is enough space av ailable to write the entire cell without a cleanup having to occur during the
write operation. Once this is ensured, DMS traces through the data to be copied, then writes
this data block by block to the flash. If an existing cell is being updated, the status flag for
each node in the Global Cell Table is updated with the ne w location of the data. If a ne w cell is
being added, additional entries and nodes are added to the Global Cell Table.
Cleanup
As mentioned above, the Cleanup function defragments the sectors managed by DMS. First,
it identifie s the sector with the most dirty blocks. Next, all valid blocks in this sector are
moved to another sector in the devi ce. Finally, the entire “dirty” sector is erased and
automatic a lly re-formatted.
8 DMS (Data Management Software) Technology Background
System code may call this function dire ctly if it determine s that it is in an idle s tate and would
like to take care of the Cleanup and garbage collection process. This reduces the possibility of
the user waiting for this cleanup to occur before data is written, causing an unacceptable delay.
Read
The Read operation reads the contents of a specific cell and stores the data in the user buff er.
The cell number is used to index the Global Cell Table. DMS tr aces through that entry in the
Table, node by node, and will output the data into the user buffer block by block, until the
entire cell has been read.
IsBusy
IsBusy checks to see if the flash device i s currently performing an operation. This is
accomplished through the standard method of polling the DQ7 - Data Polling bit.
Shutdown
Shutdown deallocates static memory used by DMS. It should be called when shutting off the
DMS functionality.
TECHNOLOGY BACKGROUND
One AMD Plac e
P.O. Box 34 53
Sunnyvale,
Cali for nia 94088 -3453
(408) 732-2400
(800) 538-8450
TW X: 910-3 39-92 80
TE LEX: 34-63 06
APPLICATIONS HOTLINE &
LITERATURE ORDERING
US A (408) 749 -5703
JAPAN (0 3) 3346 -7600
UK & EUROPE 44-(0)256-811101
TOLL FREE
US A (800) 222 -9323
FRAN C E 0590 -8621
GER M AN Y 01 30-81385 75
ITALY 1678- 77224
http://www.amd.com
22274A