亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: tty_write 和 uart_write是什么關(guān)系啊(弱智問(wèn)題) [打印本頁(yè)]

作者: xiaoyao183    時(shí)間: 2008-08-15 16:27
標(biāo)題: tty_write 和 uart_write是什么關(guān)系啊(弱智問(wèn)題)
請(qǐng)問(wèn)在串口驅(qū)動(dòng)中 從tty_io.c中的操作如何調(diào)用到 serial_core.c中相應(yīng)的操作

這兩個(gè)文件中的操作有關(guān)系嗎  舉例:從應(yīng)用層如何實(shí)現(xiàn)write 的啊  感謝
作者: dreamice    時(shí)間: 2008-08-15 16:38
原帖由 xiaoyao183 于 2008-8-15 16:27 發(fā)表
請(qǐng)問(wèn)在串口驅(qū)動(dòng)中 從tty_io.c中的操作如何調(diào)用到 serial_core.c中相應(yīng)的操作

這兩個(gè)文件中的操作有關(guān)系嗎  舉例:從應(yīng)用層如何實(shí)現(xiàn)write 的啊  感謝


  1. static ssize_t tty_write(struct file * file, const char __user * buf, size_t count,
  2.                          loff_t *ppos)
  3. {
  4.         struct tty_struct * tty;
  5.         struct inode *inode = file->f_dentry->d_inode;
  6.         ssize_t ret;
  7.         struct tty_ldisc *ld;
  8.        
  9.         tty = (struct tty_struct *)file->private_data;
  10.         if (tty_paranoia_check(tty, inode, "tty_write"))
  11.                 return -EIO;
  12.         if (!tty || !tty->driver->write || (test_bit(TTY_IO_ERROR, &tty->flags)))
  13.                 return -EIO;

  14.         ld = tty_ldisc_ref_wait(tty);               
  15.         if (!ld->write)
  16.                 ret = -EIO;
  17.         else
  18.                 ret = do_tty_write(ld->write, tty, file, buf, count);
  19.         tty_ldisc_deref(ld);
  20.         return ret;
  21. }
復(fù)制代碼

這一句:ret = do_tty_write(ld->write, tty, file, buf, count);
你跟進(jìn)去看一下-->
ret = write(tty, file, tty->write_buf, size);

仔細(xì)看代碼實(shí)現(xiàn),就知道了。
作者: xiaoyao183    時(shí)間: 2008-08-15 17:11
標(biāo)題: 回復(fù) #2 dreamice 的帖子
先感謝 我再好好看看 呵呵




歡迎光臨 Chinaunix (http://72891.cn/) Powered by Discuz! X3.2