beautypg.com

Integrating a flash driver – Zilog EZ80F91AZA User Manual

Page 23

background image

UM017914-1211

Integrating a Flash Driver

Zilog File System

User Manual

13

Integrating a Flash Driver

This chapter briefly describes how to create a new driver for a Flash device other than
those supported, and how to integrate this Flash driver with the Zilog File System library
so that files and data can be stored in the Flash driver within the structure of the Zilog File
System.

The Zilog File System’s hardware abstraction module requires the Flash driver to be writ-
ten with an appropriate prototype and requires the function to return particular values
when the function succeeds or fails.

The Zilog File System requires the Flash driver to provide basic access routines for Flash
that perform the reading or writing of a number of bytes to and from Flash memory, in
addition to performing the erasure of the physical blocks of Flash. For more information
about the functionality of the basic access routines of the Flash driver that must be inte-
grated with the Zilog File System, refer to Flash Driver APIs section in the

Zilog Real-

Time Kernel Reference Manual (RM0006)

.

Depending upon the characteristics of the Flash device

1

, access to the Flash device can be

made sequentially and on a first-come/first-served basis. To achieve this type of sequence,
the developer must use any one of the synchronization objects present in RZK (for exam-
ple, a semaphore). These functions are referred to as Flash driver wrapper functions in the
Zilog File System.

When the Flash driver wrapper functions and driver routines are ready, the Flash driver is
integrated with the Zilog File System to store files and directories in Flash memory. The
Zilog File System provides a way of integrating a custom Flash driver that can be used to
store files and directories.

The

ZFS_Conf.c

file defines a global variable,

g_zfs_cfg

, which is of the

ZFS_CONFIG_t

structure type. You can change the member values of the structure to suit

your requirements. For more information about Zilog File System configuration, see
Zilog File System Configuration on page 8. For more information about creat-
ing a project workspace for your sample application, refer to

Zilog Real-Time Kernel User

Manual (UM0075)

.

To provide an example, suppose a custom Flash driver, with the name

MYFLASH

, has rou-

tines such as

MYFLASH_Init

,

MYFLASH_Read

,

MYFLASH_Write

,

MYFLASH_Erase

and

MYFLASH_Close

and that the starting address is

0x100000

, with seven erasing blocks to

be used for the storage of files and directories for the Zilog File System. Each block con-
tains 64 KB of space of storage. The configuration block must appear like the code seg-
ment provided below:

1. Some Flash devices, upon reading a byte, return the status byte if the Flash device is currently operating in write or erase modes.

This manual is related to the following products: