Block Erase Example Program - Sun Microsystems Netra CP2500 Programming Manual

For the solaris operating system
Table of Contents

Advertisement

Write Action on User Flash Device (Continued)
CODE EXAMPLE 3-4
}
main() {
int ret;
module = argv[0];
ret = uflash_init();
if (!ret)
uflash_write();
uflash_uninit();
}

Block Erase Example Program

CODE EXAMPLE 3-5
Block Erase Action on User Flash Device
CODE EXAMPLE 3-5
/*
* uflash_blockerase.c
* An example that shows how to erase block(s) of user flash
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <uflash_if.h>
char *uflash0 = "/dev/uflash0";
int ufd0;
uflash_if_t ufif0;
char *module;
static int
uflash_init() {
/* open device */
if ((ufd0 = open(uflash0, O_RDWR)) == -1 ) {
perror("uflash0: ");
exit(1);
}
/* get uflash sizes */
if (ioctl(ufd0, UIOCIBLK, &ufif0) == -1 ) {
perror("ioctl(ufd0, UIOCIBLK): ");
exit(1);
}
if (ufd0) {
printf("%s: \n", uflash0);
contains the Block Erase Action on the user flash device.
Chapter 3 User Flash
51

Advertisement

Table of Contents
loading

Table of Contents