linux flash擦除命令,linux下擦除、写入flash的简单编程参考

linux下对dataflash设备操作(擦除、写入文件)的应用程序,注意,所有的操作必须要使用mtdx的字符设备。

mtdchar的字符设备驱动编程参考!

来自:

http://blog.csdn.net/shanzhizi

#include

#include

#include

#include

#include

#include

#include

#include

#include

int non_region_erase(int Fd, int start, int count, int unlock)

{

mtd_info_t meminfo;

if (ioctl(Fd,MEMGETINFO,&meminfo) == 0)

{

erase_info_t erase;

erase.start = start;

erase.length = meminfo.erasesize;

for (; count > 0; count--) {

printf("/rPerforming Flash Erase of length %u at offset 0x%x",

erase.length, erase.start);

fflush(stdout);

if(unlock != 0)

{

//Unlock the sector first.

printf("/rPerforming Flash

你可能感兴趣的:(linux,flash擦除命令)