1. 程式人生 > >tty_operations結構體之uart_ops分析

tty_operations結構體之uart_ops分析


static const struct tty_operations uart_ops = {
	.open		= uart_open,
	.close		= uart_close,
	.write		= uart_write,
	.put_char	= uart_put_char,//單字元寫入函式
	.flush_chars	= uart_flush_chars,
	.write_room	= uart_write_room,//用來檢測緩衝區的剩餘空間
	.chars_in_buffer= uart_chars_in_buffer,//檢測包含資料緩衝區的數量
	.flush_buffer	= uart_flush_buffer,//重新整理緩衝區並丟棄其中的資料
	.ioctl		= uart_ioctl,
	.throttle	= uart_throttle,
	.unthrottle	= uart_unthrottle,
	.send_xchar	= uart_send_xchar,
	.set_termios	= uart_set_termios,//設定termios,當裝置的termios發生變化時函式被呼叫
	.set_ldisc	= uart_set_ldisc,//設定線路規程的函式
	.stop		= uart_stop,
	.start		= uart_start,
	.hangup		= uart_hangup,//掛起函式
	.break_ctl	= uart_break_ctl,
	.wait_until_sent= uart_wait_until_sent,//用來向硬體傳送資料
#ifdef CONFIG_PROC_FS
	.proc_fops	= &uart_proc_fops,//proc操作函式
#endif
	.tiocmget	= uart_tiocmget,//獲取特定tty裝置當前的線路設定
	.tiocmset	= uart_tiocmset,//設定特定tty裝置當前的線路
	.get_icount	= uart_get_icount,
#ifdef CONFIG_CONSOLE_POLL
	.poll_init	= uart_poll_init,
	.poll_get_char	= uart_poll_get_char,
	.poll_put_char	= uart_poll_put_char,
#endif
};