Skip to contentSkip to conversation

setting trigger-level of fifo

RS232 Folkert van Heusden 2 participants 3 messages Jan 9, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

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?

Folkert van Heusden

Signature · 5 lines
Multi tail barnamaj mowahib li mora9abat attasjilat wa nataij awamir
al 7asoub. damj, talwin, mora9abat attarchi7 wa ila akhirih.
http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
#1 lore raw
Quoted 6 lines

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

Signature · 4 lines
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
#2 lore raw
Quoted 5 lines
        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.

tty ioctl calls both ldisc and driver ioctls (in your case the serial_core ioctl). The triggers get recomputed in the 8250 driver so you may need to think about how you handle speed changes automatically adjusting trigger levels.

Alan