1 /* linux/arch/arm/plat-samsung/dma.c
3 * Copyright (c) 2003-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 struct s3c2410_dma_buf;
16 #include <linux/kernel.h>
17 #include <linux/module.h>
18 #include <linux/errno.h>
21 #include <mach/irqs.h>
23 /* dma channel state information */
24 struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS];
25 struct s3c2410_dma_chan *s3c_dma_chan_map[DMACH_MAX];
27 /* s3c_dma_lookup_channel
29 * change the dma channel number given into a real dma channel id
32 struct s3c2410_dma_chan *s3c_dma_lookup_channel(unsigned int channel)
34 if (channel & DMACH_LOW_LEVEL)
35 return &s3c2410_chans[channel & ~DMACH_LOW_LEVEL];
37 return s3c_dma_chan_map[channel];
40 /* do we need to protect the settings of the fields from
44 int s3c2410_dma_set_opfn(unsigned int channel, s3c2410_dma_opfn_t rtn)
46 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
51 pr_debug("%s: chan=%p, op rtn=%p\n", __func__, chan, rtn);
57 EXPORT_SYMBOL(s3c2410_dma_set_opfn);
59 int s3c2410_dma_set_buffdone_fn(unsigned int channel, s3c2410_dma_cbfn_t rtn)
61 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
66 pr_debug("%s: chan=%p, callback rtn=%p\n", __func__, chan, rtn);
68 chan->callback_fn = rtn;
72 EXPORT_SYMBOL(s3c2410_dma_set_buffdone_fn);
74 int s3c2410_dma_setflags(unsigned int channel, unsigned int flags)
76 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
84 EXPORT_SYMBOL(s3c2410_dma_setflags);