30 #ifndef __ASM_AU1000_DMA_H
31 #define __ASM_AU1000_DMA_H
37 #define NUM_AU1000_DMA_CHANNELS 8
40 #define DMA_MODE_SET 0x00000000
41 #define DMA_MODE_READ DMA_MODE_SET
42 #define DMA_MODE_CLEAR 0x00000004
44 #define DMA_DAH_MASK (0x0f << 20)
45 #define DMA_DID_BIT 16
46 #define DMA_DID_MASK (0x0f << DMA_DID_BIT)
47 #define DMA_DS (1 << 15)
48 #define DMA_BE (1 << 13)
49 #define DMA_DR (1 << 12)
50 #define DMA_TS8 (1 << 11)
52 #define DMA_DW_MASK (0x03 << DMA_DW_BIT)
53 #define DMA_DW8 (0 << DMA_DW_BIT)
54 #define DMA_DW16 (1 << DMA_DW_BIT)
55 #define DMA_DW32 (2 << DMA_DW_BIT)
56 #define DMA_NC (1 << 8)
57 #define DMA_IE (1 << 7)
58 #define DMA_HALT (1 << 6)
59 #define DMA_GO (1 << 5)
60 #define DMA_AB (1 << 4)
61 #define DMA_D1 (1 << 3)
62 #define DMA_BE1 (1 << 2)
63 #define DMA_D0 (1 << 1)
64 #define DMA_BE0 (1 << 0)
66 #define DMA_PERIPHERAL_ADDR 0x00000008
67 #define DMA_BUFFER0_START 0x0000000C
68 #define DMA_BUFFER1_START 0x00000014
69 #define DMA_BUFFER0_COUNT 0x00000010
70 #define DMA_BUFFER1_COUNT 0x00000018
71 #define DMA_BAH_BIT 16
72 #define DMA_BAH_MASK (0x0f << DMA_BAH_BIT)
73 #define DMA_COUNT_BIT 0
74 #define DMA_COUNT_MASK (0xffff << DMA_COUNT_BIT)
122 unsigned long irqflags,
130 static inline struct dma_chan *get_dma_chan(
unsigned int dmanr)
148 spin_unlock_irqrestore(&au1000_dma_spin_lock, flags);
154 static inline void enable_dma_buffer0(
unsigned int dmanr)
163 static inline void enable_dma_buffer1(
unsigned int dmanr)
165 struct dma_chan *chan = get_dma_chan(dmanr);
171 static inline void enable_dma_buffers(
unsigned int dmanr)
173 struct dma_chan *chan = get_dma_chan(dmanr);
180 static inline void start_dma(
unsigned int dmanr)
182 struct dma_chan *chan = get_dma_chan(dmanr);
189 #define DMA_HALT_POLL 0x5000
191 static inline void halt_dma(
unsigned int dmanr)
193 struct dma_chan *chan = get_dma_chan(dmanr);
204 if (i == DMA_HALT_POLL)
210 struct dma_chan *chan = get_dma_chan(dmanr);
221 static inline int dma_halted(
unsigned int dmanr)
223 struct dma_chan *chan = get_dma_chan(dmanr);
231 static inline void init_dma(
unsigned int dmanr)
233 struct dma_chan *chan = get_dma_chan(dmanr);
255 static inline void set_dma_mode(
unsigned int dmanr,
unsigned int mode)
257 struct dma_chan *chan = get_dma_chan(dmanr);
271 static inline unsigned int get_dma_mode(
unsigned int dmanr)
273 struct dma_chan *chan = get_dma_chan(dmanr);
280 static inline int get_dma_active_buffer(
unsigned int dmanr)
282 struct dma_chan *chan = get_dma_chan(dmanr);
294 static inline void set_dma_fifo_addr(
unsigned int dmanr,
unsigned int a)
296 struct dma_chan *chan = get_dma_chan(dmanr);
313 static inline void clear_dma_done0(
unsigned int dmanr)
315 struct dma_chan *chan = get_dma_chan(dmanr);
322 static inline void clear_dma_done1(
unsigned int dmanr)
324 struct dma_chan *chan = get_dma_chan(dmanr);
334 static inline void set_dma_page(
unsigned int dmanr,
char pagenr)
341 static inline void set_dma_addr0(
unsigned int dmanr,
unsigned int a)
343 struct dma_chan *chan = get_dma_chan(dmanr);
353 static inline void set_dma_addr1(
unsigned int dmanr,
unsigned int a)
355 struct dma_chan *chan = get_dma_chan(dmanr);
366 static inline void set_dma_count0(
unsigned int dmanr,
unsigned int count)
368 struct dma_chan *chan = get_dma_chan(dmanr);
379 static inline void set_dma_count1(
unsigned int dmanr,
unsigned int count)
381 struct dma_chan *chan = get_dma_chan(dmanr);
392 static inline void set_dma_count(
unsigned int dmanr,
unsigned int count)
394 struct dma_chan *chan = get_dma_chan(dmanr);
407 static inline unsigned int get_dma_buffer_done(
unsigned int dmanr)
409 struct dma_chan *chan = get_dma_chan(dmanr);
420 static inline int get_dma_done_irq(
unsigned int dmanr)
422 struct dma_chan *chan = get_dma_chan(dmanr);
434 int curBufCntReg,
count;
435 struct dma_chan *chan = get_dma_chan(dmanr);