4 * Copyright (C) 2003 Paul Mundt
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
10 #ifndef __ASM_SH_DMA_H
11 #define __ASM_SH_DMA_H
13 #include <linux/config.h>
14 #include <linux/spinlock.h>
15 #include <linux/wait.h>
16 #include <asm/cpu/dma.h>
17 #include <asm/semaphore.h>
19 /* The maximum address that we can perform a DMA transfer to on this platform */
20 /* Don't define MAX_DMA_ADDRESS; it's useless on the SuperH and any
21 occurrence should be flagged as an error. */
23 /* XXX: This is not applicable to SuperH, just needed for alloc_bootmem */
24 #define MAX_DMA_ADDRESS (PAGE_OFFSET+0x10000000)
26 #ifdef CONFIG_NR_DMA_CHANNELS
27 # define MAX_DMA_CHANNELS (CONFIG_NR_DMA_CHANNELS)
29 # define MAX_DMA_CHANNELS (CONFIG_NR_ONCHIP_DMA_CHANNELS)
33 * Read and write modes can mean drastically different things depending on the
34 * channel configuration. Consult your DMAC documentation and module
35 * implementation for further clues.
37 #define DMA_MODE_READ 0x00
38 #define DMA_MODE_WRITE 0x01
39 #define DMA_MODE_MASK 0x01
41 extern spinlock_t dma_spin_lock;
48 int (*request)(struct dma_info *info);
49 void (*free)(struct dma_info *info);
51 int (*get_residue)(struct dma_info *info);
52 int (*xfer)(struct dma_info *info);
53 void (*configure)(struct dma_info *info, unsigned long flags);
66 unsigned int configured:1;
67 unsigned int tei_capable:1;
71 wait_queue_head_t wait_queue;
75 /* arch/sh/drivers/dma/dma-api.c */
76 extern int dma_xfer(unsigned int chan, unsigned long from,
77 unsigned long to, size_t size, unsigned int mode);
79 #define dma_write(chan, from, to, size) \
80 dma_xfer(chan, from, to, size, DMA_MODE_WRITE)
81 #define dma_write_page(chan, from, to) \
82 dma_write(chan, from, to, PAGE_SIZE)
84 #define dma_read(chan, from, to, size) \
85 dma_xfer(chan, from, to, size, DMA_MODE_READ)
86 #define dma_read_page(chan, from, to) \
87 dma_read(chan, from, to, PAGE_SIZE)
89 extern int request_dma(unsigned int chan, const char *dev_id);
90 extern void free_dma(unsigned int chan);
91 extern int get_dma_residue(unsigned int chan);
92 extern struct dma_info *get_dma_info(unsigned int chan);
93 extern void dma_wait_for_completion(unsigned int chan);
94 extern void dma_configure_channel(unsigned int chan, unsigned long flags);
96 extern int register_dmac(struct dma_ops *ops);
98 extern struct dma_info dma_info[];
101 extern int isa_dma_bridge_buggy;
103 #define isa_dma_bridge_buggy (0)
106 #endif /* __ASM_SH_DMA_H */