CODE EXAMPLE 3-5 Block Erase Action on User Flash Device (Continued)
printf("manfacturer id = 0x%p\n", ufif0.info.mfr_id); printf("device id = 0x%p\n", ufif0.info.dev_id); printf("number of blocks = 0x%p", ufif0.info.blk_num); printf("block size = 0x%p" ufif0.info.blk_size);
}
}
static int
uflash_uninit() { if (ufd0)
close(ufd0);
}
static int
uflash_blockerase() {
/* erase 2 blocks starting from block 1 of user flash */ uf0.blk_num = 1;
uf0.num_of_blks = 2;
if (ufd0 && ioctl(ufd0, UIOCEBLK, &ufif0) ==
}
printf("\nblockerase successful on %s\n", uflash0); return(0);
}
main() { int ret;
module = argv[0]; ret = uflash_init(); if (!ret)
uflash_blockerase(); uflash_uninit();
}