Sun Microsystems Netra CP2500 Programming Manual page 69

For the solaris operating system
Table of Contents

Advertisement

Sample User Flash Application Program (Continued)
CODE EXAMPLE 3-6
if ((fd0 = open(devname0, O_RDWR)) < 0) {
fprintf(stderr, "couldn't open device: %s\n", devname0);
exit(1);
}
/* set the default PROM */
prom_id = 0;
fd = fd0;
/* let them know about the help menu */
fprintf(stderr, "Enter <h> or <?> for help on commands\n");
while (1) {
fprintf(stderr, "[%d]command> ", prom_id);
switch(get_cmd()) {
case 'q':
goto getout;
case 'h':
case '?':
h = 0;
while (*help[h]){
}
break;
case '6':
fprintf(stderr,
fprintf(stderr,
scanf ("%d", &uflash_if.num_of_blks);
if (ioctl(fd, UIOCEBLK, &uflash_if) == -1)
break;
case '5':
if (ioctl(fd, UIOCCLCK, &uflash_if) == -1)
break;
fprintf(stderr, "
h++;
/* erase flash PROM block */
"Enter PROM block number[0, 56]> ");
scanf ("%d", &uflash_if.blk_num);
"Enter number of block> ");
goto getout;
/* clear all locks */
goto getout;
%s\n", help[h]);
Chapter 3 User Flash
55

Advertisement

Table of Contents
loading

Table of Contents