16550A Serial control flow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm trying to get a small serial printer working. The printer 
operates at 9600 baud (how 1980), uses hardware flow control and 
has a 20 byte recieve fifo. The hardware flow control is triggered
when the fifo has 16 characters in it.

I'm connecting this printer to linux machine running a recent 2.6
kernel with a 16550A based serial port. The driver being used is
drivers/serial/8250.c which recognises the 16550A and sets it up
using this:

	[PORT_16550A] = {
		.name		= "16550A",
		.fifo_size	= 16,
		.tx_loadsz	= 16,
		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
		.flags		= UART_CAP_FIFO,

The problem I'm having is that there is a mismatch between the
fifos on the Linux size and the printer causes wrap around of
the buffer in the printer and badly screwed up print jobs.

The manufacturer of the printer suggests hacking the driver
(drivers/serial/8250.c) and changing the .tx_loadsz value for
the 16550A from 16 to 2.

I have tried this and can confirm that it does work. However, 
this solution sucks really badly. For one, we use other 16550A 
serial ports on the machine for other purposes where we use high 
baud rates and expect high throughput. Crippling the 16550A 
behaviour like this is not a step in the right direction.

Ideally, what would be nice is an ioctl that will change the
value of .tx_loadsz on a per port basis.

It seems that there is already an ioclt that could be used for
this, the TIOCGSERIAL/TIOCSSERIAL pair. I've tried using this
ioctl for the 16550A ports and while I can change the value
of the xmit_fifo_size field of serial_struct, the change doesn't
actually have any effect.

Questions:

 0) Is the current behaviour of the 16550A as described above
    correct?
 1) Should changing the xmit_fifo_size using the TIOCGSERIAL/
    TIOCSSERIAL ioctls allow me to fix this on a per port basis?
 2) Is there another/better solution?

Cheers,
Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Every method you use to prevent or find bugs leaves a residue of
subtler bugs against which those methods are ineffectual."
-- Bruce Beizer's Pesticide Paradox
-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux