dma.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* arch/arm/plat-samsung/include/plat/dma.h
  2. *
  3. * Copyright (C) 2003-2006 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * Samsung S3C DMA support
  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. #include <linux/dma-mapping.h>
  13. enum s3c2410_dma_buffresult {
  14. S3C2410_RES_OK,
  15. S3C2410_RES_ERR,
  16. S3C2410_RES_ABORT
  17. };
  18. /* enum s3c2410_chan_op
  19. *
  20. * operation codes passed to the DMA code by the user, and also used
  21. * to inform the current channel owner of any changes to the system state
  22. */
  23. enum s3c2410_chan_op {
  24. S3C2410_DMAOP_START,
  25. S3C2410_DMAOP_STOP,
  26. S3C2410_DMAOP_PAUSE,
  27. S3C2410_DMAOP_RESUME,
  28. S3C2410_DMAOP_FLUSH,
  29. S3C2410_DMAOP_TIMEOUT, /* internal signal to handler */
  30. S3C2410_DMAOP_STARTED, /* indicate channel started */
  31. };
  32. struct s3c2410_dma_client {
  33. char *name;
  34. };
  35. struct s3c2410_dma_chan;
  36. enum dma_ch;
  37. /* s3c2410_dma_cbfn_t
  38. *
  39. * buffer callback routine type
  40. */
  41. typedef void (*s3c2410_dma_cbfn_t)(struct s3c2410_dma_chan *,
  42. void *buf, int size,
  43. enum s3c2410_dma_buffresult result);
  44. typedef int (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *,
  45. enum s3c2410_chan_op );
  46. /* s3c2410_dma_request
  47. *
  48. * request a dma channel exclusivley
  49. */
  50. extern int s3c2410_dma_request(enum dma_ch channel,
  51. struct s3c2410_dma_client *, void *dev);
  52. /* s3c2410_dma_ctrl
  53. *
  54. * change the state of the dma channel
  55. */
  56. extern int s3c2410_dma_ctrl(enum dma_ch channel, enum s3c2410_chan_op op);
  57. /* s3c2410_dma_setflags
  58. *
  59. * set the channel's flags to a given state
  60. */
  61. extern int s3c2410_dma_setflags(enum dma_ch channel,
  62. unsigned int flags);
  63. /* s3c2410_dma_free
  64. *
  65. * free the dma channel (will also abort any outstanding operations)
  66. */
  67. extern int s3c2410_dma_free(enum dma_ch channel, struct s3c2410_dma_client *);
  68. /* s3c2410_dma_enqueue
  69. *
  70. * place the given buffer onto the queue of operations for the channel.
  71. * The buffer must be allocated from dma coherent memory, or the Dcache/WB
  72. * drained before the buffer is given to the DMA system.
  73. */
  74. extern int s3c2410_dma_enqueue(enum dma_ch channel, void *id,
  75. dma_addr_t data, int size);
  76. /* s3c2410_dma_config
  77. *
  78. * configure the dma channel
  79. */
  80. extern int s3c2410_dma_config(enum dma_ch channel, int xferunit);
  81. /* s3c2410_dma_devconfig
  82. *
  83. * configure the device we're talking to
  84. */
  85. extern int s3c2410_dma_devconfig(enum dma_ch channel,
  86. enum dma_data_direction source, unsigned long devaddr);
  87. /* s3c2410_dma_getposition
  88. *
  89. * get the position that the dma transfer is currently at
  90. */
  91. extern int s3c2410_dma_getposition(enum dma_ch channel,
  92. dma_addr_t *src, dma_addr_t *dest);
  93. extern int s3c2410_dma_set_opfn(enum dma_ch, s3c2410_dma_opfn_t rtn);
  94. extern int s3c2410_dma_set_buffdone_fn(enum dma_ch, s3c2410_dma_cbfn_t rtn);
  95. #include <plat/dma-ops.h>