dma.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * arch/arm/include/asm/mach/dma.h
  4. *
  5. * Copyright (C) 1998-2000 Russell King
  6. *
  7. * This header file describes the interface between the generic DMA handler
  8. * (dma.c) and the architecture-specific DMA backends (dma-*.c)
  9. */
  10. struct dma_struct;
  11. typedef struct dma_struct dma_t;
  12. struct dma_ops {
  13. int (*request)(unsigned int, dma_t *); /* optional */
  14. void (*free)(unsigned int, dma_t *); /* optional */
  15. void (*enable)(unsigned int, dma_t *); /* mandatory */
  16. void (*disable)(unsigned int, dma_t *); /* mandatory */
  17. int (*residue)(unsigned int, dma_t *); /* optional */
  18. int (*setspeed)(unsigned int, dma_t *, int); /* optional */
  19. const char *type;
  20. };
  21. struct dma_struct {
  22. void *addr; /* single DMA address */
  23. unsigned long count; /* single DMA size */
  24. struct scatterlist buf; /* single DMA */
  25. int sgcount; /* number of DMA SG */
  26. struct scatterlist *sg; /* DMA Scatter-Gather List */
  27. unsigned int active:1; /* Transfer active */
  28. unsigned int invalid:1; /* Address/Count changed */
  29. unsigned int dma_mode; /* DMA mode */
  30. int speed; /* DMA speed */
  31. unsigned int lock; /* Device is allocated */
  32. const char *device_id; /* Device name */
  33. const struct dma_ops *d_ops;
  34. };
  35. /*
  36. * isa_dma_add - add an ISA-style DMA channel
  37. */
  38. extern int isa_dma_add(unsigned int, dma_t *dma);