一段小代码

goodboy_he 2011-12-13 08:00:13
if(ioctl(fd, MEMGETREGIONCOUNT, ®count) == 0)
{
PFUNC("MEMGETREGIONCOUNT regcount = [%d]\n", regcount);

if(regcount == 0)
{
res = non_region_erase(fd, start, count, unlock);
}
else
{
res = region_erase(fd, start, count, unlock, regcount);
}
}

在网上看到源码,所这样可以判断什么,这段代码是对nand操作的;
请问 MEMGETREGIONCOUNT 是什么意思?找了很多,都没有理解
...全文
129 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
falloutmx 2011-12-15
  • 打赏
  • 举报
回复
看代码啊,2楼那位连文件都给出来了
goodboy_he 2011-12-14
  • 打赏
  • 举报
回复
if(ioctl(fd, MEMGETREGIONCOUNT, ®count) == 0)
{
PFUNC("MEMGETREGIONCOUNT regcount = [%d]\n", regcount);

if(regcount == 0)
{
res = non_region_erase(fd, start, count, unlock);
}
else
{
res = region_erase(fd, start, count, unlock, regcount);
}
}

那为什么先判断 regcount 这个啊 我问的是 regcount的意思,等于0是什么意思,非0什么意思?
不是ioctl
woshi_ziyu 2011-12-14
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 goodboy_he 的回复:]

if(ioctl(fd, MEMGETREGIONCOUNT, &regcount) == 0)

然后 regcount 要么 =0 要么为非0 这两是啥意思?
[/Quote]

int ioctl( int fd, int request, .../* void *arg */ );
返回0 :成功 -1 :出错

ioctl函数详细说明
goodboy_he 2011-12-14
  • 打赏
  • 举报
回复
if(ioctl(fd, MEMGETREGIONCOUNT, ®count) == 0)

然后 regcount 要么 =0 要么为非0 这两是啥意思?
woshi_ziyu 2011-12-13
  • 打赏
  • 举报
回复
闪存的精确拓扑信息可以使用MEMGETREGIONCOUNT命令来获得

MEMGETREGIONCOUNT

Defined as a preprocessor macro in:
include/mtd/mtd-abi.h, line 113
Referenced (in 2 files total) in:
drivers/mtd/mtdchar.c, line 569
include/mtd/mtd-abi.h, line 113
falloutmx 2011-12-13
  • 打赏
  • 举报
回复
mem get region count

21,595

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧