Skip to contentSkip to conversation

Bug+Bugfix: Serialdriver 2.6.0-test8(setting custum speed)

DISCUSSION Heinz-Georg Sawicki 1 participant 1 message Oct 24, 2003

lore
Share & tools
lore
#0 lore raw

Hi!

First excuse me for my bad english.
In case of custom speed the routine uart_get_divisor in serial_core.c
must calcuate the custom baudrate and return it to the caller. It may look somewhat like this:

unsigned int
uart_get_divisor(struct uart_port *port, unsigned int* pBaud)

{
	unsigned int quot;

	/*
	 * Old custom speed handling.
	 */
	if (*pBaud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
    {
		quot = port->custom_divisor;
        *pBaud = port->uartclk / (16 * quot);
    }
	else
		quot = port->uartclk / (16 * (*pBaud));

	return quot;
}

This is necessary because serial8250_set_termios in 8250.c uses the
baudrate for setting the fifotriggerlevel

		if (baud < 2400)
			fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_1;
#ifdef CONFIG_SERIAL_8250_RSA
		else if (up->port.type == PORT_RSA)
			fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_14;
#endif
		else
			fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_8;

In my case i setup a customdivisor of 11520 to get a baudrate of 10 baud, to receive the dcf77-signal(UART 16550A, PC-Hardware). Instead of one byte per second i received 8 bytes at once because of the wrong triggerlevel. By setting the triggerlevel always to one

		:
		else
			fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_1;

i checked that this was the cause for the problem.

By the way, the comment

	/*
	 * Old custom speed handling.
	 */

says, that this is the old way for setting up a custom speed. Can you please tell me the new way for doing this. Thanks.

Have a nice day,

Heinz-Georg Sawicki