dma.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * arch/arm/include/asm/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. void *addr; /* single DMA address */
  26. unsigned long count; /* single DMA size */
  27. struct scatterlist buf; /* single DMA */
  28. int sgcount; /* number of DMA SG */
  29. struct scatterlist *sg; /* DMA Scatter-Gather List */
  30. unsigned int active:1; /* Transfer active */
  31. unsigned int invalid:1; /* Address/Count changed */
  32. dmamode_t dma_mode; /* DMA mode */
  33. int speed; /* DMA speed */
  34. unsigned int lock; /* Device is allocated */
  35. const char *device_id; /* Device name */
  36. unsigned int dma_base; /* Controller base address */
  37. int dma_irq; /* Controller IRQ */
  38. struct scatterlist cur_sg; /* Current controller buffer */
  39. unsigned int state;
  40. struct dma_ops *d_ops;
  41. };
  42. /* Prototype: void arch_dma_init(dma)
  43. * Purpose : Initialise architecture specific DMA
  44. * Params : dma - pointer to array of DMA structures
  45. */
  46. extern void arch_dma_init(dma_t *dma);
  47. extern void isa_init_dma(dma_t *dma);