Sample User Flash Application Program - Sun Microsystems Netra CP2500 Programming Manual

For the solaris operating system
Table of Contents

Advertisement

Sample User Flash Application Program

You can use the following program to test the user flash device and driver. This
program also demonstrates how this device can be used.
Sample User Flash Application Program
CODE EXAMPLE 3-6
/*
*
*
This application program demonstrates the user program
*
interface to the User Flash PROM driver.
*
*
One can read or write a number of bytes up to the size of
*
the user PROM by means of pread() and pwrite() calls.
*
All other functions of the PROM can be accessed by
*
means of ioctl() calls such as:
*
-) identify the chip,
*
-) query block,
*
-) lock block/unlock block,
*
-) erase block
*
Please note that not all of the above ioctl calls are
*
available for all flash PROMs. It is the user's
*
responsibility to find out the features of a given PROM.
*
The type, block size, and number of blocks of the PROM
*
are returned by "identify" ioctl().
*
*
The pwrite() erases the block[s] and then does the
*
writing.
*
*
Use the following line to compile your custom application
*
programs:
*
make uflash_test
*/
#pragma ident
#include <stdio.h>
#include <sys/signal.h>
#include <stdio.h>
#include <sys/time.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/stream.h>
#include "uflash_if.h"
/*
*/
"@(#)uflash_test.c 1.0
03/04/30 SMI"
Chapter 3 User Flash
53

Advertisement

Table of Contents
loading

Table of Contents