Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Apple16X50Serial] How to prevent HW buffer overflows?



On Nov 26, 2003, at 4:02 AM, Alexander Traud wrote:
The driver tells Apple16X50UARTSync to activate hardware flow control (RTS/CTS). The communication of small "packets" (~20 bytes) works in both directions. Sending of large packets works, too. But if Apple16X50UARTSync receives a large packet (~255 bytes) Apple16X50UARTSync::dequeueData() is often cancelled because of a non-data event in the Apple16X50Queue. We tested that this event identifies itself as "hardware buffer overrun with data loss".

This is the core of your problem.

You might be able to reduce the receive FIFO trigger value in order to signal the receiver interrupt earlier, but your basic problem is that the interrupt handler is not running soon enough, and the 16-byte FIFO is just too small.

Frankly, the 16550 is a joke in this day and age, and you're in a hard place trying to do anything serious with it. If, for your application, you can specify that the 128-byte-fifo version is to be used (and the driver handles it correctly) then you may be OK. You don't say (or I missed) what speed you're running your link at, so I can't guesstimate how long the interrupt has to be held off before you lose data.

The Apple16x50 driver sources available on the OpenDarwin cvsweb don't show any signs of installing an interrupt filter, so you are the mercy of the scheduling of its interrupt thread when it comes to latency. In the face of other interrupts or kernel threads, you may be looking at tens or hundreds of milliseconds worth of latency.

If this isn't good enough, you may want to look at modifying the Apple driver.

Questions:
- Is it possible to increase the calling interval of the Apple16X50UARTSync::intervall() routine? Our knowledge of UARTs is quite zero to understand the deeper UART things within Apple16X50UARTSync.

This won't help; you need an interrupt filter so that you can run *immediately* the UART signals the FIFO is filling.

= Mike
_______________________________________________
darwin-drivers mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-drivers
Do not post admin requests to the list. They will be ignored.

References: 
 >[Apple16X50Serial] How to prevent HW buffer overflows? (From: Alexander Traud <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.