20
Netra CP3010 Board Programming Guide
• January
2006
case ’4’: /* lock flash PROM block */
/* on certain PROMs */
fprintf(stderr,
"Enter PROM block number[0, 56]> ");
scanf ("%d", &uflash_if.blk_num);
fprintf(stderr,
"Enter number of block> ");
scanf ("%d", &uflash_if.num_of_blks);
if (ioctl(fd, UIOCLBLK, &uflash_if) == -1)
goto getout;
break;
case ’3’: /* query flash PROM */
/* on certain PROMs */
fprintf(stderr,
"Enter PROM block number[0, 56]> ");
scanf ("%d", &uflash_if.blk_num);
fprintf(stderr,
"Enter number of block> ");
scanf ("%d", &uflash_if.num_of_blks);
if (ioctl(fd, UIOCQBLK, &uflash_if) == -1)
goto getout;
for (i = uflash_if.blk_num;
i < (uflash_if.uflash_if.num_of_blks);
i++)
{
fprintf(stderr, "block[%d] status = %x\n",
i, uflash_if.info.blk_status[i] & 0x1);
}
break;
case ’2’: /* identify flash PROM */
if (ioctl(fd, UIOCIBLK, &uflash_if) == -1)
goto getout;
fprintf(stderr, "manufacturer id = 0x%x, device id =\
0x%x\n# of blks = %d, blk size = 0x%x\n",
uflash_if.info.mfr_id & 0xFF,
uflash_if.info.dev_id & 0xFF,
uflash_if.info.blk_num,
uflash_if.info.blk_size);
break;
CODE
EXAMPLE
2-6
Flash Application Program
(Continued)