dmacopy.c 909 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* $Id: dmacopy.c,v 1.1 2001/12/17 13:59:27 bjornw Exp $
  2. *
  3. * memcpy for large blocks, using memory-memory DMA channels 6 and 7 in Etrax
  4. */
  5. #include <asm/svinto.h>
  6. #include <asm/io.h>
  7. #define D(x)
  8. void *dma_memcpy(void *pdst,
  9. const void *psrc,
  10. unsigned int pn)
  11. {
  12. static etrax_dma_descr indma, outdma;
  13. D(printk("dma_memcpy %d bytes... ", pn));
  14. #if 0
  15. *R_GEN_CONFIG = genconfig_shadow =
  16. (genconfig_shadow & ~0x3c0000) |
  17. IO_STATE(R_GEN_CONFIG, dma6, intdma7) |
  18. IO_STATE(R_GEN_CONFIG, dma7, intdma6);
  19. #endif
  20. indma.sw_len = outdma.sw_len = pn;
  21. indma.ctrl = d_eol | d_eop;
  22. outdma.ctrl = d_eol;
  23. indma.buf = psrc;
  24. outdma.buf = pdst;
  25. *R_DMA_CH6_FIRST = &indma;
  26. *R_DMA_CH7_FIRST = &outdma;
  27. *R_DMA_CH6_CMD = IO_STATE(R_DMA_CH6_CMD, cmd, start);
  28. *R_DMA_CH7_CMD = IO_STATE(R_DMA_CH7_CMD, cmd, start);
  29. while(*R_DMA_CH7_CMD == 1) /* wait for completion */ ;
  30. D(printk("done\n"));
  31. }