[讨论] 看不懂fb_write源码

wonderglass   2010-2-3 10:22 楼主
fb_write()是FrameBuffer设备的其中一个用户接口函数,搞不懂它的参数定义,google了一天,都没找到。我把源码贴出来,各位高人帮我看看。谢谢!
static ssize_t
fb_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
{
unsigned long p = *ppos;
struct inode *inode = file->f_dentry->d_inode;
int fbidx = GET_FB_IDX(inode->i_rdev);
struct fb_info *info = registered_fb[fbidx];
struct fb_ops *fb = info->fbops;
struct fb_fix_screeninfo fix;
int err;
if (! fb || ! info->disp)
  return -ENODEV;
fb->fb_get_fix(&fix, PROC_CONSOLE(info), info);
if (p > fix.smem_len)
     return -ENOSPC;
if (count >= fix.smem_len)
     count = fix.smem_len;
err = 0;
if (count + p > fix.smem_len) {
     count = fix.smem_len - p;
     err = -ENOSPC;
}
if (count) {
     char *base_addr;
     base_addr = info->disp->screen_base;
     count -= copy_from_user(base_addr+p, buf, count);
     *ppos += count;
     err = -EFAULT;
}
if (count)
  return count;
return err;
}

回复评论 (2)

LCD.pdf (1.43 MB)
(下载次数: 40, 2010-2-3 11:16 上传)

你先看看这个文档吧!
处处留心皆学问!
点赞  2010-2-3 11:16
daicheng有许多好东东啊,都秀出来共享下吧;P
点赞  2010-2-3 12:13
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复