| 
 内核版本: 
使用的就是github上最新的内核   在内核驱动代码nuc980_serial.c文件里的nuc980serial_set_termios函数里加入一条打印信息: static void 
nuc980serial_set_termios(struct uart_port *port, struct ktermios *termios, struct ktermios *old) 
{ 
    struct uart_nuc980_port *up = (struct uart_nuc980_port *)port; 
    unsigned int lcr = 0; 
    unsigned long flags; 
    unsigned int baud, quot; 
 
    switch (termios->c_cflag & CSIZE) { 
    case CS5: 
        lcr = 0; 
        break; 
    case CS6: 
        lcr |= 1; 
        break; 
    case CS7: 
        lcr |= 2; 
        break; 
    default: 
    case CS8: 
        lcr |= 3; 
        break; 
    } 
 
    if (termios->c_cflag & CSTOPB) 
        lcr |= NSB; 
    if (termios->c_cflag & PARENB) 
        lcr |= PBE; 
    if (!(termios->c_cflag & PARODD)) 
        lcr |= EPE; 
    if (termios->c_cflag & CMSPAR) 
        lcr |= SPE; 
 
    baud = uart_get_baud_rate(port, termios, old, port->uartclk / 0xffff, port->uartclk / 11); 
    quot = nuc980serial_get_divisor(port, baud); 
     printk("in nuc980serial_set_termios, quot = %d, baud = %d \n", quot, baud); //增加这一条打印信息 
    /* 
     * Ok, we're now changing the port state.  Do it with 
     * interrupts disabled. 
     */ 
    spin_lock_irqsave(&up->port.lock, flags); 
 
    up->port.read_status_mask = RX_OVER_IF /*| UART_LSR_THRE | UART_LSR_DR*/; 
    if (termios->c_iflag & INPCK) 
        up->port.read_status_mask |= FEF | PEF; 
    if (termios->c_iflag & (BRKINT | PARMRK)) 
        up->port.read_status_mask |= BIF; 
 
    /* 
     * Characteres to ignore 
     */ 
    up->port.ignore_status_mask = 0; 
    if (termios->c_iflag & IGNPAR) 
        up->port.ignore_status_mask |= FEF | PEF; 
    if (termios->c_iflag & IGNBRK) { 
        up->port.ignore_status_mask |= BIF; 
        /* 
         * If we're ignoring parity and break indicators, 
         * ignore overruns too (for real raw support). 
         */ 
        if (termios->c_iflag & IGNPAR) 
            up->port.ignore_status_mask |= RX_OVER_IF; 
    } 
 
    if (termios->c_cflag & CRTSCTS) 
        up->mcr |= UART_MCR_AFE; 
    else 
        up->mcr &= ~UART_MCR_AFE; 
 
    nuc980serial_set_mctrl(&up->port, up->port.mctrl); 
 
    serial_out(up, UART_REG_BAUD, quot | 0x30000000); 
 
    serial_out(up, UART_REG_LCR, lcr); 
 
    spin_unlock_irqrestore(&up->port.lock, flags); 
 
 
} 
 
 
然后重新编译内核,下载重启后,通过应用程序设置波特率,设置1200波特率及以下波特率时, 这个打印的波特率就一直是9600   请问这个问题应该如何解决? 谢谢!    |