tffsDrv

NAME

tffsDrv - TrueFFS interface for VxWorks

SYNOPSIS

tffsDrv( ) - initialize the TrueFFS system
tffsDevCreate( ) - create a TrueFFS block device suitable for use with dosFs
tffsDevFormat( ) - format a flash device for use with TrueFFS
tffsRawio( ) - low level I/O access to flash components
STATUS tffsDrv  
(void) 
BLK_DEV * tffsDevCreate (int tffsDriveNo, int removableMediaFlag)
STATUS tffsDevFormat (int tffsDriveNo, int arg)
STATUS tffsRawio (int tffsDriveNo, int functionNo, int arg0, int arg1, int arg2)

DESCRIPTION

This module defines the routines that VxWorks uses to create a TrueFFS block device. Using this block device, dosFs can access a board-resident flash memory array or a flash memory card (in the PCMCIA slot) just as if it was a standard disk drive. Also defined in this file are functions that you can use to format the flash medium, as well as functions that handle low-level I/O to the device.

To include TrueFFS for Tornado in a VxWorks image, you must edit your BSP's config.h and define INCLUDE_TFFS, or, for some hardware, INCLUDE_PCMCIA. This configures the VxWorks initialization code to call tffsDrv( ). This call sets up the structures, the global variables, and the mutual exclusion semaphore needed to manage TrueFFS. This call to tffsDrv( ) also registers socket component drivers for each flash device found attached to the target.

These socket component drivers are not quite block devices, but they are an essential layer within TrueFFS. Their function is to manage the hardware interface to the flash device, and they are intelligent enough to handle formatting and raw I/O requests to the flash device. The other two layers within TrueFFS are known as the translation layer and the MTD (the Memory Technology Driver). The translation layer of TrueFFS implements the error recover and wear-leveling features of TrueFFS. The MTD implements the low-level programming (map, read, write, and erase) of the flash medium.

To implement the socket layer, each BSP that supports TrueFFS includes a sysTffs.c file. This file contains the code that defines the socket component driver. This file also contains a set of defines that you can use to configure which translation layer modules and MTDs are included in TrueFFS. Which translation layer modules and MTDs you should include depends on which types of flash devices you need to support. Currently, there are three basic flash memory technologies, NAND-based, NOR-based, and SSFDC. Within sysTffs.c, define:

INCLUDE_TL_NFTL

INCLUDE_TL_FTL

INCLUDE_TL_SSFDC

To support these different technologies, TrueFFS ships with three different implementations of the translation layer. Optionally, TrueFFS can include all three modules. TrueFFS later binds the appropriate translation layer module to the flash device when it registers a socket component driver for the device.

Within these three basic flash device categories there are still other differences (largely manufacturer-specific). These differences have no impact on the translation layer. However, they do make a difference for the MTD. Thus, TrueFFS ships with a variety of different MTDs that can support a wide range of flash devices from Intel, Sharp, Samsung, National, Toshiba, AMD, and Fujitsu. Within sysTffs.c, define:

INCLUDE_MTD_I28F016

INCLUDE_MTD_I28F008

INCLUDE_MTD_I28F008_BAJA

INCLUDE_MTD_AMD

INCLUDE_MTD_CDSN

INCLUDE_MTD_DOC2

INCLUDE_MTD_CFISCS

INCLUDE_MTD_WAMD

The socket component driver and the MTDs are provided in source form. If you need to write your own socket driver or MTD, use these working drivers as a model for your own.

EXTERNALLY CALLABLE ROUTINES

Most of the routines defined in this file are accessible through the I/O system only. However, four routines are callable externally. These are: tffsDrv( ), tffsDevCreate( ), tffsDevFormat( ), and tffsRawio( ).

The first routine called from this library must be tffsDrv( ). Call this routine exactly once. Normally, this is handled automatically for you from within usrRoot( ), if INCLUDE_TFFS is defined, or from within pccardTffsEnabler( ), if INCLUDE_PCMCIA is defined.

Internally, this call to tffsDrv( ) registers socket component drivers for all the flash devices connected to your system. After registering a socket component driver for the device, TrueFFS can support calls to tffsDevFormat( ) or tffsRawio( ). However, before you can mount dosFs on the flash device, you must call tffsDevCreate( ). This call creates a block device on top of the socket component driver, but does not mount dosFs on the device. Because mounting dosFs on the device is what you will want to do most of the time, the sysTffs.c file defines a helper function, usrTffsConfig( ). Internally, this function calls tffsDevCreate( ) and then does everything necessary (such as calling the dosFsDevInit( ) routine) to mount dosFs on the resulting block device.

LOW LEVEL I/O

Normally, you should handle your I/O to the flash device using dosFs, which, in turn, uses TrueFFS and its component drivers to read and write from the flash device. However, there are situations in which this level of indirection can cause problems. To handle such situations, this library defines tffsRawio( ). Using this function, you can bypass both dosFs and the TrueFFS translation services to program the flash medium directly.

However, you should not try to program the flash device directly unless you are intimately familiar with the physical limits of your flash device as well as with how TrueFFS formats the flash medium. Otherwise you risk not only corrupting the medium entirely but permanently damaging the flash device.

If all you need to do is write a boot image to the flash device, use the tffsBootImagePut( ) utility instead of tffsRawio( ). This function provides safer access to the flash medium.

IOCTL

This driver responds to all ioctl codes by setting a global error flag. Do not attempt to format a flash drive using ioctl calls.

INCLUDE FILES

tffsDrv.h, fatlite.h