Embedded Xinu Operating System
An ongoing research project and educational operating system.
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
Functions
flashRead.c File Reference
#include <kernel.h>
#include <device.h>
#include <flash.h>

Functions

devcall logicalRead (struct flash *, uchar *, ulong)
 
devcall flashRead (device *devptr, uchar *buffer, ulong block)
 

Detailed Description

A simple, high-level interface to read from flash.

Function Documentation

devcall flashRead ( device *  devptr,
uchar *  buffer,
ulong  block 
)

Provides a simple way to read in the contents of a block

Parameters
*devptrpointer to the flash device
*bufferbuffer to store contents into (should be flash->log_size)
blockblock number to read in
Returns
OK on success, SYSERR on failure
devcall logicalRead ( struct flash *  flash,
uchar *  buffer,
ulong  block 
)

With a logical block address, read in the contents of the block into the buffer. This will check if the erase-block is already in memory and if so simply read from the cached copy, if it is not read it into memory and read the specified block. If there is no more room in memory to store an erase-block it will automatically write to the oldest erase-block to flash and read in the requested block.

Parameters
*flashflash device to read on.
*bufferbuffer to read into.
blockblock to read on device.
Returns
number of bytes read or SYSERR on failure