tffsRawio( )

NAME

tffsRawio( ) - low level I/O access to flash components

SYNOPSIS

STATUS tffsRawio 
    ( 
    int  tffsDriveNo,  /* TrueFFS drive number (0 - DRIVES-1) */ 
    int  functionNo,   /* TrueFFS function code               */ 
    int  arg0,         /* argument 0                          */ 
    int  arg1,         /* argument 1                          */ 
    int  arg2          /* argument 2                          */ 
    )

DESCRIPTION

Use the utilities provided by this routine with the utmost care. If you use these routines carelessly, you risk data loss as well as permanent physical damage to the flash device.

This routine is a gateway to a series of utilities (listed below). Functions such as mkTffsboot( ) and tffsBootImagePut( ) use these tffsRawio( ) utilities to write boot sector information. The functions for physical read, write, and erase are made available with the intention that they be used on erase units allocated to the boot-image region by tffsDevFormat( ). Using these functions elsewhere could be dangerous.

The arg0, arg1, and arg2 parameters to tffsRawio( ) are interpreted differently depending on the function number you specify for functionNo. The drive number is determined by the order in which the socket components were registered.


functionNo
 
arg0
 
arg1
 
arg2
 

TFFS_GET_PHYSICAL_INFO
 
user buffer
 
N/A
 
N/A
 
TFFS_PHYSICAL_READ
 
address to read
 
byte count
 
user buffer address
 
TFFS_PHYSICAL_WRITE
 
address to write
 
byte count
 
user buffer address
 
TFFS_PHYSICAL_ERASE
 
first unit
 
number of units
 
N/A
 
TFFS_ABS_READ
 
sector number
 
number of sectors
 
user buffer address
 
TFFS_ABS_WRITE
 
sector number
 
number of sectors
 
user buffer address
 
TFFS_ABS_DELETE
 
sector number
 
number of sectors
 
N/A
 
TFFS_DEFRAGMENT_VOLUME
 
number of sectors
 
user buffer address
 
N/A
 

TFFS_GET_PHYSICAL_INFO writes the flash type, erasable block size, and media size to the user buffer specified in arg0.

TFFS_PHYSICAL_READ reads arg1 bytes from arg0 and writes them to the buffer specified by arg2.

TFFS_PHYSICAL_WRITE copies arg1 bytes from the arg2 buffer and writes them to the flash memory location specified by arg0.

TFFS_PHYSICAL_ERASE erases arg1 erase units, starting at the erase unit specified in arg0.

TFFS_ABS_READ reads arg1 sectors, starting at sector arg0, and writes them to the user buffer specified in arg2.

TFFS_ABS_WRITE takes data from the arg2 user buffer and writes arg1 sectors of it to the flash location starting at sector arg0.

TFFS_ABS_DELETE deletes arg1 sectors of data starting at sector arg0.

TFFS_DEFRAGMENT_VOLUME calls the defragmentation routine with the minimum number of sectors to be reclaimed, arg0, and writes the actual number reclaimed in the user buffer by arg1. Calling this function through some low priority task will make writes more deterministic. No validation is done of the user specified address fields, so the functions assume they are writable. If the address is invalid, you could see bus errors or segmentation faults.

RETURNS

OK, or ERROR if it failed.

SEE ALSO

tffsDrv