LSI Logic Confidential
15-12
Serial I/O Port
Copyright © 2001, 2002 by LSI Logic Corporation. All rights reserved.
15.2.4 SPI Transfer: Host-Polled Mode
In Host-Polled Mode, all read/write data for the SPI cycle is handled by
updates of the SPI_TEMP register: either the external host, SPARC
processor, or the DMA Engine can update this register.
In non-DMA mode, as the cycle progresses, the host polls for a set
HAEN (Host Access Enable) bit indicating that the SPI_TEMP register is
ready to be read/write updated. A host write SPI_TEMP clears the HAEN
bit, indicating to the SPI module that the host has updated SPI_TEMP
by either reading the current read data or by writing the next write data.
If HAEN is set after the contents of SPI_TEMP are transferred, the SPI
cycle will stall until HAEN becomes clear. If the DMA Engine is being
used, no polling is necessary, as the DMA Engine automatically takes
care of reading and writing the SPI_TEMP register when needed.
15.2.5 SPI Programming Examples
Typical SPI programming sequences for both DMA and non-DMA
operation are listed below. For this example, assume a transfer of 16
bytes out and a receive of 16 bytes in over the SPI pins. For DMA,
assume that TX data comes from an allocated SDRAM buffer starting at
0x8000, and that RX data is placed in an allocated SDRAM buffer
starting at 0x9000.
1.
Wait until the ENAB bit is cleared, indicating that no current SPI cycle
is running.
Note:
The SPI_CONFIG register values must not be changed
mid-cycle as the values in this register are read while the
cycle is running.
2.
If the module isn’t configured already, configure it as follows:
a.
In the SPI_CONFIG register, configure the SPI cycle
characteristics (polarity, SPI_CS[n] setup/hold, inter-byte
blanking, and so forth) and clear bits [15:14] of the SPI_CONFIG
register.
b.
Set the desired SPI_CLK speed by programming the divider
(HDIV, SPED).