- 积分
- 54
贡献84
飞刀28 FD
注册时间2010-11-25
在线时间23 小时
扫一扫,手机访问本帖
|
斑竹:
我根据客服的指导,在linux2.6.28下将samsum.c按照s3c2410.c里面的方式修改。
1.s3c24xx_serial_startup()中增加对S3C2410_GPG11的初始化。
代码如下:
static int s3c24xx_serial_startup(struct uart_port *port)
{
struct s3c24xx_uart_port *ourport = to_ourport(port);
int ret;
dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n",
port->mapbase, port->membase);
rx_enabled(port) = 1;
ret = request_irq(RX_IRQ(port),
s3c24xx_serial_rx_chars, 0,
s3c24xx_serial_portname(port), ourport);
if (ret != 0) {
printk(KERN_ERR "cannot get irq %d\n", RX_IRQ(port));
return ret;
}
ourport->rx_claimed = 1;
dbg("requesting tx irq...\n");
tx_enabled(port) = 1;
ret = request_irq(TX_IRQ(port),
s3c24xx_serial_tx_chars, 0,
s3c24xx_serial_portname(port), ourport);
if (ret) {
printk(KERN_ERR "cannot get irq %d\n", TX_IRQ(port));
goto err;
}
ourport->tx_claimed = 1;
dbg("s3c24xx_serial_startup ok\n");
//add by Bruce
if (port->line == 2) {
//s3c2410_gpio_cfgpin(S3C2410_GPH6, S3C2410_GPH6_TXD2);
//s3c2410_gpio_pullup(S3C2410_GPH6, 1);
//s3c2410_gpio_cfgpin(S3C2410_GPH7, S3C2410_GPH7_RXD2);
//s3c2410_gpio_pullup(S3C2410_GPH7, 1);
s3c2410_gpio_cfgpin(S3C2410_GPG11, S3C2410_GPG11_OUTP);
s3c2410_gpio_pullup(S3C2410_GPG11, 0);
s3c2410_gpio_setpin(S3C2410_GPG11, 1);
} /* the port reset code should have done the correct
* register setup for the port controls */
return ret;
err:
s3c24xx_serial_shutdown(port);
return ret;
}
2.s3c24xx_serial_stop_tx()函数修改如下
static void s3c24xx_serial_stop_tx(struct uart_port *port)
{
if (tx_enabled(port)) {
disable_irq(TX_IRQ(port));
tx_enabled(port) = 0;
if (port->flags & UPF_CONS_FLOW)
s3c24xx_serial_rx_enable(port);
}
//add by Bruce
if (port->line == 2) {
printk("485_stop_tx\n");
s3c2410_gpio_setpin(S3C2410_GPG11, 0);
} //
}
3.s3c24xx_serial_start_tx()函数修改如下
static void s3c24xx_serial_start_tx(struct uart_port *port)
{
//add by Bruce
if (port->line == 2) {
printk("485_start_tx\n");
s3c2410_gpio_setpin(S3C2410_GPG11, 1);
}
// if (!tx_enabled(port)) {
if (port->flags & UPF_CONS_FLOW)
s3c24xx_serial_rx_disable(port);
enable_irq(TX_IRQ(port));
tx_enabled(port) = 1;
}
}
4.s3c24xx_serial_stop_rx()函数修改如下
static void s3c24xx_serial_stop_rx(struct uart_port *port)
{
if (rx_enabled(port)) {
dbg("s3c24xx_serial_stop_rx: port=%p\n", port);
disable_irq(RX_IRQ(port));
rx_enabled(port) = 0;
}
if (port->line == 2) {
printk("485_start_tx\n");
s3c2410_gpio_setpin(S3C2410_GPG11, 1);
}}
红色部分是根据s3c2410.c更改的。头文件还做了些更改。编译过后串口1可以正常的使用,但是485这边就无法正常的收发。请斑竹看看这里的更改是否有误。谢谢! |
|