5.1 Dma Operation 5.1.1 The Overall Architecture and Operation
5.1 Dma Operation 5.1.1 The Overall Architecture and Operation
5 DMA
The ETRAX 100 DMA provides a high data transfer rate to and from the internal
peripheral interfaces, or from one location in the external memory to another. The
DMA consists of ten DMA channels, five in each direction. The ten DMA
channels are served by a DMA controller which takes care of the data flow between
the channels and the external memory.
FIFO FIFO
ETRAX 100
PI Ch 1 Ch 0 PI
FIFO FIFO
PI Ch 5 Ch 4 PI
FIFO FIFO
Cache
PI Ch 7 Ch 6 PI
PI Ch 9 Ch 8 PI
PI = Perihperal Interface
External memory
There are only a limited number of combinations in which the ten channels of the
DMA can be used for interconnection between the internal peripheral interfaces.
The reason for this is that some of the internal peripheral interfaces are
multiplexed on the same package pins. The figure 5-2 and the figure Figure 5-3 on
page 48 show how each peripheral interface are multiplexed on the DMA
channels.
Perihperal interface
FIFO
Network Ch 1
ETRAX 100
Parallel 0 FIFO
SCSI 0 M
U Ch 3
Serial 2 X
ATA
Parallel 1 FIFO
SCSI 1 M M DMA
U Ch 5 U controller
Serial 3 X X
Extern DMA 0
Serial 0 FIFO
M
Extern DMA 1 U Ch 7
[Loopback] X
DMA Cache
arbiter
Serial 1 Ch 9
Ch 0 Network
ETRAX 100
FIFO Parallel 0
M SCSI 0
Ch 2 U
X Serial 2
ATA
FIFO Parallel 1
DMA M M SCSI 1
controller U Ch 4 U
X X Serial 3
Extern DMA 0
FIFO Serial 0
M
Ch 6 U Extern DMA 1
X [Loopback]
Cache DMA
arbiter
Ch 8 Serial 1
DMA FIFO
I/O system(s) available Direction
channel buffer
0 Network out 64 bytes
1 Network in 64 bytes
2 Parallel 0 SCSI0 Serial 2 EIDE/ATA-2 out 64 bytes
3 Parallel 0 SCSI0 Serial 2 EIDE/ATA-2 in 64 bytes
4 Parallel 1 SCSI1 Serial 3 DMA0, see note 1 out 64 bytes
5 Parallel 1 SCSI1 Serial 3 DMA0, see note 1 in 64 bytes
6 Serial 0 DMA1, see note 1 Memory transfer, see note 2 out 64 bytes
7 Serial 0 DMA1, see note 1 Memory transfer, see note 2 in 64 bytes
8 Serial 1 out none
9 Serial 1 in none
Table 5-1
Note 1: DMA0 and DMA1 are external DMA channels to be used between the external memory and an
I/O device, see section 5.3 "External DMA Channels" on page 54.
Note 2: Memory-to-memory transfer. Channel 6 to channel 7 can be set for immediate connection and
thus providing an efficient way of transferring data from one memory location to another.
The ETRAX 100 DMA stores data in the external memory in small buffers linked
together with the use of a list descriptor. Each list descriptor contains a number of
data fields which tells the DMA controller where to find next buffer in the list and
how large it is.
Receive list
Data
buffers
Transmit list
Data
buffers
There are a set of DMA registers, one set for each channel, which the DMA
controller uses to handle the buffers, and to store information about the buffers in
the external memory. These registers and a little about of their functions are shown
in figure 5-5.
DMA_NEXT
DMA_DESR
Descriptor
DMA_FIRST Cmds SW Descriptor
SW
DMA_BUF
HW
Figure 5-5 DMA registers and the structure of the linked list
Figure 5-5 shows the DMA registers and a simplified linked list in the external
memory. When a DMA transfer is to start the DMA reads the linked list in the
memory (see section 5.1.5 "DMA descriptor" on page 51).
The DMA_FIRST register points to a command field (Cmds in figure 5-5) in the first
descriptor in the linked list. The DMA_DESCR register contains the address to the
current descriptor, and the DMA_NEXT contains the address to the next descriptor.
Three registers manage the actual storage of data in the buffers: DMA_BUF register is
a pointer to the next (byte) position in the buffer; the SW register gives the total
length (in bytes) of the buffer, and the HW register gives the number of bytes left in
the buffer.
The construction of a linked list is done by defining DMA descriptors. The DMA
descriptor consists of four 32-bit fields. The contents of a descriptor is shown in
figure 5-6 and table 5-2 on page 52.
*(addr + 0)
31 22 21 20 19 18 17 16 15 0
priority
wait
ecp
eop
intr
eol
reserved sw_len
*(addr + 4)
31 0
next
*(addr + 8)
31 0
buf
*(addr + 12)
31 30 24 23 22 21 20 19 18 17 16 15 0
reserved
reserved
align_err
reserved
crc_err
priority
stop
eop
fifo_len hw_len
Table 5-2 describes the contents of the DMA descriptor in more detail.
(addr + 4):
31-0 next Pointer to next descriptor in list (no alignment restrictions). If eol == 1
next is not used.
(addr + 8):
31-0 buf Pointer to first byte in data buffer (no alignment restrictions).
(addr + 12):
31 reserved Always set to zero when written by the DMA.
30-24 fifo_len If stop == 1; Number of bytes in FIFO. Output channels only.
23 crc_err If eop == 1; Received packet has CRC error, used by channel 1.
22 align_err If eop == 1; Received packet has alignment error, used by channel 1.
21 reserved
20 stop Output channel was stopped by I/O interface. Bit 20 and bit 17 are
mutually exclusive.
19-18 reserved Not read by DMA. Always set to zero when written.
17 eop Last descriptor in a received packet. Bit 20 and bit 17 are mutually
exclusive.
16 reserved Not read by DMA. Always set to zero when written.
15-0 hw_len If eop == 1; Number of bytes written to the data buffer.
If stop == 1; Number of bytes read from the data buffer.
Note: For compatibility with future versions of ETRAX processors, reserved fields must be set to 0 before
starting the DMA. When read no assumption can be made about their value.
There are two interrupts per channel: descriptor interrupt and end-of-packet
interrupt. Each channel has its own interrupt vector (for a list of all interrupt
vector numbers see section 14.2.1 "Overview of internally generated interrupt
vector numbers" on page 98), and each interrupt in a channel can be individually
enabled or disabled.
For output channels the interrupts are generated if the intr-bit (descriptor
interrupt) or eop-bit (end-of-packet interrupt) in the descriptor are set. The
interrupts are generated after the DMA has read all data from the associated data
buffer.
For input channels the descriptor interrupt is generated if the intr-bit is set in the
descriptor. The end-of-packet interrupt is generated when the peripheral interface
signals end-of-packet and the DMA has written all data to the associated data
buffer.
Enable, disable, read and clear interrupts are done in internal registers.
The external DMA channels DMA0 and DMA1 could be seen as an I/O interface
with a "pseudo DMA" operation. Its purpose is to provide a DMA-like interface
between the external memory and external I/O-devices, see figure 5-7.
Memory
Out FIFO
In FIFO
I/O
device
Burst mode
When burst mode is used for transferring data, the external I/O interface keeps the
request signal active during the whole burst and a read or write is performed each
time the acknowledge signal is active. When the acknowledge signal is not active
the data bus is available for other units.
dreq
last
cycle
dack
rd/wr
Handshake mode
When handshake mode is used, the address bus is used to address the external
interface (however, this could also be used in burst mode), and the address is set in
an internal register. The two most significant bits of the address are always set to
10 (binary), so as not to access the internal cache memory or the DRAM (see
section 3.2 "Address and Chip Selects" on page 30):
31 30 29 2 1 0
1 0 External interface address 0 0
dreq
dack
rd/wr
Transfer counter
There is also an internal counter register which can be used to transmit a certain
number of data transfers. This is done by setting the counter to a value equal to the
desired number of transfers and starting the transfer. The transfer will end when
the counter has reached zero.