-static uint8_t tx_fifo_buffer[CONFIG_SPI_DMA_TXBUFSIZE];
-static FIFOBuffer tx_fifo;
-static KFileFifo kfifo;
-
-
-INLINE void spi_dma_startTx(void)
-{
- if (fifo_isempty(&tx_fifo))
- return;
-
- if (SPI0_SR & BV(SPI_TXBUFE))
- {
- SPI0_PTCR = BV(PDC_TXTDIS);
- SPI0_TPR = (reg32_t)tx_fifo.head;
- if (tx_fifo.head < tx_fifo.tail)
- SPI0_TCR = tx_fifo.tail - tx_fifo.head;
- else
- SPI0_TCR = tx_fifo.end - tx_fifo.head + 1;
-
- SPI0_PTCR = BV(PDC_TXTEN);
- }
-}
-
-static void spi0_dma_write_irq_handler(void) __attribute__ ((interrupt));
-static void spi0_dma_write_irq_handler(void)
-{
- SPI_DMA_STROBE_ON();
- /* Pop sent chars from FIFO */
- tx_fifo.head = (uint8_t *)SPI0_TPR;
- if (tx_fifo.head > tx_fifo.end)
- tx_fifo.head = tx_fifo.begin;
-
- spi_dma_startTx();
-
- AIC_EOICR = 0;
- SPI_DMA_STROBE_OFF();
-}
-