dma.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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)(unsigned int, dma_t *); /* optional */
  17. void (*free)(unsigned int, dma_t *); /* optional */
  18. void (*enable)(unsigned int, dma_t *); /* mandatory */
  19. void (*disable)(unsigned int, dma_t *); /* mandatory */
  20. int (*residue)(unsigned int, dma_t *); /* optional */
  21. int (*setspeed)(unsigned int, dma_t *, int); /* optional */
  22. const 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. unsigned int dma_mode; /* DMA mode */
  33. int speed; /* DMA speed */
  34. unsigned int lock; /* Device is allocated */
  35. const char *device_id; /* Device name */
  36. const struct dma_ops *d_ops;
  37. };
  38. /*
  39. * isa_dma_add - add an ISA-style DMA channel
  40. */
  41. extern int isa_dma_add(unsigned int, dma_t *dma);
  42. /*
  43. * Add the ISA DMA controller. Always takes channels 0-7.
  44. */
  45. extern void isa_init_dma(void);