#ifndef __ASM_ARM_DMA_H1#define __ASM_ARM_DMA_H23#include <asm/memory.h>45/*6* This is the maximum virtual address which can be DMA'd from.7*/8#ifndef ARM_DMA_ZONE_SIZE9#define MAX_DMA_ADDRESS 0xffffffff10#else11#define MAX_DMA_ADDRESS (PAGE_OFFSET + ARM_DMA_ZONE_SIZE)12#endif1314#ifdef CONFIG_ISA_DMA_API15/*16* This is used to support drivers written for the x86 ISA DMA API.17* It should not be re-used except for that purpose.18*/19#include <linux/spinlock.h>20#include <asm/system.h>21#include <asm/scatterlist.h>2223#include <mach/isa-dma.h>2425/*26* The DMA modes reflect the settings for the ISA DMA controller27*/28#define DMA_MODE_MASK 0xcc2930#define DMA_MODE_READ 0x4431#define DMA_MODE_WRITE 0x4832#define DMA_MODE_CASCADE 0xc033#define DMA_AUTOINIT 0x103435extern spinlock_t dma_spin_lock;3637static inline unsigned long claim_dma_lock(void)38{39unsigned long flags;40spin_lock_irqsave(&dma_spin_lock, flags);41return flags;42}4344static inline void release_dma_lock(unsigned long flags)45{46spin_unlock_irqrestore(&dma_spin_lock, flags);47}4849/* Clear the 'DMA Pointer Flip Flop'.50* Write 0 for LSB/MSB, 1 for MSB/LSB access.51*/52#define clear_dma_ff(chan)5354/* Set only the page register bits of the transfer address.55*56* NOTE: This is an architecture specific function, and should57* be hidden from the drivers58*/59extern void set_dma_page(unsigned int chan, char pagenr);6061/* Request a DMA channel62*63* Some architectures may need to do allocate an interrupt64*/65extern int request_dma(unsigned int chan, const char * device_id);6667/* Free a DMA channel68*69* Some architectures may need to do free an interrupt70*/71extern void free_dma(unsigned int chan);7273/* Enable DMA for this channel74*75* On some architectures, this may have other side effects like76* enabling an interrupt and setting the DMA registers.77*/78extern void enable_dma(unsigned int chan);7980/* Disable DMA for this channel81*82* On some architectures, this may have other side effects like83* disabling an interrupt or whatever.84*/85extern void disable_dma(unsigned int chan);8687/* Test whether the specified channel has an active DMA transfer88*/89extern int dma_channel_active(unsigned int chan);9091/* Set the DMA scatter gather list for this channel92*93* This should not be called if a DMA channel is enabled,94* especially since some DMA architectures don't update the95* DMA address immediately, but defer it to the enable_dma().96*/97extern void set_dma_sg(unsigned int chan, struct scatterlist *sg, int nr_sg);9899/* Set the DMA address for this channel100*101* This should not be called if a DMA channel is enabled,102* especially since some DMA architectures don't update the103* DMA address immediately, but defer it to the enable_dma().104*/105extern void __set_dma_addr(unsigned int chan, void *addr);106#define set_dma_addr(chan, addr) \107__set_dma_addr(chan, bus_to_virt(addr))108109/* Set the DMA byte count for this channel110*111* This should not be called if a DMA channel is enabled,112* especially since some DMA architectures don't update the113* DMA count immediately, but defer it to the enable_dma().114*/115extern void set_dma_count(unsigned int chan, unsigned long count);116117/* Set the transfer direction for this channel118*119* This should not be called if a DMA channel is enabled,120* especially since some DMA architectures don't update the121* DMA transfer direction immediately, but defer it to the122* enable_dma().123*/124extern void set_dma_mode(unsigned int chan, unsigned int mode);125126/* Set the transfer speed for this channel127*/128extern void set_dma_speed(unsigned int chan, int cycle_ns);129130/* Get DMA residue count. After a DMA transfer, this131* should return zero. Reading this while a DMA transfer is132* still in progress will return unpredictable results.133* If called before the channel has been used, it may return 1.134* Otherwise, it returns the number of _bytes_ left to transfer.135*/136extern int get_dma_residue(unsigned int chan);137138#ifndef NO_DMA139#define NO_DMA 255140#endif141142#endif /* CONFIG_ISA_DMA_API */143144#ifdef CONFIG_PCI145extern int isa_dma_bridge_buggy;146#else147#define isa_dma_bridge_buggy (0)148#endif149150#endif /* __ASM_ARM_DMA_H */151152153