Lines Matching refs:mantis

35 #define RISC_INSTR(risc_pos, opcode)	(mantis->risc_cpu[risc_pos++] = cpu_to_le32(opcode))
46 int mantis_dma_exit(struct mantis_pci *mantis) in mantis_dma_exit() argument
48 if (mantis->buf_cpu) { in mantis_dma_exit()
51 (unsigned long) mantis->buf_dma, in mantis_dma_exit()
52 mantis->buf_cpu, in mantis_dma_exit()
55 dma_free_coherent(&mantis->pdev->dev, MANTIS_BUF_SIZE, in mantis_dma_exit()
56 mantis->buf_cpu, mantis->buf_dma); in mantis_dma_exit()
58 mantis->buf_cpu = NULL; in mantis_dma_exit()
60 if (mantis->risc_cpu) { in mantis_dma_exit()
63 (unsigned long) mantis->risc_dma, in mantis_dma_exit()
64 mantis->risc_cpu, in mantis_dma_exit()
67 dma_free_coherent(&mantis->pdev->dev, MANTIS_RISC_SIZE, in mantis_dma_exit()
68 mantis->risc_cpu, mantis->risc_dma); in mantis_dma_exit()
70 mantis->risc_cpu = NULL; in mantis_dma_exit()
77 static inline int mantis_alloc_buffers(struct mantis_pci *mantis) in mantis_alloc_buffers() argument
79 if (!mantis->buf_cpu) { in mantis_alloc_buffers()
80 mantis->buf_cpu = dma_alloc_coherent(&mantis->pdev->dev, in mantis_alloc_buffers()
82 &mantis->buf_dma, GFP_KERNEL); in mantis_alloc_buffers()
83 if (!mantis->buf_cpu) { in mantis_alloc_buffers()
91 (unsigned long) mantis->buf_dma, in mantis_alloc_buffers()
92 mantis->buf_cpu, MANTIS_BUF_SIZE); in mantis_alloc_buffers()
94 if (!mantis->risc_cpu) { in mantis_alloc_buffers()
95 mantis->risc_cpu = dma_alloc_coherent(&mantis->pdev->dev, in mantis_alloc_buffers()
97 &mantis->risc_dma, GFP_KERNEL); in mantis_alloc_buffers()
99 if (!mantis->risc_cpu) { in mantis_alloc_buffers()
103 mantis_dma_exit(mantis); in mantis_alloc_buffers()
109 (unsigned long) mantis->risc_dma, in mantis_alloc_buffers()
110 mantis->risc_cpu, MANTIS_RISC_SIZE); in mantis_alloc_buffers()
119 int mantis_dma_init(struct mantis_pci *mantis) in mantis_dma_init() argument
124 err = mantis_alloc_buffers(mantis); in mantis_dma_init()
138 static inline void mantis_risc_program(struct mantis_pci *mantis) in mantis_risc_program() argument
161 RISC_INSTR(risc_pos, mantis->buf_dma + buf_pos); in mantis_risc_program()
166 RISC_INSTR(risc_pos, mantis->risc_dma); in mantis_risc_program()
169 void mantis_dma_start(struct mantis_pci *mantis) in mantis_dma_start() argument
173 mantis_risc_program(mantis); in mantis_dma_start()
174 mmwrite(mantis->risc_dma, MANTIS_RISC_START); in mantis_dma_start()
178 mantis->last_block = mantis->busy_block = 0; in mantis_dma_start()
180 mantis_unmask_ints(mantis, MANTIS_INT_RISCI); in mantis_dma_start()
187 void mantis_dma_stop(struct mantis_pci *mantis) in mantis_dma_stop() argument
199 mantis_mask_ints(mantis, MANTIS_INT_RISCI | MANTIS_INT_RISCEN); in mantis_dma_stop()
205 struct mantis_pci *mantis = from_tasklet(mantis, t, tasklet); in mantis_dma_xfer() local
206 struct mantis_hwconfig *config = mantis->hwconfig; in mantis_dma_xfer()
208 while (mantis->last_block != mantis->busy_block) { in mantis_dma_xfer()
210 mantis->last_block, mantis->busy_block); in mantis_dma_xfer()
213 (&mantis->demux, &mantis->buf_cpu[mantis->last_block * MANTIS_BLOCK_BYTES], MANTIS_BLOCK_BYTES); in mantis_dma_xfer()
214 mantis->last_block = (mantis->last_block + 1) % MANTIS_BLOCK_COUNT; in mantis_dma_xfer()