Re: [RS232] setting trigger-level of fifo

Folkert van Heusden
2008-01-09T15:54:28Z

> In windows one can configure at what point the uart will trigger an
> interrupt. E.g. 1, 4, 8 or 14 bytes received. Setserial doesn't let you
> and I saw in the sources of the serial driver no hint that it is
> supported in linux at all. Also in MAINTAINERS I saw that sreial is
> orphaned. Can someone tell how I can proceed with this? Is it at all
> possible to do this setting?

I think it must be something like this:

static void limit_fifo(struct uart_port *port)
{
struct uart_8250_port *up = (struct uart_8250_port *)port;
unsigned char cval, fcr = 0;
unsigned long flags;

/* hopefully not setting the UART_FCR_ENABLE_FIFO flag will
* set it to off. otherwhise the trigger_1 should make the
* uart trigger the interrupt immediately after the first
* byte comes in
*/
fcr = UART_FCR_TRIGGER_1;

spin_lock_irqsave(&up->port.lock, flags);

if (up->port.type == PORT_16750)
serial_outp(up, UART_FCR, fcr);

serial_outp(up, UART_LCR, cval); /* reset DLAB */
up->lcr = cval; /* Save LCR */
if (up->port.type != PORT_16750) {
if (fcr & UART_FCR_ENABLE_FIFO) {
/* emulated UARTs (Lucent Venus 167x) need two steps */
serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO);
}
serial_outp(up, UART_FCR, fcr); /* set fcr */
}
serial8250_set_mctrl(&up->port, up->port.mctrl);
spin_unlock_irqrestore(&up->port.lock, flags);
}

But I don't know how to interface this to an ioctl or so.

All help is appreciated!

Folkert van Heusden

--
Looking for a cheap but fast webhoster with an excellent helpdesk?
http://keetweej.vanheusden.com/redir.php?id=1001
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com