Hardware description
as this preserves the CIS block and misses out bad blocks. For devices of less than 16 megabytes, you
can only use physical addressing.
5.15.1 Using the SmartMedia macros
Accessing the SmartMedia card
To use the RC200 PSL macros to access SmartMedia, you need to:
1. Call
the
RC200SmartMediaRun()
macro in parallel with the other SmartMedia macros
and in parallel to
RC200CPLDRun()
.
2. Enable the CPLD using
RC200CPLDEnable()
.
3. Call
RC200SmartMediaInit()
in parallel with
RC200SmartMediaRun()
, and before
any of the other SmartMedia macros.
For example:
par
{
RC200CPLDRun();
RC200SmartMediaRun();
seq
{
RC200CPLDEnable();
RC200SmartMediaInit();
}
}
Reading from or writing to SmartMedia
You are advised not to mix logical and physical addressing when accessing the SmartMedia card.
To perform a read or write using logical addressing you need to:
1. Call
RC200SmartMediaCheckLogicalFormat()
.
If this macro returns 1 to indicate failure you need to perform a logical format on the card
using the Celoxica FTU2 program.
2. Set the address, using
RC200SmartMediaSetLogicalAddress()
.
3. Call
RC200SmartMediaRead()
or
RC200SmartMediaWrite()
for each byte of data.
For the last byte of data, set the
LastData
compile-time constant to 1.
4. Call
RC200SmartMediaOperationEnd()
to complete the read or write process after all
the data has been read or written.
To perform a read or write using physical addressing you need to:
1. Set the address, using
RC200SmartMediaSetAddress()
.
2. Call
RC200SmartMediaRead()
or
RC200SmartMediaWrite()
for each byte of data.
For the last byte of data, set the
LastData
compile-time constant to 1.
3. Call
RC200SmartMediaOperationEnd()
to complete the read or write process after all
the data has been read or written.
www.celoxica.com
Page 58