DMA Controller
8-24
Am186™CC/CH/CU Microcontrollers User’s Manual
pointer from it, and dividing the result by the buffer size. The remainder of this division is
the number of bytes available for reading.
The difficulty again revolves around multitasking and flow control, with the added problem
of error handling.
Receive XON/XOFF Flow Control
XON/XOFF flow control with DMA is problematic because, in general, the received flow
control characters should not be stored in the buffer, and also because the characters
should typically be acted on immediately. This may make DMA impractical for implementing
XON/XOFF flow control with the UART. The High-Speed UART can be programmed to stop
using DMA and interrupt the CPU whenever a flow control character arrives, so that an
interrupt routine can act on the flow-control character and then restart the DMA operation.
Note that baud rate, system latency, and the depth of the FIFO must be considered when
determining if this is practical for a given implementation.
In addition to detecting and acting on flow-control characters in the data stream, the
receiving task must also detect when the circular buffer is getting full so that an XOFF can
be sent. This can be accomplished by programming the Transfer Count register with a value
that is the current room available in the buffer minus a constant high-water mark, and setting
the INT bit, but not the TC bit in the GDxCON0 register. This causes the DMA to interrupt
when there is room (buffer size minus high-water mark) in the buffer, and an XOFF can be
sent. The value chosen for the high-water mark should take into account far-end latency in
dealing with an XOFF, plus latency associated with sending the XOFF through the High-
Speed UART transmit FIFO, if it is enabled.
Receive Hardware Flow Control
Hardware flow control is simple if the connected device performs true hardware flow control
(i.e., stops transmitting on the next character boundary when RTR is dropped).
Some UARTs and systems perform pseudo-hardware flow control. In these UARTs, the
flow control signal can cause an interrupt, but may not stop characters already queued to
go out. In this case, the High-Speed UART’s receive FIFO may be sufficient to guarantee
that overruns do not occur.
If the UART is being used, or if the High-Speed UART’s receive FIFO is not large enough
to guarantee that the other side will stop quickly enough, then RTR should be performed
using a PIO, and an algorithm similar to the one described for receive XON/XOFF control
should be used, so that the far side is requested to stop sending before the DMA buffer is
actually full. The FIFO threshold is one half of the FIFO depth and is not programmable.
If the attached device is capable of real hardware flow control, then the TC bit in the
GDxCON0 register can be set, and the Transfer Count register can be programmed with
the amount of room left in the buffer. When DMA ceases, the hardware flow control signal
is automatically asserted.
Summary of Contents for Am186 CC
Page 1: ...Am186 CC CH CU Microcontrollers User s Manual Order 21914B...
Page 4: ...iv Am186 CC CH CU Microcontrollers User s Manual...
Page 18: ...Table of Contents xviii Am186 CC CH CU Microcontrollers User s Manual...
Page 24: ...Introduction xxiv Am186 CC CH CU Microcontrollers User s Manual...
Page 40: ...Architectural Overview 1 16 Am186 CC CH CU Microcontrollers User s Manual...
Page 86: ...System Overview 3 36 Am186 CC CH CU Microcontrollers User s Manual...
Page 92: ...Emulator Support 4 6 Am186 CC CH CU Microcontrollers User s Manual...
Page 112: ...DRAM Controller 6 8 Am186 CC CH CU Microcontrollers User s Manual...
Page 134: ...Interrupts 7 22 Am186 CC CH CU Microcontrollers User s Manual...
Page 186: ...Programmable I O Signals 9 8 Am186 CC CH CU Microcontrollers User s Manual...
Page 200: ...Watchdog Timer 11 6 Am186 CC CH CU Microcontrollers User s Manual...
Page 232: ...Asynchronous Serial Ports UARTs 13 24 Am186 CC CH CU Microcontrollers User s Manual...
Page 242: ...Synchronous Serial Port SSI 14 10 Am186 CC CH CU Microcontrollers User s Manual...
Page 264: ...High Level Data Link Control HDLC 15 22 Am186 CC CH CU Microcontrollers User s Manual...
Page 332: ...Universal Serial Bus USB 18 34 Am186 CC CH CU Microcontrollers User s Manual...
Page 348: ...Register Summary A 16 Am186 CC CH CU Microcontrollers User s Manual...
Page 376: ...Index Index 18 Am186 CC CH CU Microcontrollers User s Manual...