GR740-UM-DS, Nov 2017, Version 1.7
156
www.cobham.com/gaisler
GR740
13.4.4 Receiver DMA channels
The receiver DMA engine handles reception of data from the SpaceWire network to different DMA
channels.
13.4.4.1 Address comparison and channel selection
Packets are received to different channels based on the address and whether a channel is enabled or
not. When the receiver N-Char FIFO contains one or more characters, N-Chars are read by the
receiver DMA engine. The first character is interpreted as the logical address and is compared with
the addresses of each channel starting from 0. The packet will be stored to the first channel with an
matching address. The complete packet including address and protocol ID but excluding EOP/EEP is
stored to the memory address pointed to by the descriptors (explained later in this section) of the
channel.
Each SpaceWire address register has a corresponding mask register. Only bits at an index containing a
zero in the corresponding mask register are compared. This way a DMA channel can accept a range of
addresses. There is a default address register which is used for address checking in all implemented
DMA channels that do not have separate addressing enabled and for RMAP commands in the RMAP
target. With separate addressing enabled the DMA channels’ own address/mask register pair is used
instead.
If an RMAP command is received, it is only handled by the target if the default address register
(including mask) matches the received address. Otherwise, the packet will be stored to a DMA chan-
nel if one or more of them has a matching address. If the address does neither match the default
address nor one of the DMA channels’ separate registers, the packet is still handled by the RMAP tar-
get if enabled since it has to return the invalid address error code. The packet is only discarded (up to
and including the next EOP/EEP) if an address cannot be matched and the RMAP target is disabled.
Packets other than RMAP commands that neither match the default address register nor the DMA
channels’ address register will be discarded. Figure 15 shows a flowchart of the packet reception.
At least 2 non EOP/EEP N-Chars needs to be received for a packet to be stored to the DMA channel
unless the promiscuous mode is enabled in which case 1 N-Char is enough. If it is an RMAP packet
with hardware RMAP enabled, 3 N-Chars are needed since the command byte determines where the
packet is processed. Packets smaller than these sizes are discarded.
13.4.4.2 Basic functionality of a channel
Reception is based on descriptors located in a consecutive area in memory that hold pointers to buf-
fers where packets should be stored. When a packet arrives at the port, the destined channel is first
determined as described in the previous section. A descriptor is then read from the descriptor area of
the channel and the packet is stored to the memory area the descriptor is pointing to. Lastly, status
information is stored to the same descriptor and the descriptor pointer is incremented by one. The fol-
lowing sections describe the DMA channel reception in more detail.
13.4.4.3 Setting up the port for reception
A few registers need to be initialized before reception to a channel can take place. The DMA channel
has a maximum length register, which sets the maximum packet size in bytes that can be received to
this channel. Larger packets are truncated and the excessive part is spilled. If this happens, an indica-
tion will be given in the status field of the descriptor. The minimum value for the receiver maximum
length field is 4 and the value can only be incremented in steps of four bytes up to the maximum value
of 33554428. If the maximum length is set to zero the receiver will
not
function correctly.
Either the default address register or the channel specific address register (the corresponding mask
register must also be set) needs to be set to hold the address used by the channel. A control bit in the
DMA channel control register determines whether the channel should use default address and mask
registers for address comparison or the channel’s own registers. Using the default register, the same