LDD3: tiny_serial模块编译和测试

本文详细介绍了在2.6.32和3.12.74内核下,tiny_serial模块的编译和测试过程。在UART驱动层基础上,tiny_serial简化了串口驱动的编写,但在编译和测试中遇到了如set_termios参数变化、uart_port类型未设置、timer未初始化及uartclk未设置等问题。通过逐一解决这些问题,最终成功运行并调试模块。
摘要由CSDN通过智能技术生成

UART驱动层是在tty驱动层上对常用的异步通信串口做了封装,简化了串口驱动的编写。从测试结果来看,在2.6.323.12.74内核下编译和运行遇到的问题基本相同,相比tty驱动容易移植得多,这就是封装的好处。

编译

error: ‘struct uart_port’ has no member named ‘info’
info 信息已改成使用 "struct uart_state *state"

	struct circ_buf *xmit = &port->state->xmit;

warning: passing argument 1 of ‘tty_insert_flip_char’ from incompatible pointer type
note: expected ‘struct tty_port *’ but argument is of type ‘struct tty_struct *’

flip buffer接口改成 tty_port, 可以从 state 信息得到:

static void tiny_timer(unsigned long data)
{
   
	struct uart_port *port;
	struct tty_port *tport;
	...
	tport = &port->state->port;
	...
	tty_insert_flip_char(tport, TINY_DATA_CHARACTER, 0);
	tty_flip_buffer_push(tport);
	...
}

2.6.32内核则使用 tty = port->state->port.tty


warning: passing argument 2 of ‘uart_get_baud_rate’ from incompatible pointer type
note: expected ‘struct ktermios *’ but argument is of type ‘struct termios *’

set_termios 函数参数改为 struct ktermios *

static void tiny_set_termios(struct uart_port *port,
			     struct ktermios *new, struct ktermios *old)

warning: initialization from incompatible pointer type
warning: (near initialization for ‘tiny_ops.stop_tx’)
warning: (near initialization for ‘tiny_ops.start_tx’)

start/stop_tx 函数参数发生了变化:

static void 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值