altos: More SPI slave changes for cc1111 driver
authorKeith Packard <keithp@keithp.com>
Mon, 27 Aug 2012 20:37:14 +0000 (13:37 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 27 Aug 2012 20:37:14 +0000 (13:37 -0700)
Don't enable DMA in the other direction when doing slave transfers.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/cc1111/ao_spi.c

index e7480fd78e1011c70f5f74db0a96a608c4a57334..2b4fd186aa843b0435100d985aece4a9b3365dd7 100644 (file)
@@ -204,6 +204,7 @@ ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant
 
        ao_spi_const = SPI_CONST;
 
+#if !AO_SPI_SLAVE
        ao_dma_set_transfer(ao_spi_dma_out_id,
                            &ao_spi_const,
                            &SPI_BUF,
@@ -214,10 +215,13 @@ ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant
                            DMA_CFG1_SRCINC_0 |
                            DMA_CFG1_DESTINC_0 |
                            DMA_CFG1_PRIORITY_NORMAL);
+#endif
 
        ao_dma_start(ao_spi_dma_in_id);
+#if !AO_SPI_SLAVE
        ao_dma_start(ao_spi_dma_out_id);
        ao_dma_trigger(ao_spi_dma_out_id);
+#endif
        __critical while (!ao_spi_dma_in_done)
                ao_sleep(&ao_spi_dma_in_done);
 }