Sample user flash application program, Code example 3-6 – Sun Microsystems Netra CP2500 User Manual
Page 67
Chapter 3
User Flash
53
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.
CODE EXAMPLE 3-6
Sample User Flash Application Program
/*
*
* 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 "@(#)uflash_test.c 1.0 03/04/30 SMI"
#include
#include
#include
#include
#include
#include
#include
#include
#include "uflash_if.h"
/*
*/