⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 restore_pot.c

📁 计时程序, 1分钟翻转1bit的flash
💻 C
字号:
/* * flash.c - flash handling for installing an image * * Copyright (C) 2002 by Intersil Corp. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */#include <limits.h>#include <unistd.h>#include <stdlib.h>#include <stdio.h>#include <stdint.h>#include <fcntl.h>#include <errno.h>#include <error.h>#include <time.h>#include <sys/ioctl.h>#include <sys/types.h>#include <sys/param.h>#include <sys/mount.h>#include <sys/stat.h>#include <sys/reboot.h>#include <string.h>#include <linux/mtd/mtd.h>#define SECTOR_SIZE ( 0x20000 )int main(int argc, char *argv[]){	int	devfd		=-1;	unsigned long	value;	unsigned long	flag;	int 	i;	erase_info_t	eraseinfo;	if ((devfd = open( "/dev/mtd/4" ,O_RDWR)) == -1 ){		printf("Failed to open device\n");		return -EINVAL;	}		eraseinfo.start=0;	eraseinfo.length=SECTOR_SIZE;		if ( ioctl(devfd,MEMERASE,&eraseinfo) != 0){		printf("Flash erase of device mtd/4 is failed\n");		return 0;			}	close(devfd);	return 1;}	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -