1 /* arch/arm/plat-samsung/include/plat/dma.h
3 * Copyright (C) 2003-2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * Samsung S3C DMA support
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.
13 #include <linux/dma-mapping.h>
15 enum s3c2410_dma_buffresult {
21 /* enum s3c2410_chan_op
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
27 enum s3c2410_chan_op {
33 S3C2410_DMAOP_TIMEOUT, /* internal signal to handler */
34 S3C2410_DMAOP_STARTED, /* indicate channel started */
37 struct s3c2410_dma_client {
41 struct s3c2410_dma_chan;
46 * buffer callback routine type
49 typedef void (*s3c2410_dma_cbfn_t)(struct s3c2410_dma_chan *,
51 enum s3c2410_dma_buffresult result);
53 typedef int (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *,
54 enum s3c2410_chan_op );
58 /* s3c2410_dma_request
60 * request a dma channel exclusivley
63 extern int s3c2410_dma_request(enum dma_ch channel,
64 struct s3c2410_dma_client *, void *dev);
69 * change the state of the dma channel
72 extern int s3c2410_dma_ctrl(enum dma_ch channel, enum s3c2410_chan_op op);
74 /* s3c2410_dma_setflags
76 * set the channel's flags to a given state
79 extern int s3c2410_dma_setflags(enum dma_ch channel,
84 * free the dma channel (will also abort any outstanding operations)
87 extern int s3c2410_dma_free(enum dma_ch channel, struct s3c2410_dma_client *);
89 /* s3c2410_dma_enqueue
91 * place the given buffer onto the queue of operations for the channel.
92 * The buffer must be allocated from dma coherent memory, or the Dcache/WB
93 * drained before the buffer is given to the DMA system.
96 extern int s3c2410_dma_enqueue(enum dma_ch channel, void *id,
97 dma_addr_t data, int size);
101 * configure the dma channel
104 extern int s3c2410_dma_config(enum dma_ch channel, int xferunit);
106 /* s3c2410_dma_devconfig
108 * configure the device we're talking to
111 extern int s3c2410_dma_devconfig(enum dma_ch channel,
112 enum dma_data_direction source, unsigned long devaddr);
114 /* s3c2410_dma_getposition
116 * get the position that the dma transfer is currently at
119 extern int s3c2410_dma_getposition(enum dma_ch channel,
120 dma_addr_t *src, dma_addr_t *dest);
122 extern int s3c2410_dma_set_opfn(enum dma_ch, s3c2410_dma_opfn_t rtn);
123 extern int s3c2410_dma_set_buffdone_fn(enum dma_ch, s3c2410_dma_cbfn_t rtn);
126 #include <plat/dma-ops.h>