- 论坛徽章:
- 3
|
原帖由 xiaoyao183 于 2008-8-15 16:27 发表 ![]()
请问在串口驱动中 从tty_io.c中的操作如何调用到 serial_core.c中相应的操作
这两个文件中的操作有关系吗 举例:从应用层如何实现write 的啊 感谢
- static ssize_t tty_write(struct file * file, const char __user * buf, size_t count,
- loff_t *ppos)
- {
- struct tty_struct * tty;
- struct inode *inode = file->f_dentry->d_inode;
- ssize_t ret;
- struct tty_ldisc *ld;
-
- tty = (struct tty_struct *)file->private_data;
- if (tty_paranoia_check(tty, inode, "tty_write"))
- return -EIO;
- if (!tty || !tty->driver->write || (test_bit(TTY_IO_ERROR, &tty->flags)))
- return -EIO;
- ld = tty_ldisc_ref_wait(tty);
- if (!ld->write)
- ret = -EIO;
- else
- ret = do_tty_write(ld->write, tty, file, buf, count);
- tty_ldisc_deref(ld);
- return ret;
- }
复制代码
这一句:ret = do_tty_write(ld->write, tty, file, buf, count);
你跟进去看一下-->
ret = write(tty, file, tty->write_buf, size);
仔细看代码实现,就知道了。 |
|