Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


MultiMediaCard emulation

[Top]


General

While the H4 development board now provides support for MultiMediaCard development and testing, the emulator can be set up so that it behaves as if a MultiMediaCard (MMC) is present. This can be used to do some basic tests to see how an application behaves when reading data from the card and writing data to the card, or when the card is removed and/or swapped. Specifically, it allows you to check that data stored on a card is not lost or corrupted during MMC drive events and that card locking and password notification work correctly.

It is possible to emulate a user opening and closing the MMC drive door, replacing and removing the MMC card.

MMC emulation does not involve access to any kind of MultiMediaCard hardware interface. Instead, the memory area of each emulated card is represented by a file, a .bin type file in the Windows system temp directory.

Emulated MultiMediaCard drives are defined by the emulator-specific (Wins) versions of estart.exe and estart.txt. By default, the generic Symbian emulator is set up so that an MMC drive 1 is mapped to drive letter X:. While the emulator is running, key stroke combinations using F5 and F4 will trigger MMC drive events, and emulate MMC card swapping/removing.

This emulates a single stack containing two separate cards, the first in slot 0, and the second in slot 1. Each emulated card has an associated .bin file on the host machine. As the emulator only supports the swapping of cards in slot 0, there are two .bin files, one for each of the two emulated MMC cards in slot 0. There is no support for card swapping on slot 1 and this has only one .bin file.

For the purpose of testing, we are interested in drive 1, the emulated MMC drive. See how to control the emulated MMC cards on drive 1.

[Top]


How to configure the emulator

The drive mappings for an MMC drive are defined by the emulator-specific (Wins) versions of estart.exe and estart.txt. However, the following keywords, which can be defined in epoc.ini affect the emulated MMC drive.

For more information on ESTART, see Background information: ESTART.

Item

Brief description

Required?

_EPOC_Socket_<SocketNum>_PWORD_<cardNum>

To set a password for the MMC drive, set this environment variable with the password for the specified slot number <SocketNum> and the card number <cardNum>.

For example, to set password for the slot number 0 and the card number 0, follow the steps outlined below:

  1. Right-click on My Computer on your desktop and select Properties.

  2. Select Advanced tab and click Environment Variables.

  3. Click New to add a User Variable.

  4. Type the variable name and value as "_EPOC_Socket_0_PWORD_0" and "password123" respectively

  5. Click OK to create the user variable.

After creating the environment variable, open a command prompt window, type set and press the ENTER key to view all the environment variables. If you can't find the environment variable you created, follow the steps outlined above and create it again.

You may also create this variable using the set command.

For example, the following command sets the password for slot number 1 and card number 1:

> Set _EPOC_Socket_1_PWORD_1=password123

Note: It is recommended not to use this approach to create the environment variables, as the variables are valid only for that particular command prompt session.

No

KeyMap

Maps a real key on the PC keyboard to a Symbian OS key code.

The F4 and F5 keys are used to emulate MMC drive events. This can cause a problem when debugging, because F5 is used for continuing the debugger. Use this item in epoc.ini to remap F4 and F5 to prevent this conflict.

For example:

KeyMap LeftAlt N EStdKeyF4
KeyMap LeftAlt M EStdKeyF5

Sets "LEFT ALT" + "N" to "F4" and "LEFT ALT" + "M" to "F5" respectively.

Therefore "LEFT ALT" + "M" will emulate a media change event (normally F5).

No

MultiMediaCardSize=<kilobytes>

Defines the size of the emulated MultiMediaCard drive. The default value is 1Mb, if no value is explicitly specified.

Note that these items are case-insensitive.

[Top]


How to control the emulated cards on drive 1

MMC drive 1 events are triggered in the emulator by pressing the F5 key in conjunction with the F4 key. The following table shows the various combinations of keystrokes and the associated MMC events.

Key press

Effect on cards emulated on socket 0 (drive 1)

Press and Hold F5

This emulates the opening of the MMC card door and the removal of the MMC card. The door stays open while the F5 key is held.

Release F5

This emulates the closing of the MMC card door, with the original MMC card returned (unless F4 is pressed in the mean time).

Press and Hold F5, Hit F4, Release F5

This toggles between the two emulated MMC cards and no card.

Hitting F4 while F5 is pressed (i.e. when the media door is open) toggles the card present. It cycles around the following states:

  • MMC card 0 inserted

  • MMC card 1 inserted

  • No MMC card inserted

Note that F4 must be released before F5. You might find that swapping is unreliable if you release F4 and F5 simultaneously, or F5 before F4

[Top]


Known limitations

There are some limitations to emulating the MMC controller:

  1. When you configure ...\epoc32\data\epoc.ini for the first time for an emulator (WINS) build, the emulated cards are initially unformatted. They must be formatted (within the emulator, possibly using the file manager application) before writing files to them.

  2. Each emulated card is stored in a file with the name mmccrdXX.bin. The files are stored in ...\epoc\data\media\....