dma.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * linux/include/asm-arm/mach/dma.h
  3. *
  4. * Copyright (C) 1998-2000 Russell King
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This header file describes the interface between the generic DMA handler
  11. * (dma.c) and the architecture-specific DMA backends (dma-*.c)
  12. */
  13. struct dma_struct;
  14. typedef struct dma_struct dma_t;
  15. struct dma_ops {
  16. int (*request)(dmach_t, dma_t *); /* optional */
  17. void (*free)(dmach_t, dma_t *); /* optional */
  18. void (*enable)(dmach_t, dma_t *); /* mandatory */
  19. void (*disable)(dmach_t, dma_t *); /* mandatory */
  20. int (*residue)(dmach_t, dma_t *); /* optional */
  21. int (*setspeed)(dmach_t, dma_t *, int); /* optional */
  22. char *type;
  23. };
  24. struct dma_struct {
  25. struct scatterlist buf; /* single DMA */
  26. int sgcount; /* number of DMA SG */
  27. struct scatterlist *sg; /* DMA Scatter-Gather List */
  28. unsigned int active:1; /* Transfer active */
  29. unsigned int invalid:1; /* Address/Count changed */
  30. unsigned int using_sg:1; /* using scatter list? */
  31. dmamode_t dma_mode; /* DMA mode */
  32. int speed; /* DMA speed */
  33. unsigned int lock; /* Device is allocated */
  34. const char *device_id; /* Device name */
  35. unsigned int dma_base; /* Controller base address */
  36. int dma_irq; /* Controller IRQ */
  37. struct scatterlist cur_sg; /* Current controller buffer */
  38. unsigned int state;
  39. struct dma_ops *d_ops;
  40. };
  41. /* Prototype: void arch_dma_init(dma)
  42. * Purpose : Initialise architecture specific DMA
  43. * Params : dma - pointer to array of DMA structures
  44. */
  45. extern void arch_dma_init(dma_t *dma);
  46. extern void isa_init_dma(dma_t *dma);