dma.h 2.9 KB

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