Programming Examples
10-52
ADSP-BF537 Blackfin Processor Hardware Reference
completed,
SPI_STAT
is polled to determine when the transmit buffer is
empty. If there is data in the SPI Transmit FIFO, it is loaded as soon as
the
TXS
bit clears. A second consecutive read with the
TXS
bit clear indi-
cates the FIFO is empty and the last word is in the shift register. Finally,
polling for the
SPIF
bit determines when the last bit of the last word has
been shifted out. At that point, it is safe to shut down the SPI port and the
DMA engine.
Listing 10-8. Stopping a Transfer
SPI_DMA_INTERRUPT_HANDLER:
P0.L = lo(DMA7_IRQ_STATUS);
P0.H = hi(DMA7_IRQ_STATUS);
R0 = 1 ;
W[P0] = R0 ;
/* Clear DMA interrupt */
/* Wait for DMA to complete */
P0.L = lo(DMA7_IRQ_STATUS);
P0.H = hi(DMA7_IRQ_STATUS);
R0 = DMA_RUN; /* 0x08 */
CHECK_DMA_COMPLETE:
/* Poll for DMA_RUN bit to clear */
R3 = W[P0] (Z);
R1 = R3 & R0;
CC = R1 == 0;
IF !CC JUMP CHECK_DMA_COMPLETE;
/* Wait for TXS to clear */
P0.L = lo(SPI_STAT);
P0.H = hi(SPI_STAT);
R1 = TXS; /* 0x08 */
Check_TXS:
/* Poll for TXS = 0 */
R2 = W[P0] (Z);
Summary of Contents for Blackfin ADSP-BF537
Page 42: ...Contents xlii ADSP BF537 Blackfin Processor Hardware Reference ...
Page 90: ...Development Tools 1 32 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 138: ...Programming Examples 4 26 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 340: ...SDC Programming Examples 6 84 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 606: ...Programming Examples 9 94 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 660: ...Programming Examples 10 54 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 720: ...Electrical Specifications 11 60 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 840: ...Programming Examples 13 42 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 876: ...Programming Examples 14 36 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 938: ...Programming Examples 15 62 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 958: ...Programming Examples 17 12 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 986: ...Programming Examples 18 28 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 1162: ...G 26 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 1218: ...Index I 56 ADSP BF537 Blackfin Processor Hardware Reference ...