arm linux 设置非标准波特率
时间:2010-09-25 来源:daijianfu
由于内核和交叉编译环境中预定义的都是标准的波特率,所以需要设置非标准的波特率如8777,需要修改内核和交叉编译环境。可将不用的原先定义的好波特率改掉,比较保险。
内核修改:
include/asm/termbits.h 95行 B150->B8777
drivers/char/tty_io.c 2536行 150->8777
drivers/serial/s3c2410.c 黄老大给我了一个文件,覆盖掉,具体改了什么还不清楚。。。有空的时候研究下
交叉编译环境修改:
arm-linux/sys-include/asm/termbits.h 94行
arm-linux/include/asm/termbits.h 94行
arm-linux/include/bits/termios.h 124行
arm-linux/sys-include/bits/termios.h 124行
另外,在编译完内核后出现了问题,由于bootloader修改,bootloader中的地址空间与内核分区空间无法一一对应。
修改arch/arm/mach-s3c2410/devs.c中的内容可成功令内核的分区与bootloader地址对应。
以上为2.6.12内核
2.6.28.6内核修改方式如下:
arch/arm/include/asm/termbits.h 117行
drivers/char/tty_ioctl.c 190、202、210行
更换drivers/serial/samsung.c中的函数:
static int s3c24xx_serial_startup(struct uart_port *port)
{
struct s3c24xx_uart_port *ourport = to_ourport(port);
int ret;
unsigned long flags; dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n",
port->mapbase, port->membase); 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);
} local_irq_save(flags); 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"); /* the port reset code should have done the correct
* register setup for the port controls */ return ret; err:
s3c24xx_serial_shutdown(port);
return ret;
} 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/tin39/archive/2009/06/16/4274328.aspx
{
struct s3c24xx_uart_port *ourport = to_ourport(port);
int ret;
unsigned long flags; dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n",
port->mapbase, port->membase); 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);
} local_irq_save(flags); 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"); /* the port reset code should have done the correct
* register setup for the port controls */ return ret; err:
s3c24xx_serial_shutdown(port);
return ret;
} 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/tin39/archive/2009/06/16/4274328.aspx
相关阅读 更多 +