dma.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * linux/include/asm-arm/arch-pxa/dma.h
  3. *
  4. * Author: Nicolas Pitre
  5. * Created: Jun 15, 2001
  6. * Copyright: MontaVista Software, Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __ASM_ARCH_DMA_H
  13. #define __ASM_ARCH_DMA_H
  14. /*
  15. * Descriptor structure for PXA's DMA engine
  16. * Note: this structure must always be aligned to a 16-byte boundary.
  17. */
  18. typedef struct pxa_dma_desc {
  19. volatile u32 ddadr; /* Points to the next descriptor + flags */
  20. volatile u32 dsadr; /* DSADR value for the current transfer */
  21. volatile u32 dtadr; /* DTADR value for the current transfer */
  22. volatile u32 dcmd; /* DCMD value for the current transfer */
  23. } pxa_dma_desc;
  24. typedef enum {
  25. DMA_PRIO_HIGH = 0,
  26. DMA_PRIO_MEDIUM = 1,
  27. DMA_PRIO_LOW = 2
  28. } pxa_dma_prio;
  29. #if defined(CONFIG_PXA27x)
  30. #define PXA_DMA_CHANNELS 32
  31. #define pxa_for_each_dma_prio(ch, prio) \
  32. for ( \
  33. ch = prio * 4; \
  34. ch != (4 << prio) + 16; \
  35. ch = (ch + 1 == (4 << prio)) ? (prio * 4 + 16) : (ch + 1) \
  36. )
  37. #elif defined(CONFIG_PXA25x)
  38. #define PXA_DMA_CHANNELS 16
  39. #define pxa_for_each_dma_prio(ch, prio) \
  40. for (ch = prio * 4; ch != (4 << prio); ch++)
  41. #endif
  42. /*
  43. * DMA registration
  44. */
  45. int pxa_request_dma (char *name,
  46. pxa_dma_prio prio,
  47. void (*irq_handler)(int, void *),
  48. void *data);
  49. void pxa_free_dma (int dma_ch);
  50. #endif /* _ASM_ARCH_DMA_H */