网络安全参考 | UNIX参考 | GPS参考 | 无线参考 | 在线手册 | OSBUG.ORG | SUNNY-NETWORK.COM
天线制作 GPS 地标
网站地图 RSS订阅
高级搜索 收藏本站
Home | 业界动态 | Open source | GNU | Linux | BSD | Solaris | AIX | HP-UX | IRIX | Mac OS X | Minix | Tru64 | SCO UNIX | Network | Security | X-Window | Database | 应用服务 | Programming | 经典著作 | 永远的纪念 | 杂项
 当前位置: Home > Linux > 嵌入式系统 > 设备驱动 > 文章  
ARM的嵌入式Linux移植体验之设备驱动
文章来源: 天极开发 文章作者: 宋宝华 发布时间: 2006-08-14   字体: [ ]  
 

static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
int len, char *buf)
{
 …
}

static int mtdblock_open(struct inode *inode, struct file *file)
{
 …
}

static release_t mtdblock_release(struct inode *inode, struct file *file)
{
 int dev;
 struct mtdblk_dev *mtdblk;
 DEBUG(MTD_DEBUG_LEVEL1, "mtdblock_release\n");

 if (inode == NULL)
  release_return(-ENODEV);

 dev = minor(inode->i_rdev);
 mtdblk = mtdblks[dev];

 down(&mtdblk->cache_sem);
 write_cached_data(mtdblk);
 up(&mtdblk->cache_sem);

 spin_lock(&mtdblks_lock);
 if (!--mtdblk->count) {
  /* It was the last usage. Free the device */
  mtdblks[dev] = NULL;
  spin_unlock(&mtdblks_lock);
  if (mtdblk->mtd->sync)
   mtdblk->mtd->sync(mtdblk->mtd);
   put_mtd_device(mtdblk->mtd);
   vfree(mtdblk->cache_data);
   kfree(mtdblk);
 } else {
  spin_unlock(&mtdblks_lock);
 }

 DEBUG(MTD_DEBUG_LEVEL1, "ok\n");
 
 BLK_DEC_USE_COUNT;
 release_return(0);
}

/*
* This is a special request_fn because it is executed in a process context
* to be able to sleep independently of the caller. The
* io_request_lock (for <2.5) or queue_lock (for >=2.5) is held upon entry
* and exit. The head of our request queue is considered active so there is
* no need to dequeue requests before we are done.
*/
static void handle_mtdblock_request(void)
{
 struct request *req;
 struct mtdblk_dev *mtdblk;
 unsigned int res;

 for (;;) {
  INIT_REQUEST;
  req = CURRENT;
  spin_unlock_irq(QUEUE_LOCK(QUEUE));
  mtdblk = mtdblks[minor(req->rq_dev)];
  res = 0;

 
推荐文章
·让arm-linux支持普通USB摄像头
·Linux设备驱动编程之结构化设备
·Linux设备驱动编程之复杂设备驱
·深入浅出Linux设备驱动之并发控
·深入浅出Linux设备驱动之字符设
·深入浅出Linux设备驱动编程之内
·深入浅出Linux设备驱动编程之引
·Linux设备驱动编程之定时器
·Linux设备驱动编程之中断处理
·Linux设备驱动编程之异步通知
·Linux设备驱动编程之阻塞与非阻
·Linux设备驱动编程之内存与I/O操
·摄像头(WebCam)在Linux操作系
·中星微芯片(301,302)USB 摄像头
 
 
↑返回顶部   打印本页   关闭窗口↓  

Google
 
Web oldhand.org unixreference.net meshmea.org
相关分类
热点文章
·摄像头(WebCam)在Linu
·在Linux中使用中星微301
·中星微芯片(301,302)USB
·Linux设备驱动编程之内
·深入浅出Linux设备驱动
·Linux培训园地:Linux下
·Linux的I2C驱动架构
·让arm-linux支持普通USB
相关文章
·ARM的嵌入式Linux移植体
·ARM的嵌入式Linux移植体
·ARM的嵌入式Linux移植体
·ARM的嵌入式Linux移植体
·Linux PDA和手持PC一览
·嵌入式Linux操作系统启
·嵌入式Linux系统中的GUI
·QTE/Qtopia在Liod-270上
更多...
 
 

Copyright(c) 2001-2009 OLDHAND ORGANIZATION, All Rights reserved.
Power by DedeCms 织梦内容管理系统