LSI Logic Confidential
SIO SPI (Serial Peripheral Interface)
15-13
Copyright © 2001, 2002 by LSI Logic Corporation. All rights reserved.
c.
Set the CSSL[3:0] bits to select the SPI_CS[3:0] line to enable.
If desired, enable the SPI_cycle_done module interrupt in the
SIO top-level module interrupt registers.
d.
Set BSIZ to the desired number of bytes, minus one, to be
transferred. For this example, since the transfer is 16 bytes over
the SPI pins, 0xf is programmed into BSIZ.
3.
If the DMA engine is to be used, set up SDRAM and the appropriate
registers in both the SPI TX and RX channels. For this example, use
the following steps:
a.
Place the TX data in the following SDRAM address range:
[0x8000 - 0x8018]. This region would have 16 bytes of “real data”
(0x8000-0x8010) to be transferred and 8 bytes of dummy data
(0x8010-0x8018) which does not get sent out the SPI pins. The
8 bytes of dummy data are needed for the ENAB bit in the
SPI_CONTROL to deassert when the SPI cycle has completed.
b.
Set the TX and RX address pointers as follows:
TX_addrptr1=0x8004,
TX_addrptr2=0x8018
RX_addrptr1=0x9000
RX_addrptr2=0x9010. (The RX data region does not need the
eight extra bytes of dummy data.)
c.
Set the RX_control register to 0xd,
d.
Set the TX_control register to 0xd.
Note: If the number of bytes to be transferred over the pins
is not a multiple of four—that is, if SPI_SIZE % 4 != 0, and
the DMA Engine is used, the size of the receive buffer must
increased slightly, to the next multiple of four. For example,
to transfer 18 bytes, set SPI_SIZE to 17, but set the gap
between RX_addrptr1 and RX_addrptr2 to 20. (20 is next
multiple after 16).
4.
Write SPI_TEMP with the initial write data. If using DMA, this data is
present at @0x8000; the DMA engine will handle all remaining
updates of SPI_TEMP, starting from 0x8004. The order of the bytes
sent is always from most significant byte to least. The order of
sending the bits in each byte is controlled by the LSBF bit.